From 7f26e8cfc6798187ec463d0ee9d9cdd26d9605be Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 11 Mar 2020 14:55:08 +0100 Subject: [PATCH] Short-circuit interface visibility check in case of same ClassLoader Closes gh-24664 --- .../SynthesizedMergedAnnotationInvocationHandler.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedMergedAnnotationInvocationHandler.java b/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedMergedAnnotationInvocationHandler.java index e226accd5c..0891a419c3 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedMergedAnnotationInvocationHandler.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/SynthesizedMergedAnnotationInvocationHandler.java @@ -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 i } private static boolean isVisible(ClassLoader classLoader, Class interfaceClass) { + if (classLoader == interfaceClass.getClassLoader()) { + return true; + } try { return Class.forName(interfaceClass.getName(), false, classLoader) == interfaceClass; }