diff --git a/spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.java b/spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.java index c227150060..72b5c62653 100644 --- a/spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.java +++ b/spring-aop/src/main/java/org/springframework/aop/config/AopConfigUtils.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"); * you may not use this file except in compliance with the License. @@ -31,11 +31,10 @@ import org.springframework.util.Assert; /** * Utility class for handling registration of AOP auto-proxy creators. * - *
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. + *
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,
+ * or a more capable variant thereof, will be registered as a post-processor.
*
* @author Rob Harrop
* @author Juergen Hoeller
@@ -54,12 +53,10 @@ public abstract class AopConfigUtils {
/**
* Stores the auto proxy creator classes in escalation order.
*/
- private static final List 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, or a subclass
- * thereof, will eventually be resident in the application context.
+ * 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,
+ * or a more capable variant thereof, will be registered as a post-processor.
*
* @author Rob Harrop
* @author Juergen Hoeller
@@ -94,9 +94,8 @@ public abstract class AopNamespaceUtils {
private static void registerComponentIfNecessary(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));
}
}
diff --git a/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java b/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java
index 620668bf97..e7cbd72744 100644
--- a/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java
+++ b/spring-core/src/test/java/org/springframework/core/annotation/AnnotationUtilsTests.java
@@ -144,12 +144,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));
}
@@ -285,7 +280,7 @@ public class AnnotationUtilsTests {
}
@Test
- public void findAnnotationDeclaringClassForAllScenarios() throws Exception {
+ public void findAnnotationDeclaringClassForAllScenarios() {
// no class-level annotation
assertNull(findAnnotationDeclaringClass(Transactional.class, NonAnnotatedInterface.class));
assertNull(findAnnotationDeclaringClass(Transactional.class, NonAnnotatedClass.class));
@@ -394,7 +389,7 @@ public class AnnotationUtilsTests {
}
@Test
- public void isAnnotationInheritedForAllScenarios() throws Exception {
+ public void isAnnotationInheritedForAllScenarios() {
// no class-level annotation
assertFalse(isAnnotationInherited(Transactional.class, NonAnnotatedInterface.class));
assertFalse(isAnnotationInherited(Transactional.class, NonAnnotatedClass.class));
@@ -503,7 +498,7 @@ public class AnnotationUtilsTests {
}
@Test
- public void getDefaultValueFromNonPublicAnnotation() throws Exception {
+ public void getDefaultValueFromNonPublicAnnotation() {
Annotation[] declaredAnnotations = NonPublicAnnotatedClass.class.getDeclaredAnnotations();
assertEquals(1, declaredAnnotations.length);
Annotation annotation = declaredAnnotations[0];
@@ -514,7 +509,7 @@ public class AnnotationUtilsTests {
}
@Test
- public void getDefaultValueFromAnnotationType() throws Exception {
+ public void getDefaultValueFromAnnotationType() {
assertEquals(Ordered.LOWEST_PRECEDENCE, getDefaultValue(Order.class, VALUE));
assertEquals(Ordered.LOWEST_PRECEDENCE, getDefaultValue(Order.class));
}
@@ -546,7 +541,7 @@ public class AnnotationUtilsTests {
}
@Test
- public void getRepeatableAnnotationsDeclaredOnClassWithAttributeAliases() throws Exception {
+ public void getRepeatableAnnotationsDeclaredOnClassWithAttributeAliases() {
final List