Short-circuit interface visibility check in case of same ClassLoader

Closes gh-24664
This commit is contained in:
Juergen Hoeller 2020-03-11 14:55:08 +01:00
parent bee63e38c1
commit 7f26e8cfc6
1 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -184,6 +184,9 @@ final class SynthesizedMergedAnnotationInvocationHandler<A extends Annotation> i
}
private static boolean isVisible(ClassLoader classLoader, Class<?> interfaceClass) {
if (classLoader == interfaceClass.getClassLoader()) {
return true;
}
try {
return Class.forName(interfaceClass.getName(), false, classLoader) == interfaceClass;
}