Skip to content

INT-4458: Do not expose recursive generics API #2432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
buildscript {
ext.kotlinVersion = '1.2.40'
ext.kotlinVersion = '1.2.41'
repositories {
maven { url 'https://repo.spring.io/plugins-release' }
}
dependencies {
classpath 'io.spring.gradle:docbook-reference-plugin:0.3.1'
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion"
}
}

Expand Down Expand Up @@ -61,6 +62,7 @@ subprojects { subproject ->
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'

sourceSets {
test {
Expand All @@ -77,6 +79,7 @@ subprojects { subproject ->

compileTestKotlin {
kotlinOptions {
freeCompilerArgs = ['-Xjsr305=strict']
jvmTarget = '1.8'
}
}
Expand Down Expand Up @@ -176,7 +179,7 @@ subprojects { subproject ->
exclude group: 'org.jetbrains.kotlin', module: 'kotlin-reflect'
}

testCompile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
testCompile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
testRuntime "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ public static AmqpInboundGatewaySMLCSpec inboundGateway(ConnectionFactory connec
* @param queueNames the queueNames.
* @return the AmqpInboundGatewaySpec.
*/
public static AmqpInboundGatewaySMLCSpec inboundGateway(ConnectionFactory connectionFactory, AmqpTemplate amqpTemplate,
String... queueNames) {
public static AmqpInboundGatewaySMLCSpec inboundGateway(ConnectionFactory connectionFactory,
AmqpTemplate amqpTemplate, String... queueNames) {

SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer(connectionFactory);
listenerContainer.setQueueNames(queueNames);
Expand All @@ -81,8 +81,8 @@ public static AmqpInboundGatewaySMLCSpec inboundGateway(ConnectionFactory connec
* @param queues the queues.
* @return the AmqpInboundGatewaySpec.
*/
public static AmqpInboundGatewaySMLCSpec inboundGateway(ConnectionFactory connectionFactory, AmqpTemplate amqpTemplate,
Queue... queues) {
public static AmqpInboundGatewaySMLCSpec inboundGateway(ConnectionFactory connectionFactory,
AmqpTemplate amqpTemplate, Queue... queues) {

SimpleMessageListenerContainer listenerContainer = new SimpleMessageListenerContainer(connectionFactory);
listenerContainer.setQueues(queues);
Expand Down Expand Up @@ -266,51 +266,41 @@ public static AmqpAsyncOutboundGatewaySpec asyncOutboundGateway(AsyncRabbitTempl
/**
* Create an initial AmqpPollableMessageChannelSpec.
* @param connectionFactory the connectionFactory.
* @param <S> the spec type.
* @return the AmqpPollableMessageChannelSpec.
*/
public static <S extends AmqpPollableMessageChannelSpec<S>> AmqpPollableMessageChannelSpec<S> pollableChannel(
ConnectionFactory connectionFactory) {

public static AmqpPollableMessageChannelSpec<?> pollableChannel(ConnectionFactory connectionFactory) {
return pollableChannel(null, connectionFactory);
}

/**
* Create an initial AmqpPollableMessageChannelSpec.
* @param id the id.
* @param connectionFactory the connectionFactory.
* @param <S> the spec type.
* @return the AmqpPollableMessageChannelSpec.
*/
public static <S extends AmqpPollableMessageChannelSpec<S>> AmqpPollableMessageChannelSpec<S> pollableChannel(
String id, ConnectionFactory connectionFactory) {

return new AmqpPollableMessageChannelSpec<S>(connectionFactory).id(id);
public static AmqpPollableMessageChannelSpec<?> pollableChannel(String id, ConnectionFactory connectionFactory) {
return new AmqpPollableMessageChannelSpec<>(connectionFactory)
.id(id);
}

/**
* Create an initial AmqpMessageChannelSpec.
* @param connectionFactory the connectionFactory.
* @param <S> the spec type.
* @return the AmqpMessageChannelSpec.
*/
public static <S extends AmqpMessageChannelSpec<S>> AmqpMessageChannelSpec<S> channel(
ConnectionFactory connectionFactory) {

public static AmqpMessageChannelSpec<?> channel(ConnectionFactory connectionFactory) {
return channel(null, connectionFactory);
}

/**
* Create an initial AmqpMessageChannelSpec.
* @param id the id.
* @param connectionFactory the connectionFactory.
* @param <S> the spec type.
* @return the AmqpMessageChannelSpec.
*/
public static <S extends AmqpMessageChannelSpec<S>> AmqpMessageChannelSpec<S> channel(String id,
ConnectionFactory connectionFactory) {

return new AmqpMessageChannelSpec<S>(connectionFactory).id(id);
public static AmqpMessageChannelSpec<?> channel(String id, ConnectionFactory connectionFactory) {
return new AmqpMessageChannelSpec<>(connectionFactory)
.id(id);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ class RouterDslTests {

@Configuration
@EnableIntegration
open class Config {
class Config {

@Bean
open fun routerTwoSubFlows() =
fun routerTwoSubFlows() =
IntegrationFlow { f ->
f.split()
.route<Int, Boolean>({ p -> p % 2 == 0 },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2017 the original author or authors.
* Copyright 2014-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -36,47 +36,40 @@ public final class Jms {
/**
* The factory to produce a {@link JmsPollableMessageChannelSpec}.
* @param connectionFactory the JMS ConnectionFactory to build on
* @param <S> the {@link JmsPollableMessageChannelSpec} inheritor type
* @return the {@link JmsPollableMessageChannelSpec} instance
*/
public static <S extends JmsPollableMessageChannelSpec<S>> JmsPollableMessageChannelSpec<S> pollableChannel(
ConnectionFactory connectionFactory) {
public static JmsPollableMessageChannelSpec<?> pollableChannel(ConnectionFactory connectionFactory) {
return pollableChannel(null, connectionFactory);
}

/**
* The factory to produce a {@link JmsPollableMessageChannelSpec}.
* @param id the bean name for the target {@code PollableChannel} component
* @param connectionFactory the JMS ConnectionFactory to build on
* @param <S> the {@link JmsPollableMessageChannelSpec} inheritor type
* @return the {@link JmsPollableMessageChannelSpec} instance
*/
public static <S extends JmsPollableMessageChannelSpec<S>> JmsPollableMessageChannelSpec<S> pollableChannel(
String id, ConnectionFactory connectionFactory) {
return new JmsPollableMessageChannelSpec<S>(connectionFactory).id(id);
public static JmsPollableMessageChannelSpec<?> pollableChannel(String id, ConnectionFactory connectionFactory) {
return new JmsPollableMessageChannelSpec<>(connectionFactory).id(id);
}

/**
* The factory to produce a {@link JmsMessageChannelSpec}.
* @param connectionFactory the JMS ConnectionFactory to build on
* @param <S> the {@link JmsMessageChannelSpec} inheritor type
* @return the {@link JmsMessageChannelSpec} instance
*/
public static <S extends JmsMessageChannelSpec<S>> JmsMessageChannelSpec<S> channel(
ConnectionFactory connectionFactory) {
public static JmsMessageChannelSpec<?> channel(ConnectionFactory connectionFactory) {
return channel(null, connectionFactory);
}

/**
* The factory to produce a {@link JmsMessageChannelSpec}.
* @param id the bean name for the target {@code MessageChannel} component
* @param connectionFactory the JMS ConnectionFactory to build on
* @param <S> the {@link JmsMessageChannelSpec} inheritor type
* @return the {@link JmsMessageChannelSpec} instance
*/
public static <S extends JmsMessageChannelSpec<S>> JmsMessageChannelSpec<S> channel(String id,
ConnectionFactory connectionFactory) {
return new JmsMessageChannelSpec<S>(connectionFactory).id(id);
public static JmsMessageChannelSpec<?> channel(String id, ConnectionFactory connectionFactory) {
return new JmsMessageChannelSpec<>(connectionFactory)
.id(id);
}

/**
Expand All @@ -96,18 +89,17 @@ public static JmsPublishSubscribeMessageChannelSpec publishSubscribeChannel(Conn
*/
public static JmsPublishSubscribeMessageChannelSpec publishSubscribeChannel(String id,
ConnectionFactory connectionFactory) {

return new JmsPublishSubscribeMessageChannelSpec(connectionFactory).id(id);
}

/**
* The factory to produce a {@link JmsOutboundChannelAdapterSpec}.
* @param jmsTemplate the JmsTemplate to build on
* @param <S> the {@link JmsOutboundChannelAdapterSpec} inheritor type
* @return the {@link JmsOutboundChannelAdapterSpec} instance
*/
public static <S extends JmsOutboundChannelAdapterSpec<S>> JmsOutboundChannelAdapterSpec<S> outboundAdapter(
JmsTemplate jmsTemplate) {
return new JmsOutboundChannelAdapterSpec<S>(jmsTemplate);
public static JmsOutboundChannelAdapterSpec<?> outboundAdapter(JmsTemplate jmsTemplate) {
return new JmsOutboundChannelAdapterSpec<>(jmsTemplate);
}

/**
Expand All @@ -117,18 +109,17 @@ public static <S extends JmsOutboundChannelAdapterSpec<S>> JmsOutboundChannelAda
*/
public static JmsOutboundChannelAdapterSpec.JmsOutboundChannelSpecTemplateAware outboundAdapter(
ConnectionFactory connectionFactory) {

return new JmsOutboundChannelAdapterSpec.JmsOutboundChannelSpecTemplateAware(connectionFactory);
}

/**
* The factory to produce a {@link JmsInboundChannelAdapterSpec}.
* @param jmsTemplate the JmsTemplate to build on
* @param <S> the {@link JmsInboundChannelAdapterSpec} inheritor type
* @return the {@link JmsInboundChannelAdapterSpec} instance
*/
public static <S extends JmsInboundChannelAdapterSpec<S>> JmsInboundChannelAdapterSpec<S> inboundAdapter(
JmsTemplate jmsTemplate) {
return new JmsInboundChannelAdapterSpec<S>(jmsTemplate);
public static JmsInboundChannelAdapterSpec<?> inboundAdapter(JmsTemplate jmsTemplate) {
return new JmsInboundChannelAdapterSpec<>(jmsTemplate);
}

/**
Expand All @@ -138,6 +129,7 @@ public static <S extends JmsInboundChannelAdapterSpec<S>> JmsInboundChannelAdapt
*/
public static JmsInboundChannelAdapterSpec.JmsInboundChannelSpecTemplateAware inboundAdapter(
ConnectionFactory connectionFactory) {

return new JmsInboundChannelAdapterSpec.JmsInboundChannelSpecTemplateAware(connectionFactory);
}

Expand All @@ -153,12 +145,10 @@ public static JmsOutboundGatewaySpec outboundGateway(ConnectionFactory connectio
/**
* The factory to produce a {@link JmsOutboundGatewaySpec}.
* @param listenerContainer the JMS {@link AbstractMessageListenerContainer} to build on
* @param <S> the {@link JmsInboundGatewaySpec} inheritor type
* @return the {@link JmsOutboundGatewaySpec} instance
*/
public static <S extends JmsInboundGatewaySpec<S>> JmsInboundGatewaySpec<S> inboundGateway(
AbstractMessageListenerContainer listenerContainer) {
return new JmsInboundGatewaySpec<S>(listenerContainer);
public static JmsInboundGatewaySpec<?> inboundGateway(AbstractMessageListenerContainer listenerContainer) {
return new JmsInboundGatewaySpec<>(listenerContainer);
}

/**
Expand All @@ -168,26 +158,35 @@ public static <S extends JmsInboundGatewaySpec<S>> JmsInboundGatewaySpec<S> inbo
*/
public static JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec<JmsDefaultListenerContainerSpec, DefaultMessageListenerContainer>
inboundGateway(ConnectionFactory connectionFactory) {
return inboundGateway(connectionFactory, DefaultMessageListenerContainer.class);

try {
return new JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec<>(
new JmsDefaultListenerContainerSpec()
.connectionFactory(connectionFactory));
}
catch (Exception e) {
throw new IllegalStateException(e);
}
}

/**
* The factory to produce a {@link JmsOutboundGatewaySpec}.
* @param connectionFactory the JMS ConnectionFactory to build on
* @param containerClass the {@link AbstractMessageListenerContainer} implementation class
* to instantiate listener container
* @param <S> the {@link JmsListenerContainerSpec} inheritor type
* @param <C> the {@link AbstractMessageListenerContainer} inheritor type
* @return the {@link JmsOutboundGatewaySpec} instance
*/
public static <S extends JmsListenerContainerSpec<S, C>, C extends AbstractMessageListenerContainer>
JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec<S, C> inboundGateway(ConnectionFactory connectionFactory,
Class<C> containerClass) {
@SuppressWarnings({ "rawtypes", "unchecked" })
public static <C extends AbstractMessageListenerContainer>
JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec<?, C> inboundGateway(
ConnectionFactory connectionFactory, Class<C> containerClass) {

try {
JmsListenerContainerSpec<S, C> spec =
new JmsListenerContainerSpec<S, C>(containerClass)
JmsListenerContainerSpec<?, C> spec =
new JmsListenerContainerSpec<>(containerClass)
.connectionFactory(connectionFactory);
return new JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec<S, C>(spec);
return new JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec(spec);
}
catch (Exception e) {
throw new IllegalStateException(e);
Expand All @@ -197,13 +196,10 @@ JmsInboundGatewaySpec.JmsInboundGatewayListenerContainerSpec<S, C> inboundGatewa
/**
* The factory to produce a {@link JmsMessageDrivenChannelAdapterSpec}.
* @param listenerContainer the {@link AbstractMessageListenerContainer} to build on
* @param <S> the {@link JmsMessageDrivenChannelAdapterSpec} inheritor type
* @return the {@link JmsMessageDrivenChannelAdapterSpec} instance
*/
public static <S extends JmsMessageDrivenChannelAdapterSpec<S>>
JmsMessageDrivenChannelAdapterSpec<S> messageDrivenChannelAdapter(
AbstractMessageListenerContainer listenerContainer) {
return new JmsMessageDrivenChannelAdapterSpec<S>(listenerContainer);
public static JmsMessageDrivenChannelAdapterSpec<?> messageDrivenChannelAdapter(AbstractMessageListenerContainer listenerContainer) {
return new JmsMessageDrivenChannelAdapterSpec<>(listenerContainer);
}

/**
Expand All @@ -215,7 +211,8 @@ JmsMessageDrivenChannelAdapterSpec<S> messageDrivenChannelAdapter(
messageDrivenChannelAdapter(ConnectionFactory connectionFactory) {
try {
return new JmsMessageDrivenChannelAdapterSpec.JmsMessageDrivenChannelAdapterListenerContainerSpec<>(
new JmsDefaultListenerContainerSpec().connectionFactory(connectionFactory));
new JmsDefaultListenerContainerSpec()
.connectionFactory(connectionFactory));
}
catch (Exception e) {
throw new IllegalStateException(e);
Expand All @@ -227,18 +224,18 @@ JmsMessageDrivenChannelAdapterSpec<S> messageDrivenChannelAdapter(
* @param connectionFactory the JMS ConnectionFactory to build on
* @param containerClass the {@link AbstractMessageListenerContainer} implementation class
* to instantiate listener container
* @param <S> the {@link JmsListenerContainerSpec} inheritor type
* @param <C> the {@link AbstractMessageListenerContainer} inheritor type
* @return the {@link JmsMessageDrivenChannelAdapterSpec} instance
*/
public static <S extends JmsListenerContainerSpec<S, C>, C extends AbstractMessageListenerContainer>
JmsMessageDrivenChannelAdapterSpec.JmsMessageDrivenChannelAdapterListenerContainerSpec<S, C>
@SuppressWarnings({ "rawtypes", "unchecked" })
public static <C extends AbstractMessageListenerContainer>
JmsMessageDrivenChannelAdapterSpec.JmsMessageDrivenChannelAdapterListenerContainerSpec<?, C>
messageDrivenChannelAdapter(ConnectionFactory connectionFactory, Class<C> containerClass) {
try {
S spec =
new JmsListenerContainerSpec<S, C>(containerClass)
JmsListenerContainerSpec<?, C> spec =
new JmsListenerContainerSpec<>(containerClass)
.connectionFactory(connectionFactory);
return new JmsMessageDrivenChannelAdapterSpec.JmsMessageDrivenChannelAdapterListenerContainerSpec<>(spec);
return new JmsMessageDrivenChannelAdapterSpec.JmsMessageDrivenChannelAdapterListenerContainerSpec(spec);
}
catch (Exception e) {
throw new IllegalStateException(e);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2017 the original author or authors.
* Copyright 2016-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,6 +35,7 @@
* @param <S> the target {@link JmsInboundGatewaySpec} implementation type.
*
* @author Artem Bilan
*
* @since 5.0
*/
public class JmsInboundGatewaySpec<S extends JmsInboundGatewaySpec<S>>
Expand Down Expand Up @@ -184,9 +185,9 @@ public S extractReplyPayload(boolean extractReplyPayload) {
public static class JmsInboundGatewayListenerContainerSpec<S extends JmsListenerContainerSpec<S, C>, C extends AbstractMessageListenerContainer>
extends JmsInboundGatewaySpec<JmsInboundGatewayListenerContainerSpec<S, C>> {

private final JmsListenerContainerSpec<S, C> spec;
private final S spec;

JmsInboundGatewayListenerContainerSpec(JmsListenerContainerSpec<S, C> spec) {
JmsInboundGatewayListenerContainerSpec(S spec) {
super(spec.get());
this.spec = spec;
this.spec.get().setAutoStartup(false);
Expand All @@ -213,7 +214,7 @@ public JmsInboundGatewayListenerContainerSpec<S, C> destination(String destinati
}

public JmsInboundGatewayListenerContainerSpec<S, C> configureListenerContainer(
Consumer<JmsListenerContainerSpec<S, C>> configurer) {
Consumer<S> configurer) {
Assert.notNull(configurer, "'configurer' must not be null");
configurer.accept(this.spec);
return _this();
Expand Down
Loading