Support Class meta-annotation attributes with ASM

Prior to this commit, AnnotationAttributesReadingVisitor treated Class
annotation attributes as Strings instead of Classes. As a result,
look-ups for Class attributes in meta-annotations failed with an
IllegalArgumentException.

This commit fixes this issue by consistently treating Class attributes
as Classes in AnnotationAttributesReadingVisitor.

Issue: SPR-11557
This commit is contained in:
Sam Brannen
2014-03-18 18:20:15 +01:00
parent 42690a9a9e
commit 9ce0df89ff
5 changed files with 182 additions and 170 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 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.
@@ -43,6 +43,7 @@ import org.springframework.util.ReflectionUtils;
* @author Chris Beams
* @author Juergen Hoeller
* @author Phillip Webb
* @author Sam Brannen
* @since 3.1.1
*/
abstract class AbstractRecursiveAnnotationVisitor extends AnnotationVisitor {
@@ -279,7 +280,7 @@ final class AnnotationAttributesReadingVisitor extends RecursiveAnnotationAttrib
// otherwise, and don't want to mess with accessibility in a SecurityManager environment.
if (Modifier.isPublic(annotation.annotationType().getModifiers())) {
this.attributesMap.add(annotation.annotationType().getName(),
AnnotationUtils.getAnnotationAttributes(annotation, true, true));
AnnotationUtils.getAnnotationAttributes(annotation, false, true));
for (Annotation metaMetaAnnotation : annotation.annotationType().getAnnotations()) {
recursivelyCollectMetaAnnotations(visited, metaMetaAnnotation);
}