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

Peter Levart plevart at openjdk.java.net
Wed Jun 2 10:40:31 UTC 2021


On Tue, 1 Jun 2021 09:30:40 GMT, Jaroslav Tulach <github.com+26887752+JaroslavTulach 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` ?

test/jdk/java/lang/annotation/AnnotationType/AnnotationTypeChangedToRuntimeTest.java line 102:

> 100:      */
> 101:     static class AltClassLoader extends ClassLoader {
> 102:         AltClassLoader(ClassLoader parent) {

I can't escape the feeling that I already saw this code somewhere. Hm... ;-)

-------------

PR: https://git.openjdk.java.net/jdk/pull/4280


More information about the core-libs-dev mailing list