diff --git a/spring-test/src/main/java/org/springframework/test/context/MetaAnnotationUtils.java b/spring-test/src/main/java/org/springframework/test/context/MetaAnnotationUtils.java index 06b3e8d963..02efb37670 100644 --- a/spring-test/src/main/java/org/springframework/test/context/MetaAnnotationUtils.java +++ b/spring-test/src/main/java/org/springframework/test/context/MetaAnnotationUtils.java @@ -61,12 +61,12 @@ abstract class MetaAnnotationUtils { return new AnnotationDescriptor(clazz, clazz.getAnnotation(annotationType)); } - // Declared on a stereotype annotation (i.e., as a meta-annotation)? + // Declared on a composed annotation (i.e., as a meta-annotation)? if (!Annotation.class.isAssignableFrom(clazz)) { - for (Annotation stereotype : clazz.getAnnotations()) { - T annotation = stereotype.annotationType().getAnnotation(annotationType); + for (Annotation composedAnnotation : clazz.getAnnotations()) { + T annotation = composedAnnotation.annotationType().getAnnotation(annotationType); if (annotation != null) { - return new AnnotationDescriptor(clazz, stereotype, annotation); + return new AnnotationDescriptor(clazz, composedAnnotation, annotation); } } } @@ -101,13 +101,13 @@ abstract class MetaAnnotationUtils { } } - // Declared on a stereotype annotation (i.e., as a meta-annotation)? + // Declared on a composed annotation (i.e., as a meta-annotation)? if (!Annotation.class.isAssignableFrom(clazz)) { - for (Annotation stereotype : clazz.getAnnotations()) { + for (Annotation composedAnnotation : clazz.getAnnotations()) { for (Class annotationType : annotationTypes) { - Annotation annotation = stereotype.annotationType().getAnnotation(annotationType); + Annotation annotation = composedAnnotation.annotationType().getAnnotation(annotationType); if (annotation != null) { - return new UntypedAnnotationDescriptor(clazz, stereotype, annotation); + return new UntypedAnnotationDescriptor(clazz, composedAnnotation, annotation); } } } @@ -125,9 +125,10 @@ abstract class MetaAnnotationUtils { * *

* If the annotation is used as a meta-annotation, the descriptor also includes - * the {@linkplain #getStereotype() stereotype} on which the annotation is - * present. In such cases, the root declaring class is not directly - * annotated with the annotation but rather indirectly via the stereotype. + * the {@linkplain #getComposedAnnotation() composed annotation} on which the + * annotation is present. In such cases, the root declaring class is + * not directly annotated with the annotation but rather indirectly via the + * composed annotation. * *

* Given the following example, if we are searching for the {@code @Transactional} @@ -135,10 +136,10 @@ abstract class MetaAnnotationUtils { * properties of the {@code AnnotationDescriptor} would be as follows. * *

    - *
  • rootDeclaringClass: {@code TransactionalTests} class object
  • - *
  • declaringClass: {@code TransactionalTests} class object
  • - *
  • stereotype: {@code null}
  • - *
  • annotation: instance of the {@code Transactional} annotation
  • + *
  • rootDeclaringClass: {@code TransactionalTests} class object
  • + *
  • declaringClass: {@code TransactionalTests} class object
  • + *
  • composedAnnotation: {@code null}
  • + *
  • annotation: instance of the {@code Transactional} annotation
  • *
* *
@@ -153,10 +154,10 @@ abstract class MetaAnnotationUtils {
 	 * properties of the {@code AnnotationDescriptor} would be as follows.
 	 *
 	 * 
    - *
  • rootDeclaringClass: {@code UserRepositoryTests} class object
  • - *
  • declaringClass: {@code RepositoryTests} class object
  • - *
  • stereotype: instance of the {@code RepositoryTests} annotation
  • - *
  • annotation: instance of the {@code Transactional} annotation
  • + *
  • rootDeclaringClass: {@code UserRepositoryTests} class object
  • + *
  • declaringClass: {@code RepositoryTests} class object
  • + *
  • composedAnnotation: instance of the {@code RepositoryTests} annotation
  • + *
  • annotation: instance of the {@code Transactional} annotation
  • *
* *
@@ -176,7 +177,7 @@ abstract class MetaAnnotationUtils {
 
 		private final Class rootDeclaringClass;
 		private final Class declaringClass;
-		private final Annotation stereotype;
+		private final Annotation composedAnnotation;
 		private final T annotation;
 		private final AnnotationAttributes annotationAttributes;
 
@@ -185,13 +186,14 @@ abstract class MetaAnnotationUtils {
 			this(rootDeclaringClass, null, annotation);
 		}
 
-		public AnnotationDescriptor(Class rootDeclaringClass, Annotation stereotype, T annotation) {
+		public AnnotationDescriptor(Class rootDeclaringClass, Annotation composedAnnotation, T annotation) {
 			Assert.notNull(rootDeclaringClass, "rootDeclaringClass must not be null");
 			Assert.notNull(annotation, "annotation must not be null");
 
 			this.rootDeclaringClass = rootDeclaringClass;
-			this.declaringClass = (stereotype != null) ? stereotype.annotationType() : rootDeclaringClass;
-			this.stereotype = stereotype;
+			this.declaringClass = (composedAnnotation != null) ? composedAnnotation.annotationType()
+					: rootDeclaringClass;
+			this.composedAnnotation = composedAnnotation;
 			this.annotation = annotation;
 			this.annotationAttributes = AnnotatedElementUtils.getAnnotationAttributes(rootDeclaringClass,
 				annotation.annotationType().getName());
@@ -217,12 +219,12 @@ abstract class MetaAnnotationUtils {
 			return this.annotationAttributes;
 		}
 
-		public Annotation getStereotype() {
-			return this.stereotype;
+		public Annotation getComposedAnnotation() {
+			return this.composedAnnotation;
 		}
 
-		public Class getStereotypeType() {
-			return this.stereotype == null ? null : this.stereotype.annotationType();
+		public Class getComposedAnnotationType() {
+			return this.composedAnnotation == null ? null : this.composedAnnotation.annotationType();
 		}
 
 		/**
@@ -233,7 +235,7 @@ abstract class MetaAnnotationUtils {
 			return new ToStringCreator(this)//
 			.append("rootDeclaringClass", rootDeclaringClass)//
 			.append("declaringClass", declaringClass)//
-			.append("stereotype", stereotype)//
+			.append("composedAnnotation", composedAnnotation)//
 			.append("annotation", annotation)//
 			.toString();
 		}
@@ -245,8 +247,8 @@ abstract class MetaAnnotationUtils {
 			super(declaringClass, annotation);
 		}
 
-		public UntypedAnnotationDescriptor(Class declaringClass, Annotation stereotype, Annotation annotation) {
-			super(declaringClass, stereotype, annotation);
+		public UntypedAnnotationDescriptor(Class declaringClass, Annotation composedAnnotation, Annotation annotation) {
+			super(declaringClass, composedAnnotation, annotation);
 		}
 	}
 
diff --git a/spring-test/src/test/java/org/springframework/test/context/MetaAnnotationUtilsTests.java b/spring-test/src/test/java/org/springframework/test/context/MetaAnnotationUtilsTests.java
index a03b6b1e4c..0daaf5e27d 100644
--- a/spring-test/src/test/java/org/springframework/test/context/MetaAnnotationUtilsTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/MetaAnnotationUtilsTests.java
@@ -33,26 +33,26 @@ import static org.springframework.test.context.MetaAnnotationUtils.*;
 
 /**
  * Unit tests for {@link MetaAnnotationUtils}.
- * 
+ *
  * @author Sam Brannen
  * @since 4.0
  */
 public class MetaAnnotationUtilsTests {
 
 	private void assertComponentOnStereotype(Class startClass, Class declaringClass, String name,
-			Class stereotypeType) {
+			Class composedAnnotationType) {
 		AnnotationDescriptor descriptor = findAnnotationDescriptor(startClass, Component.class);
 		assertNotNull(descriptor);
 		assertEquals(declaringClass, descriptor.getRootDeclaringClass());
 		assertEquals(Component.class, descriptor.getAnnotationType());
 		assertEquals(name, descriptor.getAnnotation().value());
-		assertNotNull(descriptor.getStereotype());
-		assertEquals(stereotypeType, descriptor.getStereotypeType());
+		assertNotNull(descriptor.getComposedAnnotation());
+		assertEquals(composedAnnotationType, descriptor.getComposedAnnotationType());
 	}
 
 	@SuppressWarnings("unchecked")
 	private void assertComponentOnStereotypeForMultipleCandidateTypes(Class startClass, Class declaringClass,
-			String name, Class stereotypeType) {
+			String name, Class composedAnnotationType) {
 		Class annotationType = Component.class;
 		UntypedAnnotationDescriptor descriptor = findAnnotationDescriptorForTypes(startClass, Service.class,
 			annotationType, Order.class, Transactional.class);
@@ -60,8 +60,8 @@ public class MetaAnnotationUtilsTests {
 		assertEquals(declaringClass, descriptor.getRootDeclaringClass());
 		assertEquals(annotationType, descriptor.getAnnotationType());
 		assertEquals(name, ((Component) descriptor.getAnnotation()).value());
-		assertNotNull(descriptor.getStereotype());
-		assertEquals(stereotypeType, descriptor.getStereotypeType());
+		assertNotNull(descriptor.getComposedAnnotation());
+		assertEquals(composedAnnotationType, descriptor.getComposedAnnotationType());
 	}
 
 	@Test
@@ -118,8 +118,8 @@ public class MetaAnnotationUtilsTests {
 			annotationType);
 		assertEquals(HasLocalAndMetaComponentAnnotation.class, descriptor.getRootDeclaringClass());
 		assertEquals(annotationType, descriptor.getAnnotationType());
-		assertNull(descriptor.getStereotype());
-		assertNull(descriptor.getStereotypeType());
+		assertNull(descriptor.getComposedAnnotation());
+		assertNull(descriptor.getComposedAnnotationType());
 	}
 
 	@Test
@@ -158,7 +158,8 @@ public class MetaAnnotationUtilsTests {
 	@SuppressWarnings("unchecked")
 	public void findAnnotationDescriptorForTypesWithInheritedAnnotationOnClass() throws Exception {
 		// Note: @Transactional is inherited
-		assertEquals(InheritedAnnotationClass.class,
+		assertEquals(
+			InheritedAnnotationClass.class,
 			findAnnotationDescriptorForTypes(InheritedAnnotationClass.class, Transactional.class).getRootDeclaringClass());
 		assertEquals(
 			InheritedAnnotationClass.class,
@@ -190,7 +191,8 @@ public class MetaAnnotationUtilsTests {
 	@SuppressWarnings("unchecked")
 	public void findAnnotationDescriptorForTypesForNonInheritedAnnotationOnInterface() throws Exception {
 		// Note: @Order is not inherited.
-		assertEquals(NonInheritedAnnotationInterface.class,
+		assertEquals(
+			NonInheritedAnnotationInterface.class,
 			findAnnotationDescriptorForTypes(NonInheritedAnnotationInterface.class, Order.class).getRootDeclaringClass());
 		assertNull(findAnnotationDescriptorForTypes(SubNonInheritedAnnotationInterface.class, Order.class));
 	}
@@ -203,8 +205,8 @@ public class MetaAnnotationUtilsTests {
 			HasLocalAndMetaComponentAnnotation.class, Transactional.class, annotationType, Order.class);
 		assertEquals(HasLocalAndMetaComponentAnnotation.class, descriptor.getRootDeclaringClass());
 		assertEquals(annotationType, descriptor.getAnnotationType());
-		assertNull(descriptor.getStereotype());
-		assertNull(descriptor.getStereotypeType());
+		assertNull(descriptor.getComposedAnnotation());
+		assertNull(descriptor.getComposedAnnotationType());
 	}
 
 	@Test
@@ -228,8 +230,8 @@ public class MetaAnnotationUtilsTests {
 		assertArrayEquals(new Class[] {}, ((ContextConfiguration) descriptor.getAnnotation()).value());
 		assertArrayEquals(new Class[] { MetaConfig.DevConfig.class, MetaConfig.ProductionConfig.class },
 			descriptor.getAnnotationAttributes().getClassArray("classes"));
-		assertNotNull(descriptor.getStereotype());
-		assertEquals(MetaConfig.class, descriptor.getStereotypeType());
+		assertNotNull(descriptor.getComposedAnnotation());
+		assertEquals(MetaConfig.class, descriptor.getComposedAnnotationType());
 	}
 
 	@Test
@@ -247,8 +249,8 @@ public class MetaAnnotationUtilsTests {
 		assertArrayEquals(new Class[] {}, ((ContextConfiguration) descriptor.getAnnotation()).value());
 		assertArrayEquals(new Class[] { MetaAnnotationUtilsTests.class },
 			descriptor.getAnnotationAttributes().getClassArray("classes"));
-		assertNotNull(descriptor.getStereotype());
-		assertEquals(MetaConfig.class, descriptor.getStereotypeType());
+		assertNotNull(descriptor.getComposedAnnotation());
+		assertEquals(MetaConfig.class, descriptor.getComposedAnnotationType());
 	}
 
 	@Test
diff --git a/spring-test/src/test/java/org/springframework/test/context/OverriddenMetaAnnotationAttributesTests.java b/spring-test/src/test/java/org/springframework/test/context/OverriddenMetaAnnotationAttributesTests.java
index e920f14890..d1bc66ac06 100644
--- a/spring-test/src/test/java/org/springframework/test/context/OverriddenMetaAnnotationAttributesTests.java
+++ b/spring-test/src/test/java/org/springframework/test/context/OverriddenMetaAnnotationAttributesTests.java
@@ -44,10 +44,10 @@ public class OverriddenMetaAnnotationAttributesTests {
 			ContextConfiguration.class);
 		assertNotNull(descriptor);
 		assertEquals(declaringClass, descriptor.getRootDeclaringClass());
-		assertEquals(MetaValueConfig.class, descriptor.getStereotypeType());
+		assertEquals(MetaValueConfig.class, descriptor.getComposedAnnotationType());
 		assertEquals(ContextConfiguration.class, descriptor.getAnnotationType());
-		assertNotNull(descriptor.getStereotype());
-		assertEquals(MetaValueConfig.class, descriptor.getStereotypeType());
+		assertNotNull(descriptor.getComposedAnnotation());
+		assertEquals(MetaValueConfig.class, descriptor.getComposedAnnotationType());
 
 		// direct access to annotation value:
 		assertArrayEquals(new String[] { "foo.xml" }, descriptor.getAnnotation().value());
@@ -60,10 +60,10 @@ public class OverriddenMetaAnnotationAttributesTests {
 			ContextConfiguration.class);
 		assertNotNull(descriptor);
 		assertEquals(declaringClass, descriptor.getRootDeclaringClass());
-		assertEquals(MetaValueConfig.class, descriptor.getStereotypeType());
+		assertEquals(MetaValueConfig.class, descriptor.getComposedAnnotationType());
 		assertEquals(ContextConfiguration.class, descriptor.getAnnotationType());
-		assertNotNull(descriptor.getStereotype());
-		assertEquals(MetaValueConfig.class, descriptor.getStereotypeType());
+		assertNotNull(descriptor.getComposedAnnotation());
+		assertEquals(MetaValueConfig.class, descriptor.getComposedAnnotationType());
 
 		// direct access to annotation value:
 		assertArrayEquals(new String[] { "foo.xml" }, descriptor.getAnnotation().value());
@@ -85,10 +85,10 @@ public class OverriddenMetaAnnotationAttributesTests {
 			ContextConfiguration.class);
 		assertNotNull(descriptor);
 		assertEquals(declaringClass, descriptor.getRootDeclaringClass());
-		assertEquals(MetaLocationsConfig.class, descriptor.getStereotypeType());
+		assertEquals(MetaLocationsConfig.class, descriptor.getComposedAnnotationType());
 		assertEquals(ContextConfiguration.class, descriptor.getAnnotationType());
-		assertNotNull(descriptor.getStereotype());
-		assertEquals(MetaLocationsConfig.class, descriptor.getStereotypeType());
+		assertNotNull(descriptor.getComposedAnnotation());
+		assertEquals(MetaLocationsConfig.class, descriptor.getComposedAnnotationType());
 
 		// direct access to annotation attributes:
 		assertArrayEquals(new String[] { "foo.xml" }, descriptor.getAnnotation().locations());
@@ -102,10 +102,10 @@ public class OverriddenMetaAnnotationAttributesTests {
 			ContextConfiguration.class);
 		assertNotNull(descriptor);
 		assertEquals(declaringClass, descriptor.getRootDeclaringClass());
-		assertEquals(MetaLocationsConfig.class, descriptor.getStereotypeType());
+		assertEquals(MetaLocationsConfig.class, descriptor.getComposedAnnotationType());
 		assertEquals(ContextConfiguration.class, descriptor.getAnnotationType());
-		assertNotNull(descriptor.getStereotype());
-		assertEquals(MetaLocationsConfig.class, descriptor.getStereotypeType());
+		assertNotNull(descriptor.getComposedAnnotation());
+		assertEquals(MetaLocationsConfig.class, descriptor.getComposedAnnotationType());
 
 		// direct access to annotation attributes:
 		assertArrayEquals(new String[] { "foo.xml" }, descriptor.getAnnotation().locations());