Integrated: 8208470: Type annotations on inner type that is an array component
Vicente Romero
vromero at openjdk.org
Thu Feb 16 04:04:37 UTC 2023
On Sat, 11 Feb 2023 14:02:13 GMT, Vicente Romero <vromero at openjdk.org> wrote:
> 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
This pull request has now been integrated.
Changeset: 1480d418
Author: Vicente Romero <vromero at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/1480d418e3b7d1f36ace24a043a273fca446eefa
Stats: 86 lines in 4 files changed: 33 ins; 43 del; 10 mod
8208470: Type annotations on inner type that is an array component
Co-authored-by: Bernard Blaser <bsrbnd at openjdk.org>
Reviewed-by: jlahoda
-------------
PR: https://git.openjdk.org/jdk/pull/12522
More information about the compiler-dev
mailing list