On Wed, 2 Jun 2021 10:36:06 GMT, Peter Levart <plev...@openjdk.org> wrote:
>> There doesn't seem to be much support for the complete changes in #4245. To >> get at least something useful from that endeavor I have extracted the test >> for existing behavior of `-XX:+PreserveAllAnnotations` and I am offering it >> in this pull request without any changes to the JVM behavior. > > test/jdk/java/lang/annotation/AnnotationType/AnnotationTypeChangedToRuntimeTest.java > line 81: > >> 79: " should not be visible at runtime"); >> 80: } >> 81: } > > I'm trying to understand why the case of > `TestTask.class.getDeclaredAnnotation(AnnA_v1.class)` is different from > `AnnB.class.getDeclaredAnnotation(AnnA_v1.class)` ... `TestTask` and `AnnB` > are both just types annotated with the same annotation `@AnnA_v1` ... I'll > have to debug this to see the point (does it have something to do with the > fact that there is circularity of annotation uses: `AnnA_v1` is annotated > with `@AnnB` while `AnnB` is annotated with `@AnnA_v1` ? ...hm, it seems that mere presence of any RUNTIME annotation that was RUNTIME already at the use compile time somehow affects -XX:+PreserveAllAnnotations option so that now RUNTIME annotations that were CLASS annotations at use compile time are not returned. Checking VM logic... ------------- PR: https://git.openjdk.java.net/jdk/pull/4280