RFR: 8208470: Type annotations on inner type that is an array component [v2]
Vicente Romero
vromero at openjdk.org
Sat Feb 11 23:01:38 UTC 2023
> As stated in the bug great description by Werner D.:
>
> Considering this example:
>
> import java.lang.annotation.ElementType;
> import java.lang.annotation.Retention;
> import java.lang.annotation.RetentionPolicy;
> import java.lang.annotation.Target;
>
> @Retention(RetentionPolicy.RUNTIME)
> @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
> @interface TA {
> int value();
> }
>
> class ArrayOfInner {
> class Inner {}
>
> @TA(1) ArrayOfInner. @TA(2) Inner oi;
> @TA(3) ArrayOfInner. @TA(4) Inner [] oia;
> @TA(5) Inner i;
> @TA(6) Inner [] ia;
> }
>
> If compiled with javac 8, according to javap -v field ia has the annotation:
>
> ArrayOfInner$Inner[] ia;
> descriptor: [LArrayOfInner$Inner;
> flags: (0x0000)
> RuntimeVisibleTypeAnnotations:
> 0: #10(#11=I#21): FIELD, location=[ARRAY, INNER_TYPE]
> TA(
> value=6
> )
>
> if compiled with javac > 8 ia has the annotation:
>
> ArrayOfInner$Inner[] ia;
> descriptor: [LArrayOfInner$Inner;
> flags: (0x0000)
> RuntimeVisibleTypeAnnotations:
> 0: #10(#11=I#21): FIELD, location=[ARRAY]
> TA(
> value=6
> )
>
> Note the missing `INNER_TYPE` location. This PR is re-establishing the Java 8 behavior.
>
> TIA
Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
adding bug number to regression test
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/12522/files
- new: https://git.openjdk.org/jdk/pull/12522/files/91bef728..8cf99672
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=12522&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=12522&range=00-01
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/12522.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/12522/head:pull/12522
PR: https://git.openjdk.org/jdk/pull/12522
More information about the compiler-dev
mailing list