Browse Source

Only load enclosing class for TYPE_HIERARCHY_AND_ENCLOSING_CLASSES strategy

Prior to this commit, the enclosing class was always eagerly loaded
even if the annotation search strategy was not explicitly
TYPE_HIERARCHY_AND_ENCLOSING_CLASSES.

See gh-24136
pull/24185/head
Sam Brannen 6 years ago
parent
commit
16ed7e2a19
  1. 12
      spring-core/src/main/java/org/springframework/core/annotation/AnnotationsScanner.java

12
spring-core/src/main/java/org/springframework/core/annotation/AnnotationsScanner.java

@ -230,12 +230,14 @@ abstract class AnnotationsScanner { @@ -230,12 +230,14 @@ abstract class AnnotationsScanner {
return superclassResult;
}
}
Class<?> enclosingClass = source.getEnclosingClass();
if (includeEnclosing && enclosingClass != null) {
R enclosingResult = processClassHierarchy(context, aggregateIndex,
if (includeEnclosing) {
Class<?> enclosingClass = source.getEnclosingClass();
if (enclosingClass != null) {
R enclosingResult = processClassHierarchy(context, aggregateIndex,
enclosingClass, processor, classFilter, includeInterfaces, true);
if (enclosingResult != null) {
return enclosingResult;
if (enclosingResult != null) {
return enclosingResult;
}
}
}
return null;

Loading…
Cancel
Save