diff --git a/compiler/testData/codegen/boxWithJava/reflection/javaMethodsSmokeTest/J.java b/compiler/testData/codegen/boxWithJava/reflection/javaMethodsSmokeTest/J.java new file mode 100644 index 00000000000..975e4890ddf --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/reflection/javaMethodsSmokeTest/J.java @@ -0,0 +1,25 @@ +import java.util.List; + +public class J { + void simple() {} + + void objectTypes( + Object o, String s, Object[] oo, String[] ss + ) {} + + void primitives( + boolean z, char c, byte b, short s, int i, float f, long j, double d + ) {} + + void primitiveArrays( + boolean[] z, char[] c, byte[] b, short[] s, int[] i, float[] f, long[] j, double[] d + ) {} + + void multiDimensionalArrays( + int[][][] i, Cloneable[][][][] c + ) {} + + void wildcards( + List l, List m + ) {} +} diff --git a/compiler/testData/codegen/boxWithJava/reflection/javaMethodsSmokeTest/K.kt b/compiler/testData/codegen/boxWithJava/reflection/javaMethodsSmokeTest/K.kt new file mode 100644 index 00000000000..e162e1fdfe3 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/reflection/javaMethodsSmokeTest/K.kt @@ -0,0 +1,17 @@ +import kotlin.reflect.KFunction + +// Initiate descriptor computation in reflection to ensure that nothing fails +fun test(f: KFunction<*>) { + f.parameters +} + +fun box(): String { + test(J::simple) + test(J::objectTypes) + test(J::primitives) + test(J::primitiveArrays) + test(J::multiDimensionalArrays) + test(J::wildcards) + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames/J.java b/compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames/J.java new file mode 100644 index 00000000000..18cd4e12e6a --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames/J.java @@ -0,0 +1,5 @@ +public class J { + void foo(String s, int i) {} + + static void bar(J j) {} +} diff --git a/compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames/K.kt b/compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames/K.kt new file mode 100644 index 00000000000..b3f6eecd696 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames/K.kt @@ -0,0 +1,8 @@ +import kotlin.test.assertEquals + +fun box(): String { + assertEquals(listOf(null, null, null), J::foo.parameters.map { it.name }) + assertEquals(listOf(null), J::bar.parameters.map { it.name }) + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithJava/referenceToJavaFieldOfKotlinSubclass/J.java b/compiler/testData/codegen/boxWithJava/reflection/referenceToJavaFieldOfKotlinSubclass/J.java similarity index 100% rename from compiler/testData/codegen/boxWithJava/referenceToJavaFieldOfKotlinSubclass/J.java rename to compiler/testData/codegen/boxWithJava/reflection/referenceToJavaFieldOfKotlinSubclass/J.java diff --git a/compiler/testData/codegen/boxWithJava/referenceToJavaFieldOfKotlinSubclass/K.kt b/compiler/testData/codegen/boxWithJava/reflection/referenceToJavaFieldOfKotlinSubclass/K.kt similarity index 100% rename from compiler/testData/codegen/boxWithJava/referenceToJavaFieldOfKotlinSubclass/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/referenceToJavaFieldOfKotlinSubclass/K.kt diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java index d3e078cf43e..b5b429508fb 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java @@ -65,12 +65,6 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege doTestWithJava(fileName); } - @TestMetadata("referenceToJavaFieldOfKotlinSubclass") - public void testReferenceToJavaFieldOfKotlinSubclass() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/referenceToJavaFieldOfKotlinSubclass/"); - doTestWithJava(fileName); - } - @TestMetadata("compiler/testData/codegen/boxWithJava/annotationsWithKClass") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -279,6 +273,12 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege doTestWithJava(fileName); } + @TestMetadata("javaMethodsSmokeTest") + public void testJavaMethodsSmokeTest() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/javaMethodsSmokeTest/"); + doTestWithJava(fileName); + } + @TestMetadata("javaPropertyInheritedInKotlin") public void testJavaPropertyInheritedInKotlin() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/javaPropertyInheritedInKotlin/"); @@ -303,6 +303,18 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege doTestWithJava(fileName); } + @TestMetadata("parametersHaveNoNames") + public void testParametersHaveNoNames() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames/"); + doTestWithJava(fileName); + } + + @TestMetadata("referenceToJavaFieldOfKotlinSubclass") + public void testReferenceToJavaFieldOfKotlinSubclass() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/referenceToJavaFieldOfKotlinSubclass/"); + doTestWithJava(fileName); + } + } @TestMetadata("compiler/testData/codegen/boxWithJava/secondaryConstructors")