Polishing

This commit is contained in:
Juergen Hoeller
2015-11-05 12:30:29 +01:00
parent 6cedaa1091
commit 2ba5cb2734
4 changed files with 26 additions and 25 deletions

View File

@@ -121,12 +121,12 @@ public abstract class AnnotationUtils {
private static final Map<AnnotationCacheKey, Annotation> findAnnotationCache =
new ConcurrentReferenceHashMap<AnnotationCacheKey, Annotation>(256);
private static final Map<Class<?>, Boolean> annotatedInterfaceCache =
new ConcurrentReferenceHashMap<Class<?>, Boolean>(256);
private static final Map<AnnotationCacheKey, Boolean> metaPresentCache =
new ConcurrentReferenceHashMap<AnnotationCacheKey, Boolean>(256);
private static final Map<Class<?>, Boolean> annotatedInterfaceCache =
new ConcurrentReferenceHashMap<Class<?>, Boolean>(256);
private static final Map<Class<? extends Annotation>, Boolean> synthesizableCache =
new ConcurrentReferenceHashMap<Class<? extends Annotation>, Boolean>(256);
@@ -787,7 +787,7 @@ public abstract class AnnotationUtils {
* @see #isAnnotationDeclaredLocally(Class, Class)
*/
public static Class<?> findAnnotationDeclaringClassForTypes(List<Class<? extends Annotation>> annotationTypes, Class<?> clazz) {
Assert.notEmpty(annotationTypes, "The list of annotation types must not be empty");
Assert.notEmpty(annotationTypes, "List of annotation types must not be empty");
if (clazz == null || Object.class == clazz) {
return null;
}
@@ -1055,7 +1055,7 @@ public abstract class AnnotationUtils {
try {
Object value = method.invoke(annotation);
Object defaultValue = method.getDefaultValue();
if (mergeMode && (defaultValue != null)) {
if (mergeMode && defaultValue != null) {
if (ObjectUtils.nullSafeEquals(value, defaultValue)) {
value = DEFAULT_VALUE_PLACEHOLDER;
}

View File

@@ -56,6 +56,7 @@ public class AnnotatedElementUtilsTests {
@Rule
public final ExpectedException exception = ExpectedException.none();
@Test
public void getMetaAnnotationTypesOnNonAnnotatedClass() {
assertNull(getMetaAnnotationTypes(NonAnnotatedClass.class, TransactionalComponent.class));
@@ -69,8 +70,7 @@ public class AnnotatedElementUtilsTests {
@Test
public void getMetaAnnotationTypesOnClassWithMetaDepth2() {
Set<String> names = getMetaAnnotationTypes(ComposedTransactionalComponentClass.class,
ComposedTransactionalComponent.class);
Set<String> names = getMetaAnnotationTypes(ComposedTransactionalComponentClass.class, ComposedTransactionalComponent.class);
assertEquals(names(TransactionalComponent.class, Transactional.class, Component.class), names);
}