Skip to content

Commit

Permalink
Add more aggressive annotation element filtering
Browse files Browse the repository at this point in the history
Refine the element filtering performed by `AnnotationsScanner` to also
cover `org.springframework.util` and most `com.sun` classes which turn
out to be referenced quite frequently and which we know contain no
useful annotations.

See spring-projectsgh-21697
  • Loading branch information
philwebb committed Mar 14, 2019
1 parent 287d244 commit f0768e5
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ private static <C, R> R processClassInheritedAnnotations(C context, Class<?> sou
int remaining = Integer.MAX_VALUE;
int aggregateIndex = 0;
Class<?> root = source;
while (source != null && source != Object.class
&& !hasPlainJavaAnnotationsOnly(source) && remaining > 0) {
while (source != null && source != Object.class && remaining > 0
&& !hasPlainJavaAnnotationsOnly(source)) {
R result = processor.doWithAggregate(context, aggregateIndex);
if (result != null) {
return result;
Expand Down Expand Up @@ -524,7 +524,9 @@ else if (annotatedElement instanceof Member) {
String name = type.getName();
return type.equals(Ordered.class) ||
name.startsWith("java") ||
name.startsWith("org.springframework.lang.");
name.startsWith("org.springframework.lang.") ||
name.startsWith("org.springframework.util.") ||
(name.startsWith("com.sun") && !name.contains("Proxy"));
}

private static boolean isWithoutHierarchy(AnnotatedElement source) {
Expand Down

0 comments on commit f0768e5

Please sign in to comment.