Add more aggressive annotation element filtering

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 gh-21697
This commit is contained in:
Phillip Webb 2019-03-09 23:54:41 -08:00 committed by Juergen Hoeller
parent db8eaec131
commit 7244c9aea1
1 changed files with 5 additions and 3 deletions

View File

@ -145,8 +145,8 @@ abstract class AnnotationsScanner {
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;
@ -524,7 +524,9 @@ abstract class AnnotationsScanner {
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) {