|
30 | 30 | import org.springframework.util.ObjectUtils;
|
31 | 31 |
|
32 | 32 | /**
|
33 |
| - * ASM visitor which looks for the annotations defined on a class or method, including |
34 |
| - * tracking meta-annotations. |
| 33 | + * ASM visitor which looks for annotations defined on a class or method, |
| 34 | + * including meta-annotations. |
35 | 35 | *
|
36 |
| - * <p>As of Spring 3.1.1, this visitor is fully recursive, taking into account any nested |
37 |
| - * annotations or nested annotation arrays. These annotations are in turn read into |
38 |
| - * {@link AnnotationAttributes} map structures. |
| 36 | + * <p>This visitor is fully recursive, taking into account any nested |
| 37 | + * annotations or nested annotation arrays. |
39 | 38 | *
|
40 | 39 | * @author Juergen Hoeller
|
41 | 40 | * @author Chris Beams
|
@@ -74,21 +73,21 @@ public void visitEnd() {
|
74 | 73 | attributeList.add(0, this.attributes);
|
75 | 74 | }
|
76 | 75 | if (!AnnotationUtils.isInJavaLangAnnotationPackage(annotationClass.getName())) {
|
77 |
| - Set<Annotation> visited = new LinkedHashSet<>(); |
78 | 76 | try {
|
79 | 77 | Annotation[] metaAnnotations = annotationClass.getAnnotations();
|
80 | 78 | if (!ObjectUtils.isEmpty(metaAnnotations)) {
|
| 79 | + Set<Annotation> visited = new LinkedHashSet<>(); |
81 | 80 | for (Annotation metaAnnotation : metaAnnotations) {
|
82 |
| - if (!AnnotationUtils.isInJavaLangAnnotationPackage(metaAnnotation)) { |
83 |
| - recursivelyCollectMetaAnnotations(visited, metaAnnotation); |
| 81 | + recursivelyCollectMetaAnnotations(visited, metaAnnotation); |
| 82 | + } |
| 83 | + if (!visited.isEmpty()) { |
| 84 | + Set<String> metaAnnotationTypeNames = new LinkedHashSet<>(visited.size()); |
| 85 | + for (Annotation ann : visited) { |
| 86 | + metaAnnotationTypeNames.add(ann.annotationType().getName()); |
84 | 87 | }
|
| 88 | + this.metaAnnotationMap.put(annotationClass.getName(), metaAnnotationTypeNames); |
85 | 89 | }
|
86 | 90 | }
|
87 |
| - Set<String> metaAnnotationTypeNames = new LinkedHashSet<>(visited.size()); |
88 |
| - for (Annotation ann : visited) { |
89 |
| - metaAnnotationTypeNames.add(ann.annotationType().getName()); |
90 |
| - } |
91 |
| - this.metaAnnotationMap.put(annotationClass.getName(), metaAnnotationTypeNames); |
92 | 91 | }
|
93 | 92 | catch (Throwable ex) {
|
94 | 93 | if (logger.isDebugEnabled()) {
|
|
0 commit comments