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

This commit is contained in:
Juergen Hoeller 2018-08-07 20:36:47 +02:00
parent 2b051b8b32
commit b325c74216
8 changed files with 37 additions and 52 deletions

View File

@ -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");

View File

@ -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);
} }
} }

View File

@ -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
*/ */

View File

@ -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).
*/ */

View File

@ -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>

View File

@ -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;
} }
} }

View File

@ -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));
} }

View File

@ -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();