Browse Source

Pruning of outdated JDK 6/7 references (plus related polishing)

(cherry picked from commit b325c74216)
pull/1946/head
Juergen Hoeller 7 years ago
parent
commit
a45ef35b38
  1. 33
      spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.java
  2. 17
      spring-aop/src/main/java/org/springframework/aop/config/AopNamespaceUtils.java
  3. 8
      spring-context/src/main/java/org/springframework/scheduling/concurrent/ForkJoinPoolFactoryBean.java
  4. 2
      spring-context/src/main/java/org/springframework/scheduling/concurrent/ScheduledExecutorFactoryBean.java
  5. 2
      spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskScheduler.java
  6. 2
      spring-core/src/main/java/org/springframework/core/annotation/OrderUtils.java
  7. 7
      spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java
  8. 18
      spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlRowSetResultSetExtractor.java
  9. 3
      spring-web/src/main/java/org/springframework/remoting/caucho/HessianExporter.java
  10. 4
      spring-web/src/main/java/org/springframework/remoting/caucho/HessianServiceExporter.java
  11. 6
      spring-web/src/main/java/org/springframework/remoting/jaxws/SimpleHttpServerJaxWsServiceExporter.java
  12. 11
      spring-web/src/main/java/org/springframework/remoting/jaxws/SimpleJaxWsServiceExporter.java
  13. 2
      spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java

33
spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-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.
@ -32,11 +32,10 @@ import org.springframework.util.Assert; @@ -32,11 +32,10 @@ import org.springframework.util.Assert;
/**
* Utility class for handling registration of AOP auto-proxy creators.
*
* <p>Only a single auto-proxy creator can be registered yet multiple concrete
* implementations are available. Therefore this class wraps a simple escalation
* protocol, allowing classes to request a particular auto-proxy creator and know
* that class, {@code or a subclass thereof}, will eventually be resident
* in the application context.
* <p>Only a single auto-proxy creator should be registered yet multiple concrete
* implementations are available. This class provides a simple escalation protocol,
* allowing a caller to request a particular auto-proxy creator and know that creator,
* <i>or a more capable variant thereof</i>, will be registered as a post-processor.
*
* @author Rob Harrop
* @author Juergen Hoeller
@ -55,12 +54,10 @@ public abstract class AopConfigUtils { @@ -55,12 +54,10 @@ public abstract class AopConfigUtils {
/**
* Stores the auto proxy creator classes in escalation order.
*/
private static final List<Class<?>> APC_PRIORITY_LIST = new ArrayList<>();
private static final List<Class<?>> APC_PRIORITY_LIST = new ArrayList<>(3);
/**
* Setup the escalation list.
*/
static {
// Set up the escalation list...
APC_PRIORITY_LIST.add(InfrastructureAdvisorAutoProxyCreator.class);
APC_PRIORITY_LIST.add(AspectJAwareAdvisorAutoProxyCreator.class);
APC_PRIORITY_LIST.add(AnnotationAwareAspectJAutoProxyCreator.class);
@ -73,8 +70,8 @@ public abstract class AopConfigUtils { @@ -73,8 +70,8 @@ public abstract class AopConfigUtils {
}
@Nullable
public static BeanDefinition registerAutoProxyCreatorIfNecessary(BeanDefinitionRegistry registry,
@Nullable Object source) {
public static BeanDefinition registerAutoProxyCreatorIfNecessary(
BeanDefinitionRegistry registry, @Nullable Object source) {
return registerOrEscalateApcAsRequired(InfrastructureAdvisorAutoProxyCreator.class, registry, source);
}
@ -85,8 +82,8 @@ public abstract class AopConfigUtils { @@ -85,8 +82,8 @@ public abstract class AopConfigUtils {
}
@Nullable
public static BeanDefinition registerAspectJAutoProxyCreatorIfNecessary(BeanDefinitionRegistry registry,
@Nullable Object source) {
public static BeanDefinition registerAspectJAutoProxyCreatorIfNecessary(
BeanDefinitionRegistry registry, @Nullable Object source) {
return registerOrEscalateApcAsRequired(AspectJAwareAdvisorAutoProxyCreator.class, registry, source);
}
@ -97,8 +94,8 @@ public abstract class AopConfigUtils { @@ -97,8 +94,8 @@ public abstract class AopConfigUtils {
}
@Nullable
public static BeanDefinition registerAspectJAnnotationAutoProxyCreatorIfNecessary(BeanDefinitionRegistry registry,
@Nullable Object source) {
public static BeanDefinition registerAspectJAnnotationAutoProxyCreatorIfNecessary(
BeanDefinitionRegistry registry, @Nullable Object source) {
return registerOrEscalateApcAsRequired(AnnotationAwareAspectJAutoProxyCreator.class, registry, source);
}
@ -118,8 +115,8 @@ public abstract class AopConfigUtils { @@ -118,8 +115,8 @@ public abstract class AopConfigUtils {
}
@Nullable
private static BeanDefinition registerOrEscalateApcAsRequired(Class<?> cls, BeanDefinitionRegistry registry,
@Nullable Object source) {
private static BeanDefinition registerOrEscalateApcAsRequired(
Class<?> cls, BeanDefinitionRegistry registry, @Nullable Object source) {
Assert.notNull(registry, "BeanDefinitionRegistry must not be null");

17
spring-aop/src/main/java/org/springframework/aop/config/AopNamespaceUtils.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-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.
@ -28,11 +28,11 @@ import org.springframework.lang.Nullable; @@ -28,11 +28,11 @@ import org.springframework.lang.Nullable;
* Utility class for handling registration of auto-proxy creators used internally
* by the '{@code aop}' namespace tags.
*
* <p>Only a single auto-proxy creator can be registered and multiple tags may wish
* to register different concrete implementations. As such this class delegates to
* {@link AopConfigUtils} which wraps a simple escalation protocol. Therefore classes
* may request a particular auto-proxy creator and know that class, <i>or a subclass
* thereof</i>, will eventually be resident in the application context.
* <p>Only a single auto-proxy creator should be registered and multiple configuration
* elements may wish to register different concrete implementations. As such this class
* delegates to {@link AopConfigUtils} which provides a simple escalation protocol.
* Callers may request a particular auto-proxy creator and know that creator,
* <i>or a more capable variant thereof</i>, will be registered as a post-processor.
*
* @author Rob Harrop
* @author Juergen Hoeller
@ -95,9 +95,8 @@ public abstract class AopNamespaceUtils { @@ -95,9 +95,8 @@ public abstract class AopNamespaceUtils {
private static void registerComponentIfNecessary(@Nullable BeanDefinition beanDefinition, ParserContext parserContext) {
if (beanDefinition != null) {
BeanComponentDefinition componentDefinition =
new BeanComponentDefinition(beanDefinition, AopConfigUtils.AUTO_PROXY_CREATOR_BEAN_NAME);
parserContext.registerComponent(componentDefinition);
parserContext.registerComponent(
new BeanComponentDefinition(beanDefinition, AopConfigUtils.AUTO_PROXY_CREATOR_BEAN_NAME));
}
}

8
spring-context/src/main/java/org/springframework/scheduling/concurrent/ForkJoinPoolFactoryBean.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-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.
@ -27,12 +27,6 @@ import org.springframework.lang.Nullable; @@ -27,12 +27,6 @@ import org.springframework.lang.Nullable;
/**
* A Spring {@link FactoryBean} that builds and exposes a preconfigured {@link ForkJoinPool}.
*
* <p>For details on the ForkJoinPool API and its use with RecursiveActions, see the
* <a href="http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ForkJoinPool.html">JDK 7 javadoc</a>.
*
* <p>{@code jsr166.jar}, containing {@code java.util.concurrent} updates for Java 6, can be obtained
* from the <a href="http://gee.cs.oswego.edu/dl/concurrency-interest/">concurrency interest website</a>.
*
* @author Juergen Hoeller
* @since 3.1
*/

2
spring-context/src/main/java/org/springframework/scheduling/concurrent/ScheduledExecutorFactoryBean.java

@ -111,7 +111,7 @@ public class ScheduledExecutorFactoryBean extends ExecutorConfigurationSupport @@ -111,7 +111,7 @@ public class ScheduledExecutorFactoryBean extends ExecutorConfigurationSupport
}
/**
* Set the remove-on-cancel mode on {@link ScheduledThreadPoolExecutor} (JDK 7+).
* Set the remove-on-cancel mode on {@link ScheduledThreadPoolExecutor}.
* <p>Default is {@code false}. If set to {@code true}, the target executor will be
* switched into remove-on-cancel mode (if possible, with a soft fallback otherwise).
*/

2
spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskScheduler.java

@ -88,7 +88,7 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport @@ -88,7 +88,7 @@ public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport
}
/**
* Set the remove-on-cancel mode on {@link ScheduledThreadPoolExecutor} (JDK 7+).
* Set the remove-on-cancel mode on {@link ScheduledThreadPoolExecutor}.
* <p>Default is {@code false}. If set to {@code true}, the target executor will be
* switched into remove-on-cancel mode (if possible, with a soft fallback otherwise).
* <p><b>This setting can be modified at runtime, for example through JMX.</b>

2
spring-core/src/main/java/org/springframework/core/annotation/OrderUtils.java

@ -49,7 +49,7 @@ public abstract class OrderUtils { @@ -49,7 +49,7 @@ public abstract class OrderUtils {
ClassUtils.forName("javax.annotation.Priority", OrderUtils.class.getClassLoader());
}
catch (Throwable ex) {
// javax.annotation.Priority not available, or present but not loadable (on JDK 6)
// javax.annotation.Priority not available
priorityAnnotationType = null;
}
}

7
spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java

@ -145,12 +145,7 @@ public class AnnotationUtilsTests { @@ -145,12 +145,7 @@ public class AnnotationUtilsTests {
assertNull(getAnnotation(bridgeMethod, Order.class));
assertNotNull(findAnnotation(bridgeMethod, Order.class));
// As of OpenJDK 8 b99, invoking getAnnotation() on a bridge method actually finds
// an annotation on its 'bridged' method. This differs from the previous behavior
// of JDK 5 through 7 and from the current behavior of the Eclipse compiler;
// however, we need to ensure that the tests pass in the Gradle build. So we
// comment out the following assertion.
// assertNull(bridgeMethod.getAnnotation(Transactional.class));
assertNotNull(bridgeMethod.getAnnotation(Transactional.class));
assertNotNull(getAnnotation(bridgeMethod, Transactional.class));
assertNotNull(findAnnotation(bridgeMethod, Transactional.class));
}

18
spring-jdbc/src/main/java/org/springframework/jdbc/core/SqlRowSetResultSetExtractor.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.
@ -58,15 +58,15 @@ public class SqlRowSetResultSetExtractor implements ResultSetExtractor<SqlRowSet @@ -58,15 +58,15 @@ public class SqlRowSetResultSetExtractor implements ResultSetExtractor<SqlRowSet
}
/**
* Create a SqlRowSet that wraps the given ResultSet,
* Create a {@link SqlRowSet} that wraps the given {@link ResultSet},
* representing its data in a disconnected fashion.
* <p>This implementation creates a Spring ResultSetWrappingSqlRowSet
* instance that wraps a standard JDBC CachedRowSet instance.
* <p>This implementation creates a Spring {@link ResultSetWrappingSqlRowSet}
* instance that wraps a standard JDBC {@link CachedRowSet} instance.
* Can be overridden to use a different implementation.
* @param rs the original ResultSet (connected)
* @return the disconnected SqlRowSet
* @throws SQLException if thrown by JDBC methods
* @see #newCachedRowSet
* @see #newCachedRowSet()
* @see org.springframework.jdbc.support.rowset.ResultSetWrappingSqlRowSet
*/
protected SqlRowSet createSqlRowSet(ResultSet rs) throws SQLException {
@ -76,14 +76,14 @@ public class SqlRowSetResultSetExtractor implements ResultSetExtractor<SqlRowSet @@ -76,14 +76,14 @@ public class SqlRowSetResultSetExtractor implements ResultSetExtractor<SqlRowSet
}
/**
* Create a new CachedRowSet instance, to be populated by
* Create a new {@link CachedRowSet} instance, to be populated by
* the {@code createSqlRowSet} implementation.
* <p>The default implementation uses JDBC 4.1's RowSetProvider
* when running on JDK 7 or higher, falling back to Sun's
* {@code com.sun.rowset.CachedRowSetImpl} class on older JDKs.
* <p>The default implementation uses JDBC 4.1's {@link RowSetFactory}.
* @return a new CachedRowSet instance
* @throws SQLException if thrown by JDBC methods
* @see #createSqlRowSet
* @see RowSetProvider#newFactory()
* @see RowSetFactory#createCachedRowSet()
*/
protected CachedRowSet newCachedRowSet() throws SQLException {
return rowSetFactory.createCachedRowSet();

3
spring-web/src/main/java/org/springframework/remoting/caucho/HessianExporter.java

@ -57,6 +57,9 @@ import org.springframework.util.CommonsLogWriter; @@ -57,6 +57,9 @@ import org.springframework.util.CommonsLogWriter;
*/
public class HessianExporter extends RemoteExporter implements InitializingBean {
/**
* The content type for hessian ({@code application/x-hessian}).
*/
public static final String CONTENT_TYPE_HESSIAN = "application/x-hessian";

4
spring-web/src/main/java/org/springframework/remoting/caucho/HessianServiceExporter.java

@ -63,10 +63,10 @@ public class HessianServiceExporter extends HessianExporter implements HttpReque @@ -63,10 +63,10 @@ public class HessianServiceExporter extends HessianExporter implements HttpReque
response.setContentType(CONTENT_TYPE_HESSIAN);
try {
invoke(request.getInputStream(), response.getOutputStream());
invoke(request.getInputStream(), response.getOutputStream());
}
catch (Throwable ex) {
throw new NestedServletException("Hessian skeleton invocation failed", ex);
throw new NestedServletException("Hessian skeleton invocation failed", ex);
}
}

6
spring-web/src/main/java/org/springframework/remoting/jaxws/SimpleHttpServerJaxWsServiceExporter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-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.
@ -164,8 +164,8 @@ public class SimpleHttpServerJaxWsServiceExporter extends AbstractJaxWsServiceEx @@ -164,8 +164,8 @@ public class SimpleHttpServerJaxWsServiceExporter extends AbstractJaxWsServiceEx
InetSocketAddress address = (this.hostname != null ?
new InetSocketAddress(this.hostname, this.port) : new InetSocketAddress(this.port));
HttpServer server = HttpServer.create(address, this.backlog);
if (this.logger.isInfoEnabled()) {
this.logger.info("Starting HttpServer at address " + address);
if (logger.isInfoEnabled()) {
logger.info("Starting HttpServer at address " + address);
}
server.start();
this.server = server;

11
spring-web/src/main/java/org/springframework/remoting/jaxws/SimpleJaxWsServiceExporter.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-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.
@ -30,11 +30,7 @@ import javax.xml.ws.WebServiceProvider; @@ -30,11 +30,7 @@ import javax.xml.ws.WebServiceProvider;
*
* <p>Note that this exporter will only work if the JAX-WS runtime actually
* supports publishing with an address argument, i.e. if the JAX-WS runtime
* ships an internal HTTP server. This is the case with the JAX-WS runtime
* that's included in Sun's JDK 6 but not with the standalone JAX-WS 2.1 RI.
*
* <p>For explicit configuration of JAX-WS endpoints with Sun's JDK 6
* HTTP server, consider using {@link SimpleHttpServerJaxWsServiceExporter}!
* ships an internal HTTP server.
*
* @author Juergen Hoeller
* @since 2.5
@ -44,6 +40,9 @@ import javax.xml.ws.WebServiceProvider; @@ -44,6 +40,9 @@ import javax.xml.ws.WebServiceProvider;
*/
public class SimpleJaxWsServiceExporter extends AbstractJaxWsServiceExporter {
/**
* The default base address.
*/
public static final String DEFAULT_BASE_ADDRESS = "http://localhost:8080/";
private String baseAddress = DEFAULT_BASE_ADDRESS;

2
spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java

@ -156,7 +156,7 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat @@ -156,7 +156,7 @@ public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorat
}
finally {
this.sendStartTime = 0;
flushLock.unlock();
this.flushLock.unlock();
}
return true;
}

Loading…
Cancel
Save