Browse Source
Prior to this commit, searches for non-public repeatable annotations failed with error messages similar to the following, since the repeatable annotation's container's `value()` method could not be invoked via reflection. JDK 8: java.lang.IllegalAccessError: tried to access class org.springframework.core.annotation.NestedRepeatableAnnotationsTests$A from class com.sun.proxy.$Proxy12 JDK 17: java.lang.IllegalAccessError: failed to access class org.springframework.core.annotation.NestedRepeatableAnnotationsTests$A from class jdk.proxy2.$Proxy12 (org.springframework.core.annotation.NestedRepeatableAnnotationsTests$A is in unnamed module of loader 'app'; jdk.proxy2.$Proxy12 is in module jdk.proxy2 of loader 'app') This commit makes it possible to search for non-public repeatable annotations by first attempting to invoke the repeatable annotation's container's `value()` method via the container's InvocationHandler (if the container is a JDK dynamic proxy) and then falling back to reflection for the method invocation if an error occurs (such as a SecurityException). Closes gh-29301pull/30296/head
2 changed files with 19 additions and 4 deletions
Loading…
Reference in new issue