Javac compiles following source:
```
import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.TYPE_USE;
import java.util.function.Supplier;
@Target(TYPE_USE)
@Repeatable(AC.class)
@interface A {
}
@Target(TYPE_USE)
@interface AC {
A[] value();
}
@Target(TYPE_USE)
@interface B {}
class Test {
void test() {
Supplier<Integer> s = () -> (@A @A @B Integer) 1;
}
}
```
Into a class with @AC annotation attached to the test method body and with invalid bytecode offset:
```
void test();
descriptor: ()V
flags: (0x0000)
Code:
stack=1, locals=2, args_size=1
0: invokedynamic #7, 0 // InvokeDynamic #0:get:()Ljava/util/function/Supplier;
5: astore_1
6: return
RuntimeInvisibleTypeAnnotations:
0: #30(#31=[@#32(),@#32()]): CAST, offset=4, type_index=0
AC(
value=[@A,@A]
)
```
This is preventing the migration of CombinationsTargetTest3 to the ClassFile API; the test should be moved to CF API as part of the fix.
```
import java.lang.annotation.Repeatable;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.TYPE_USE;
import java.util.function.Supplier;
@Target(TYPE_USE)
@Repeatable(AC.class)
@interface A {
}
@Target(TYPE_USE)
@interface AC {
A[] value();
}
@Target(TYPE_USE)
@interface B {}
class Test {
void test() {
Supplier<Integer> s = () -> (@A @A @B Integer) 1;
}
}
```
Into a class with @AC annotation attached to the test method body and with invalid bytecode offset:
```
void test();
descriptor: ()V
flags: (0x0000)
Code:
stack=1, locals=2, args_size=1
0: invokedynamic #7, 0 // InvokeDynamic #0:get:()Ljava/util/function/Supplier;
5: astore_1
6: return
RuntimeInvisibleTypeAnnotations:
0: #30(#31=[@#32(),@#32()]): CAST, offset=4, type_index=0
AC(
value=[@A,@A]
)
```
This is preventing the migration of CombinationsTargetTest3 to the ClassFile API; the test should be moved to CF API as part of the fix.
- relates to
-
JDK-8313258 RuntimeInvisibleTypeAnnotationsAttribute.annotations() API Index out of Bound error
- Closed
-
JDK-8332109 Convert remaining tests using com.sun.tools.classfile to ClassFile API
- Resolved