diff --git a/compiler/testData/codegen/box/reflection/javaProperties/java.kt b/compiler/testData/codegen/box/classLiteral/java/java.kt similarity index 99% rename from compiler/testData/codegen/box/reflection/javaProperties/java.kt rename to compiler/testData/codegen/box/classLiteral/java/java.kt index 5afce1b22ed..d678847f7db 100644 --- a/compiler/testData/codegen/box/reflection/javaProperties/java.kt +++ b/compiler/testData/codegen/box/classLiteral/java/java.kt @@ -1,4 +1,4 @@ -// WITH_REFLECT +// WITH_RUNTIME import kotlin.reflect.KClass diff --git a/compiler/testData/codegen/box/reflection/javaProperties/javaObjectType.kt b/compiler/testData/codegen/box/classLiteral/java/javaObjectType.kt similarity index 91% rename from compiler/testData/codegen/box/reflection/javaProperties/javaObjectType.kt rename to compiler/testData/codegen/box/classLiteral/java/javaObjectType.kt index 36aab5acef5..c66a9748144 100644 --- a/compiler/testData/codegen/box/reflection/javaProperties/javaObjectType.kt +++ b/compiler/testData/codegen/box/classLiteral/java/javaObjectType.kt @@ -1,4 +1,4 @@ -// WITH_REFLECT +// WITH_RUNTIME import kotlin.reflect.KClass @@ -43,8 +43,8 @@ fun box(): String { check(Nothing::class.javaObjectType, "java.lang.Void") check(Nothing::class, "java.lang.Void") - check(java.lang.Void::class.javaObjectType, "java.lang.Void") - check(java.lang.Void::class, "java.lang.Void") + check(Void::class.javaObjectType, "java.lang.Void") + check(Void::class, "java.lang.Void") return "OK" } diff --git a/compiler/testData/codegen/box/classLiteral/java/javaObjectTypeReified.kt b/compiler/testData/codegen/box/classLiteral/java/javaObjectTypeReified.kt new file mode 100644 index 00000000000..f067bf3fe52 --- /dev/null +++ b/compiler/testData/codegen/box/classLiteral/java/javaObjectTypeReified.kt @@ -0,0 +1,24 @@ +// WITH_RUNTIME + +inline fun check(expected: String) { + val clazz = T::class.javaObjectType!! + assert (clazz.canonicalName == "java.lang.$expected") { + "clazz name: ${clazz.canonicalName}" + } +} + +fun box(): String { + check("Boolean") + check("Character") + check("Byte") + check("Short") + check("Integer") + check("Float") + check("Long") + check("Double") + + check("String") + check("Void") + + return "OK" +} diff --git a/compiler/testData/codegen/box/reflection/javaProperties/javaPrimitiveType.kt b/compiler/testData/codegen/box/classLiteral/java/javaPrimitiveType.kt similarity index 92% rename from compiler/testData/codegen/box/reflection/javaProperties/javaPrimitiveType.kt rename to compiler/testData/codegen/box/classLiteral/java/javaPrimitiveType.kt index 6cdc3e159b0..0ca0b29d464 100644 --- a/compiler/testData/codegen/box/reflection/javaProperties/javaPrimitiveType.kt +++ b/compiler/testData/codegen/box/classLiteral/java/javaPrimitiveType.kt @@ -1,4 +1,4 @@ -// WITH_REFLECT +// WITH_RUNTIME import kotlin.reflect.KClass @@ -53,8 +53,8 @@ fun box(): String { checkNull(Nothing::class.javaPrimitiveType) checkNull(Nothing::class) - checkNull(java.lang.Void::class.javaPrimitiveType) - checkNull(java.lang.Void::class) + checkNull(Void::class.javaPrimitiveType) + checkNull(Void::class) return "OK" } diff --git a/compiler/testData/codegen/box/reflection/javaProperties/javaPrimitiveTypeReified.kt b/compiler/testData/codegen/box/classLiteral/java/javaPrimitiveTypeReified.kt similarity index 89% rename from compiler/testData/codegen/box/reflection/javaProperties/javaPrimitiveTypeReified.kt rename to compiler/testData/codegen/box/classLiteral/java/javaPrimitiveTypeReified.kt index 8f2da244504..d7f34cb3a24 100644 --- a/compiler/testData/codegen/box/reflection/javaProperties/javaPrimitiveTypeReified.kt +++ b/compiler/testData/codegen/box/classLiteral/java/javaPrimitiveTypeReified.kt @@ -1,6 +1,4 @@ -// WITH_REFLECT - -import kotlin.reflect.KClass +// WITH_RUNTIME inline fun check(expected: String) { val clazz = T::class.javaPrimitiveType!! @@ -27,7 +25,7 @@ fun box(): String { check("double") checkNull() - checkNull() + checkNull() return "OK" } diff --git a/compiler/testData/codegen/box/classLiteral/java/javaReified.kt b/compiler/testData/codegen/box/classLiteral/java/javaReified.kt new file mode 100644 index 00000000000..40e4c43b0f2 --- /dev/null +++ b/compiler/testData/codegen/box/classLiteral/java/javaReified.kt @@ -0,0 +1,24 @@ +// WITH_RUNTIME + +inline fun check(expected: String) { + val clazz = T::class.java!! + assert (clazz.canonicalName == "java.lang.$expected") { + "clazz name: ${clazz.canonicalName}" + } +} + +fun box(): String { + check("Boolean") + check("Character") + check("Byte") + check("Short") + check("Integer") + check("Float") + check("Long") + check("Double") + + check("String") + check("Void") + + return "OK" +} diff --git a/compiler/testData/codegen/box/reflection/javaProperties/kt11943.kt b/compiler/testData/codegen/box/classLiteral/java/kt11943.kt similarity index 94% rename from compiler/testData/codegen/box/reflection/javaProperties/kt11943.kt rename to compiler/testData/codegen/box/classLiteral/java/kt11943.kt index 1a256ca2da3..62979284b57 100644 --- a/compiler/testData/codegen/box/reflection/javaProperties/kt11943.kt +++ b/compiler/testData/codegen/box/classLiteral/java/kt11943.kt @@ -1,4 +1,4 @@ -// WITH_REFLECT +// WITH_RUNTIME import kotlin.reflect.KClass diff --git a/compiler/testData/codegen/box/classLiteral/bound/objectSuperConstructorCall.kt b/compiler/testData/codegen/box/classLiteral/java/objectSuperConstructorCall.kt similarity index 100% rename from compiler/testData/codegen/box/classLiteral/bound/objectSuperConstructorCall.kt rename to compiler/testData/codegen/box/classLiteral/java/objectSuperConstructorCall.kt diff --git a/compiler/testData/codegen/box/reflection/javaProperties/javaObjectTypeReified.kt b/compiler/testData/codegen/box/reflection/javaProperties/javaObjectTypeReified.kt deleted file mode 100644 index 7844911a818..00000000000 --- a/compiler/testData/codegen/box/reflection/javaProperties/javaObjectTypeReified.kt +++ /dev/null @@ -1,26 +0,0 @@ -// WITH_REFLECT - -import kotlin.reflect.KClass - -inline fun check(expected: String) { - val clazz = T::class.javaObjectType!! - assert (clazz.canonicalName == "java.lang.${expected.capitalize()}") { - "clazz name: ${clazz.canonicalName}" - } -} - -fun box(): String { - check("boolean") - check("character") - check("byte") - check("short") - check("integer") - check("float") - check("long") - check("double") - - check("String") - check("Void") - - return "OK" -} diff --git a/compiler/testData/codegen/box/reflection/javaProperties/javaReified.kt b/compiler/testData/codegen/box/reflection/javaProperties/javaReified.kt deleted file mode 100644 index b2aefb60254..00000000000 --- a/compiler/testData/codegen/box/reflection/javaProperties/javaReified.kt +++ /dev/null @@ -1,26 +0,0 @@ -// WITH_REFLECT - -import kotlin.reflect.KClass - -inline fun check(expected: String) { - val clazz = T::class.java!! - assert (clazz.canonicalName == "java.lang.${expected.capitalize()}") { - "clazz name: ${clazz.canonicalName}" - } -} - -fun box(): String { - check("boolean") - check("character") - check("byte") - check("short") - check("integer") - check("float") - check("long") - check("double") - - check("String") - check("Void") - - return "OK" -} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 8944c72943d..5e634405820 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -2364,12 +2364,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } - @TestMetadata("objectSuperConstructorCall.kt") - public void testObjectSuperConstructorCall() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classLiteral/bound/objectSuperConstructorCall.kt"); - doTest(fileName); - } - @TestMetadata("primitives.kt") public void testPrimitives() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classLiteral/bound/primitives.kt"); @@ -2388,6 +2382,63 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } } + + @TestMetadata("compiler/testData/codegen/box/classLiteral/java") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Java extends AbstractBlackBoxCodegenTest { + public void testAllFilesPresentInJava() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/classLiteral/java"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("java.kt") + public void testJava() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classLiteral/java/java.kt"); + doTest(fileName); + } + + @TestMetadata("javaObjectType.kt") + public void testJavaObjectType() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classLiteral/java/javaObjectType.kt"); + doTest(fileName); + } + + @TestMetadata("javaObjectTypeReified.kt") + public void testJavaObjectTypeReified() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classLiteral/java/javaObjectTypeReified.kt"); + doTest(fileName); + } + + @TestMetadata("javaPrimitiveType.kt") + public void testJavaPrimitiveType() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classLiteral/java/javaPrimitiveType.kt"); + doTest(fileName); + } + + @TestMetadata("javaPrimitiveTypeReified.kt") + public void testJavaPrimitiveTypeReified() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classLiteral/java/javaPrimitiveTypeReified.kt"); + doTest(fileName); + } + + @TestMetadata("javaReified.kt") + public void testJavaReified() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classLiteral/java/javaReified.kt"); + doTest(fileName); + } + + @TestMetadata("kt11943.kt") + public void testKt11943() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classLiteral/java/kt11943.kt"); + doTest(fileName); + } + + @TestMetadata("objectSuperConstructorCall.kt") + public void testObjectSuperConstructorCall() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/classLiteral/java/objectSuperConstructorCall.kt"); + doTest(fileName); + } + } } @TestMetadata("compiler/testData/codegen/box/classes") @@ -12154,57 +12205,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } - @TestMetadata("compiler/testData/codegen/box/reflection/javaProperties") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class JavaProperties extends AbstractBlackBoxCodegenTest { - public void testAllFilesPresentInJavaProperties() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/reflection/javaProperties"), Pattern.compile("^(.+)\\.kt$"), true); - } - - @TestMetadata("java.kt") - public void testJava() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/javaProperties/java.kt"); - doTest(fileName); - } - - @TestMetadata("javaObjectType.kt") - public void testJavaObjectType() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/javaProperties/javaObjectType.kt"); - doTest(fileName); - } - - @TestMetadata("javaObjectTypeReified.kt") - public void testJavaObjectTypeReified() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/javaProperties/javaObjectTypeReified.kt"); - doTest(fileName); - } - - @TestMetadata("javaPrimitiveType.kt") - public void testJavaPrimitiveType() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/javaProperties/javaPrimitiveType.kt"); - doTest(fileName); - } - - @TestMetadata("javaPrimitiveTypeReified.kt") - public void testJavaPrimitiveTypeReified() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/javaProperties/javaPrimitiveTypeReified.kt"); - doTest(fileName); - } - - @TestMetadata("javaReified.kt") - public void testJavaReified() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/javaProperties/javaReified.kt"); - doTest(fileName); - } - - @TestMetadata("kt11943.kt") - public void testKt11943() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/reflection/javaProperties/kt11943.kt"); - doTest(fileName); - } - } - @TestMetadata("compiler/testData/codegen/box/reflection/kClassInAnnotation") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)