RFR: JDK-8267936: PreserveAllAnnotations option isn't tested

Peter Levart plevart at openjdk.java.net
Wed Jun 2 11:37:28 UTC 2021


On Wed, 2 Jun 2021 10:36:06 GMT, Peter Levart <plevart at 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


More information about the core-libs-dev mailing list