Skip to content

Commit 0001f87

Browse files
committed
Polishing
1 parent 589b704 commit 0001f87

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationAttributesReadingVisitor.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@
3030
import org.springframework.util.ObjectUtils;
3131

3232
/**
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.
3535
*
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.
3938
*
4039
* @author Juergen Hoeller
4140
* @author Chris Beams
@@ -74,21 +73,21 @@ public void visitEnd() {
7473
attributeList.add(0, this.attributes);
7574
}
7675
if (!AnnotationUtils.isInJavaLangAnnotationPackage(annotationClass.getName())) {
77-
Set<Annotation> visited = new LinkedHashSet<>();
7876
try {
7977
Annotation[] metaAnnotations = annotationClass.getAnnotations();
8078
if (!ObjectUtils.isEmpty(metaAnnotations)) {
79+
Set<Annotation> visited = new LinkedHashSet<>();
8180
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());
8487
}
88+
this.metaAnnotationMap.put(annotationClass.getName(), metaAnnotationTypeNames);
8589
}
8690
}
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);
9291
}
9392
catch (Throwable ex) {
9493
if (logger.isDebugEnabled()) {

0 commit comments

Comments
 (0)