-
Bug
-
Resolution: Unresolved
-
P4
-
9
In the following example, the type path for the annotation on 'y' should be the same as 'x', but it is instead the same as 'z'. The type of 'y' is int[], so using an [array, array] type path is incorrect. (It is the correct type path for 'z', however.)
=== T.java
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE) @interface A {}
class T {
int @A [] x = {};
int @A [] y, z [][];
}
===
$ javac -fullversion T.java
javac full version "9-ea+163"
$ javap -v T
...
int[] x;
descriptor: [I
flags: (0x0000)
RuntimeInvisibleTypeAnnotations:
0: #8(): FIELD
int[] y;
descriptor: [I
flags: (0x0000)
RuntimeInvisibleTypeAnnotations:
0: #8(): FIELD, location=[ARRAY, ARRAY]
int[][][] z;
descriptor: [[[I
flags: (0x0000)
RuntimeInvisibleTypeAnnotations:
0: #8(): FIELD, location=[ARRAY, ARRAY]
=== T.java
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE) @interface A {}
class T {
int @A [] x = {};
int @A [] y, z [][];
}
===
$ javac -fullversion T.java
javac full version "9-ea+163"
$ javap -v T
...
int[] x;
descriptor: [I
flags: (0x0000)
RuntimeInvisibleTypeAnnotations:
0: #8(): FIELD
int[] y;
descriptor: [I
flags: (0x0000)
RuntimeInvisibleTypeAnnotations:
0: #8(): FIELD, location=[ARRAY, ARRAY]
int[][][] z;
descriptor: [[[I
flags: (0x0000)
RuntimeInvisibleTypeAnnotations:
0: #8(): FIELD, location=[ARRAY, ARRAY]