Add JVM target bytecode version 19
Test data in `box/annotations/typeAnnotations` is changed because nested classes in type annotations are rendered differently in JDK 19 (`Outer.Nested` instead of `Outer$Nested`). #KT-54116 Fixed
This commit is contained in:
+6
-8
@@ -11,14 +11,12 @@ import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE_USE)
|
||||
@interface TypeAnn {}
|
||||
|
||||
public class ImplicitReturn {
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE_USE)
|
||||
public @ interface TypeAnn {}
|
||||
|
||||
@ImplicitReturn.TypeAnn
|
||||
@TypeAnn
|
||||
public String bar() {
|
||||
return "OK";
|
||||
}
|
||||
@@ -45,14 +43,14 @@ fun box(): String {
|
||||
checkTypeAnnotation(
|
||||
Kotlin::foo.javaMethod!!.annotatedReturnType,
|
||||
"class java.lang.String",
|
||||
"@ImplicitReturn\$TypeAnn()",
|
||||
"@TypeAnn()",
|
||||
"foo"
|
||||
)
|
||||
|
||||
checkTypeAnnotation(
|
||||
Kotlin::field.javaField!!.annotatedType,
|
||||
"class java.lang.String",
|
||||
"@ImplicitReturn\$TypeAnn()",
|
||||
"@TypeAnn()",
|
||||
"foo"
|
||||
)
|
||||
|
||||
|
||||
+6
-8
@@ -12,14 +12,12 @@ import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE_USE)
|
||||
@interface TypeAnn {}
|
||||
|
||||
public class ImplicitReturn {
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE_USE)
|
||||
public @ interface TypeAnn {}
|
||||
|
||||
@ImplicitReturn.TypeAnn
|
||||
@TypeAnn
|
||||
public String bar() {
|
||||
return "OK";
|
||||
}
|
||||
@@ -47,14 +45,14 @@ fun box(): String {
|
||||
checkTypeAnnotation(
|
||||
Kotlin::foo.javaMethod!!.annotatedReturnType,
|
||||
"class java.lang.String",
|
||||
"@ImplicitReturn\$TypeAnn()",
|
||||
"@TypeAnn()",
|
||||
"foo"
|
||||
)
|
||||
|
||||
checkTypeAnnotation(
|
||||
Kotlin::field.javaField!!.annotatedType,
|
||||
"class java.lang.String",
|
||||
"@ImplicitReturn\$TypeAnn()",
|
||||
"@TypeAnn()",
|
||||
"foo"
|
||||
)
|
||||
|
||||
|
||||
@@ -17,11 +17,13 @@ fun box(): String {
|
||||
|
||||
// JDK 8 and earlier
|
||||
val expected1 = "[@test.Anno(k1=class $fqName, k2=class [L$fqName;, k3=class [[L$fqName;)]"
|
||||
// JDK 9 and later
|
||||
// JDK 9..18
|
||||
val expected2 = "[@test.Anno(k1=$fqName.class, k2=$fqName[].class, k3=$fqName[][].class)]"
|
||||
// JDK 19 and later
|
||||
val expected3 = "[@test.Anno(k1=<no canonical name>.class, k2=<no canonical name>.class, k3=<no canonical name>.class)]"
|
||||
|
||||
val actual = M::class.annotations.toString()
|
||||
if (actual != expected1 && actual != expected2) return "Fail: $actual"
|
||||
if (actual != expected1 && actual != expected2 && actual != expected3) return "Fail: $actual"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user