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

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

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

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

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -27,12 +27,6 @@ import org.springframework.lang.Nullable;
/** /**
* A Spring {@link FactoryBean} that builds and exposes a preconfigured {@link ForkJoinPool}. * 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 * @author Juergen Hoeller
* @since 3.1 * @since 3.1
*/ */

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

@ -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 * <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). * 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
} }
/** /**
* 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 * <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). * 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> * <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 {
ClassUtils.forName("javax.annotation.Priority", OrderUtils.class.getClassLoader()); ClassUtils.forName("javax.annotation.Priority", OrderUtils.class.getClassLoader());
} }
catch (Throwable ex) { catch (Throwable ex) {
// javax.annotation.Priority not available, or present but not loadable (on JDK 6) // javax.annotation.Priority not available
priorityAnnotationType = null; priorityAnnotationType = null;
} }
} }

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

@ -145,12 +145,7 @@ public class AnnotationUtilsTests {
assertNull(getAnnotation(bridgeMethod, Order.class)); assertNull(getAnnotation(bridgeMethod, Order.class));
assertNotNull(findAnnotation(bridgeMethod, Order.class)); assertNotNull(findAnnotation(bridgeMethod, Order.class));
// As of OpenJDK 8 b99, invoking getAnnotation() on a bridge method actually finds assertNotNull(bridgeMethod.getAnnotation(Transactional.class));
// 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(getAnnotation(bridgeMethod, Transactional.class)); assertNotNull(getAnnotation(bridgeMethod, Transactional.class));
assertNotNull(findAnnotation(bridgeMethod, Transactional.class)); assertNotNull(findAnnotation(bridgeMethod, Transactional.class));
} }

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

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -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. * representing its data in a disconnected fashion.
* <p>This implementation creates a Spring ResultSetWrappingSqlRowSet * <p>This implementation creates a Spring {@link ResultSetWrappingSqlRowSet}
* instance that wraps a standard JDBC CachedRowSet instance. * instance that wraps a standard JDBC {@link CachedRowSet} instance.
* Can be overridden to use a different implementation. * Can be overridden to use a different implementation.
* @param rs the original ResultSet (connected) * @param rs the original ResultSet (connected)
* @return the disconnected SqlRowSet * @return the disconnected SqlRowSet
* @throws SQLException if thrown by JDBC methods * @throws SQLException if thrown by JDBC methods
* @see #newCachedRowSet * @see #newCachedRowSet()
* @see org.springframework.jdbc.support.rowset.ResultSetWrappingSqlRowSet * @see org.springframework.jdbc.support.rowset.ResultSetWrappingSqlRowSet
*/ */
protected SqlRowSet createSqlRowSet(ResultSet rs) throws SQLException { protected SqlRowSet createSqlRowSet(ResultSet rs) throws SQLException {
@ -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. * the {@code createSqlRowSet} implementation.
* <p>The default implementation uses JDBC 4.1's RowSetProvider * <p>The default implementation uses JDBC 4.1's {@link RowSetFactory}.
* when running on JDK 7 or higher, falling back to Sun's
* {@code com.sun.rowset.CachedRowSetImpl} class on older JDKs.
* @return a new CachedRowSet instance * @return a new CachedRowSet instance
* @throws SQLException if thrown by JDBC methods * @throws SQLException if thrown by JDBC methods
* @see #createSqlRowSet * @see #createSqlRowSet
* @see RowSetProvider#newFactory()
* @see RowSetFactory#createCachedRowSet()
*/ */
protected CachedRowSet newCachedRowSet() throws SQLException { protected CachedRowSet newCachedRowSet() throws SQLException {
return rowSetFactory.createCachedRowSet(); return rowSetFactory.createCachedRowSet();

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

@ -57,6 +57,9 @@ import org.springframework.util.CommonsLogWriter;
*/ */
public class HessianExporter extends RemoteExporter implements InitializingBean { 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"; 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
response.setContentType(CONTENT_TYPE_HESSIAN); response.setContentType(CONTENT_TYPE_HESSIAN);
try { try {
invoke(request.getInputStream(), response.getOutputStream()); invoke(request.getInputStream(), response.getOutputStream());
} }
catch (Throwable ex) { 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 @@
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -164,8 +164,8 @@ public class SimpleHttpServerJaxWsServiceExporter extends AbstractJaxWsServiceEx
InetSocketAddress address = (this.hostname != null ? InetSocketAddress address = (this.hostname != null ?
new InetSocketAddress(this.hostname, this.port) : new InetSocketAddress(this.port)); new InetSocketAddress(this.hostname, this.port) : new InetSocketAddress(this.port));
HttpServer server = HttpServer.create(address, this.backlog); HttpServer server = HttpServer.create(address, this.backlog);
if (this.logger.isInfoEnabled()) { if (logger.isInfoEnabled()) {
this.logger.info("Starting HttpServer at address " + address); logger.info("Starting HttpServer at address " + address);
} }
server.start(); server.start();
this.server = server; this.server = server;

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

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -30,11 +30,7 @@ import javax.xml.ws.WebServiceProvider;
* *
* <p>Note that this exporter will only work if the JAX-WS runtime actually * <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 * 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 * ships an internal HTTP server.
* 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}!
* *
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 2.5 * @since 2.5
@ -44,6 +40,9 @@ import javax.xml.ws.WebServiceProvider;
*/ */
public class SimpleJaxWsServiceExporter extends AbstractJaxWsServiceExporter { public class SimpleJaxWsServiceExporter extends AbstractJaxWsServiceExporter {
/**
* The default base address.
*/
public static final String DEFAULT_BASE_ADDRESS = "http://localhost:8080/"; public static final String DEFAULT_BASE_ADDRESS = "http://localhost:8080/";
private String baseAddress = DEFAULT_BASE_ADDRESS; 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
} }
finally { finally {
this.sendStartTime = 0; this.sendStartTime = 0;
flushLock.unlock(); this.flushLock.unlock();
} }
return true; return true;
} }

Loading…
Cancel
Save