You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on #20279, I noticed that annotation searches for non-public repeatable annotations fail on JDK 17 with an error similar to the following.
Failed to introspect annotations on void org.springframework.core.annotation.NestedRepeatableAnnotationsTests$MultipleRepeatableAnnotationsTests.annotatedMethod():
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')
The reason is that we cannot invoke the value() method of the container annotation.
This means that we cannot "deduce" the container type of a repeatable annotation, and when that fails our annotation support then fails to find any matching repeatable annotations of the given type. An INFO message is logged like the one above, but the search algorithm otherwise silently continues without finding anything.
I also see the following on 5.3.x with JDK 8.
Failed to introspect annotations on void org.springframework.core.annotation.NestedRepeatableAnnotationsTests$MultipleRepeatableAnnotationsTests.annotatedMethod():
java.lang.IllegalAccessError: tried to access class org.springframework.core.annotation.NestedRepeatableAnnotationsTests$A from class com.sun.proxy.$Proxy12
So it is not specific JDK 17, although the error message is slightly different.
The text was updated successfully, but these errors were encountered:
sbrannen
changed the title
Annotation searches fail for non-public repeatable annotations on JDK 17
Annotation searches fail for non-public repeatable annotations
Oct 11, 2022
As a follow up to 332b25b, this commit consistently avoids the use of
reflection for annotation attribute method invocations.
See gh-29301Closesgh-29448
While working on #20279, I noticed that annotation searches for non-public repeatable annotations fail on JDK 17 with an error similar to the following.
The reason is that we cannot invoke the
value()
method of the container annotation.This means that we cannot "deduce" the container type of a repeatable annotation, and when that fails our annotation support then fails to find any matching repeatable annotations of the given type. An INFO message is logged like the one above, but the search algorithm otherwise silently continues without finding anything.
I also see the following on
5.3.x
with JDK 8.So it is not specific JDK 17, although the error message is slightly different.
The text was updated successfully, but these errors were encountered: