8246257: Annotated record's vararg type component started to be uncompilable with JDK15b24

Reviewed-by: jjg, jlaskey
This commit is contained in:
Vicente Romero 2020-06-17 13:19:51 -04:00
parent 2a794b696c
commit ce4978ffe6
2 changed files with 23 additions and 0 deletions

View File

@ -548,6 +548,9 @@ public class TypeAnnotations {
*/
private Type rewriteArrayType(ArrayType type, List<TypeCompound> annotations, TypeAnnotationPosition pos) {
ArrayType tomodify = new ArrayType(type);
if (type.isVarargs()) {
tomodify = tomodify.makeVarargs();
}
ArrayType res = tomodify;
List<TypePathEntry> loc = List.nil();

View File

@ -1130,6 +1130,26 @@ public class RecordCompilationTests extends CompilationTestCase {
this.args = args;
}
}
""",
"""
record R(@A int... ints) {}
@java.lang.annotation.Target({
java.lang.annotation.ElementType.TYPE_USE,
java.lang.annotation.ElementType.RECORD_COMPONENT})
@interface A {}
""",
"""
record R(@A int... ints) {
R(@A int... ints) {
this.ints = ints;
}
}
@java.lang.annotation.Target({
java.lang.annotation.ElementType.TYPE_USE,
java.lang.annotation.ElementType.RECORD_COMPONENT})
@interface A {}
"""
)) {
assertOK(source);