diff --git a/compiler/java8-tests/tests/org/jetbrains/kotlin/codegen/BlackBoxWithJava8CodegenTestGenerated.java b/compiler/java8-tests/tests/org/jetbrains/kotlin/codegen/BlackBoxWithJava8CodegenTestGenerated.java index 46387597a99..cd40458c2f7 100644 --- a/compiler/java8-tests/tests/org/jetbrains/kotlin/codegen/BlackBoxWithJava8CodegenTestGenerated.java +++ b/compiler/java8-tests/tests/org/jetbrains/kotlin/codegen/BlackBoxWithJava8CodegenTestGenerated.java @@ -27,88 +27,86 @@ import java.util.regex.Pattern; /** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") -@TestMetadata("compiler/testData/codegen/java8/boxWithJava") +@TestMetadata("compiler/testData/codegen/java8/box") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public class BlackBoxWithJava8CodegenTestGenerated extends AbstractBlackBoxCodegenTest { - public void testAllFilesPresentInBoxWithJava() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/boxWithJava"), Pattern.compile("^([^\\.]+)$"), true); + public void testAllFilesPresentInBox() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/box"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("defaultMethodCallFromTrait") - public void testDefaultMethodCallFromTrait() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/defaultMethodCallFromTrait/"); - doTestWithJava(fileName); + @TestMetadata("defaultMethodCallFromInterface.kt") + public void testDefaultMethodCallFromInterface() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/defaultMethodCallFromInterface.kt"); + doTest(fileName); } - @TestMetadata("defaultMethodCallViaClass") + @TestMetadata("defaultMethodCallViaClass.kt") public void testDefaultMethodCallViaClass() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/defaultMethodCallViaClass/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/defaultMethodCallViaClass.kt"); + doTest(fileName); } - @TestMetadata("defaultMethodCallViaTrait") - public void testDefaultMethodCallViaTrait() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/defaultMethodCallViaTrait/"); - doTestWithJava(fileName); + @TestMetadata("defaultMethodCallViaInterface.kt") + public void testDefaultMethodCallViaInterface() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/defaultMethodCallViaInterface.kt"); + doTest(fileName); } - @TestMetadata("defaultMethodOverride") + @TestMetadata("defaultMethodOverride.kt") public void testDefaultMethodOverride() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/defaultMethodOverride/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/defaultMethodOverride.kt"); + doTest(fileName); } - @TestMetadata("dontDelegateToDefaultMethods") + @TestMetadata("dontDelegateToDefaultMethods.kt") public void testDontDelegateToDefaultMethods() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/dontDelegateToDefaultMethods/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/dontDelegateToDefaultMethods.kt"); + doTest(fileName); } - @TestMetadata("inheritKotlin") + @TestMetadata("inheritKotlin.kt") public void testInheritKotlin() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/inheritKotlin/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/inheritKotlin.kt"); + doTest(fileName); } - @TestMetadata("invokeDefaultViaSuper") + @TestMetadata("invokeDefaultViaSuper.kt") public void testInvokeDefaultViaSuper() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/invokeDefaultViaSuper/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/invokeDefaultViaSuper.kt"); + doTest(fileName); } - @TestMetadata("longChainOfKotlinExtendsFromJavaWithDefault") + @TestMetadata("longChainOfKotlinExtendsFromJavaWithDefault.kt") public void testLongChainOfKotlinExtendsFromJavaWithDefault() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/longChainOfKotlinExtendsFromJavaWithDefault/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/longChainOfKotlinExtendsFromJavaWithDefault.kt"); + doTest(fileName); } - @TestMetadata("samOnInterfaceWithDefaultMethod") + @TestMetadata("samOnInterfaceWithDefaultMethod.kt") public void testSamOnInterfaceWithDefaultMethod() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/samOnInterfaceWithDefaultMethod/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/samOnInterfaceWithDefaultMethod.kt"); + doTest(fileName); } - @TestMetadata("compiler/testData/codegen/java8/boxWithJava/reflection") + @TestMetadata("compiler/testData/codegen/java8/box/reflection") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class Reflection extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInReflection() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/boxWithJava/reflection"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/java8/box/reflection"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("realParameterNames") + @TestMetadata("realParameterNames.kt") public void testRealParameterNames() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/reflection/realParameterNames/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/reflection/realParameterNames.kt"); + doTest(fileName); } - @TestMetadata("synthesizedParameterNames") + @TestMetadata("synthesizedParameterNames.kt") public void testSynthesizedParameterNames() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/boxWithJava/reflection/synthesizedParameterNames/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/java8/box/reflection/synthesizedParameterNames.kt"); + doTest(fileName); } - } - } diff --git a/compiler/testData/codegen/boxWithJava/allWildcardsOnClass/JavaClass.java b/compiler/testData/codegen/boxWithJava/allWildcardsOnClass.kt similarity index 52% rename from compiler/testData/codegen/boxWithJava/allWildcardsOnClass/JavaClass.java rename to compiler/testData/codegen/boxWithJava/allWildcardsOnClass.kt index 89eadf58002..93f3efb9788 100644 --- a/compiler/testData/codegen/boxWithJava/allWildcardsOnClass/JavaClass.java +++ b/compiler/testData/codegen/boxWithJava/allWildcardsOnClass.kt @@ -1,3 +1,5 @@ +// FILE: JavaClass.java + public class JavaClass { public static class C extends B { @@ -21,3 +23,25 @@ public class JavaClass { return "OK"; } } + +// FILE: main.kt + +class OutPair(val x: X, val y: Y) +class In { + fun make(x: Z): String = x.toString() +} + +@JvmSuppressWildcards(suppress = false) +interface A { + fun foo(): OutPair + fun bar(): In +} + +abstract class B : A { + override fun foo(): OutPair = OutPair("OK", 123) + override fun bar(): In = In() +} + +fun box(): String { + return JavaClass.test(); +} diff --git a/compiler/testData/codegen/boxWithJava/allWildcardsOnClass/main.kt b/compiler/testData/codegen/boxWithJava/allWildcardsOnClass/main.kt deleted file mode 100644 index e1ad0f82402..00000000000 --- a/compiler/testData/codegen/boxWithJava/allWildcardsOnClass/main.kt +++ /dev/null @@ -1,19 +0,0 @@ -class OutPair(val x: X, val y: Y) -class In { - fun make(x: Z): String = x.toString() -} - -@JvmSuppressWildcards(suppress = false) -interface A { - fun foo(): OutPair - fun bar(): In -} - -abstract class B : A { - override fun foo(): OutPair = OutPair("OK", 123) - override fun bar(): In = In() -} - -fun box(): String { - return JavaClass.test(); -} diff --git a/compiler/testData/codegen/boxWithJava/annotatedFileClasses/javaAnnotationOnFileFacade/fileFacade.kt b/compiler/testData/codegen/boxWithJava/annotatedFileClasses/javaAnnotationOnFileFacade/fileFacade.kt deleted file mode 100644 index f4af844647a..00000000000 --- a/compiler/testData/codegen/boxWithJava/annotatedFileClasses/javaAnnotationOnFileFacade/fileFacade.kt +++ /dev/null @@ -1,4 +0,0 @@ -@file:StringHolder("OK") - -fun box(): String = - Class.forName("FileFacadeKt").getAnnotation(StringHolder::class.java)?.value ?: "null" \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/annotatedSamFunExpression/annotatedSamFunExpression.kt b/compiler/testData/codegen/boxWithJava/annotatedSamFunExpression.kt similarity index 74% rename from compiler/testData/codegen/boxWithJava/annotatedSamFunExpression/annotatedSamFunExpression.kt rename to compiler/testData/codegen/boxWithJava/annotatedSamFunExpression.kt index 1991f2e904e..032a68a65a1 100644 --- a/compiler/testData/codegen/boxWithJava/annotatedSamFunExpression/annotatedSamFunExpression.kt +++ b/compiler/testData/codegen/boxWithJava/annotatedSamFunExpression.kt @@ -1,3 +1,21 @@ +// FILE: Test.java + +class Test { + public static Class apply(Runnable x) { + return x.getClass(); + } + + public static interface ABC { + void apply(String x1, String x2); + } + + public static Class applyABC(ABC x) { + return x.getClass(); + } +} + +// FILE: test.kt + import java.lang.reflect.Method import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/boxWithJava/annotatedSamFunExpression/Test.java b/compiler/testData/codegen/boxWithJava/annotatedSamFunExpression/Test.java deleted file mode 100644 index aeff3d5115c..00000000000 --- a/compiler/testData/codegen/boxWithJava/annotatedSamFunExpression/Test.java +++ /dev/null @@ -1,15 +0,0 @@ -import java.lang.Runnable; - -class Test { - public static Class apply(Runnable x) { - return x.getClass(); - } - - public static interface ABC { - void apply(String x1, String x2); - } - - public static Class applyABC(ABC x) { - return x.getClass(); - } -} diff --git a/compiler/testData/codegen/boxWithJava/annotatedSamLambda/annotatedSamLambda.kt b/compiler/testData/codegen/boxWithJava/annotatedSamLambda.kt similarity index 86% rename from compiler/testData/codegen/boxWithJava/annotatedSamLambda/annotatedSamLambda.kt rename to compiler/testData/codegen/boxWithJava/annotatedSamLambda.kt index 9226dc91b96..8dbebfd91ba 100644 --- a/compiler/testData/codegen/boxWithJava/annotatedSamLambda/annotatedSamLambda.kt +++ b/compiler/testData/codegen/boxWithJava/annotatedSamLambda.kt @@ -1,3 +1,13 @@ +// FILE: Test.java + +class Test { + public static Class apply(Runnable x) { + return x.getClass(); + } +} + +// FILE: test.kt + import java.lang.reflect.Method import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/boxWithJava/annotatedSamLambda/Test.java b/compiler/testData/codegen/boxWithJava/annotatedSamLambda/Test.java deleted file mode 100644 index b3e5d731ed2..00000000000 --- a/compiler/testData/codegen/boxWithJava/annotatedSamLambda/Test.java +++ /dev/null @@ -1,7 +0,0 @@ -import java.lang.Runnable; - -class Test { - public static Class apply(Runnable x) { - return x.getClass(); - } -} diff --git a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/array/array.kt b/compiler/testData/codegen/boxWithJava/annotationsWithKClass/array.kt similarity index 75% rename from compiler/testData/codegen/boxWithJava/annotationsWithKClass/array/array.kt rename to compiler/testData/codegen/boxWithJava/annotationsWithKClass/array.kt index 7eb7511a2f4..38ceb8c7902 100644 --- a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/array/array.kt +++ b/compiler/testData/codegen/boxWithJava/annotationsWithKClass/array.kt @@ -1,3 +1,14 @@ +// FILE: Test.java + +class O {} +class K {} + +@Ann(args={O.class, K.class}) +class Test { +} + +// FILE: array.kt + import kotlin.reflect.KClass @Retention(AnnotationRetention.RUNTIME) diff --git a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/array/Test.java b/compiler/testData/codegen/boxWithJava/annotationsWithKClass/array/Test.java deleted file mode 100644 index fc6ae917a57..00000000000 --- a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/array/Test.java +++ /dev/null @@ -1,6 +0,0 @@ -class O {} -class K {} - -@Ann(args={O.class, K.class}) -class Test { -} diff --git a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/basic/basic.kt b/compiler/testData/codegen/boxWithJava/annotationsWithKClass/basic.kt similarity index 73% rename from compiler/testData/codegen/boxWithJava/annotationsWithKClass/basic/basic.kt rename to compiler/testData/codegen/boxWithJava/annotationsWithKClass/basic.kt index 4cca48f0ca4..ba5d272def4 100644 --- a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/basic/basic.kt +++ b/compiler/testData/codegen/boxWithJava/annotationsWithKClass/basic.kt @@ -1,3 +1,13 @@ +// FILE: Test.java + +class OK {} + +@Ann(arg=OK.class) +class Test { +} + +// FILE: basic.kt + import kotlin.reflect.KClass @Retention(AnnotationRetention.RUNTIME) diff --git a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/basic/Test.java b/compiler/testData/codegen/boxWithJava/annotationsWithKClass/basic/Test.java deleted file mode 100644 index 3c55129f786..00000000000 --- a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/basic/Test.java +++ /dev/null @@ -1,5 +0,0 @@ -class OK {} - -@Ann(arg=OK.class) -class Test { -} diff --git a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/vararg/vararg.kt b/compiler/testData/codegen/boxWithJava/annotationsWithKClass/vararg.kt similarity index 75% rename from compiler/testData/codegen/boxWithJava/annotationsWithKClass/vararg/vararg.kt rename to compiler/testData/codegen/boxWithJava/annotationsWithKClass/vararg.kt index 984339b52b6..e12a7817fcf 100644 --- a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/vararg/vararg.kt +++ b/compiler/testData/codegen/boxWithJava/annotationsWithKClass/vararg.kt @@ -1,3 +1,14 @@ +// FILE: Test.java + +class O {} +class K {} + +@Ann(args={O.class, K.class}) +class Test { +} + +// FILE: vararg.kt + import kotlin.reflect.KClass @Retention(AnnotationRetention.RUNTIME) diff --git a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/vararg/Test.java b/compiler/testData/codegen/boxWithJava/annotationsWithKClass/vararg/Test.java deleted file mode 100644 index fc6ae917a57..00000000000 --- a/compiler/testData/codegen/boxWithJava/annotationsWithKClass/vararg/Test.java +++ /dev/null @@ -1,6 +0,0 @@ -class O {} -class K {} - -@Ann(args={O.class, K.class}) -class Test { -} diff --git a/compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections/Test.java b/compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections.kt similarity index 52% rename from compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections/Test.java rename to compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections.kt index a09e486d203..594259c35a2 100644 --- a/compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections/Test.java +++ b/compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections.kt @@ -1,3 +1,5 @@ +// FILE: Test.java + import java.lang.*; import java.util.*; @@ -8,3 +10,19 @@ public class Test { public String setValue(String s) { return null; } } } + +// FILE: main.kt + +//class MyIterable : Test.IterableImpl() +//class MyIterator : Test.IteratorImpl() +class MyMapEntry : Test.MapEntryImpl() + +fun box(): String { + + val b = MyMapEntry() + b.key + b.value + b.setValue(null) + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections/extendJavaCollections.kt b/compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections/extendJavaCollections.kt deleted file mode 100644 index abf425e444e..00000000000 --- a/compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections/extendJavaCollections.kt +++ /dev/null @@ -1,13 +0,0 @@ -//class MyIterable : Test.IterableImpl() -//class MyIterator : Test.IteratorImpl() -class MyMapEntry : Test.MapEntryImpl() - -fun box(): String { - - val b = MyMapEntry() - b.key - b.value - b.setValue(null) - - return "OK" -} diff --git a/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedIterable/substitutedIterable.kt b/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedIterable.kt similarity index 51% rename from compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedIterable/substitutedIterable.kt rename to compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedIterable.kt index 0a6c159ccb2..11304b89189 100644 --- a/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedIterable/substitutedIterable.kt +++ b/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedIterable.kt @@ -1,3 +1,16 @@ +// FILE: Test.java + +public class Test { + public static void checkCallFromJava() { + try { + String x = TestKt.foo().iterator().next(); + throw new AssertionError("E should have been thrown"); + } catch (E e) { } + } +} + +// FILE: test.kt + interface MyIterable : Iterable class E : RuntimeException() diff --git a/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedIterable/Test.java b/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedIterable/Test.java deleted file mode 100644 index ac97b10f504..00000000000 --- a/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedIterable/Test.java +++ /dev/null @@ -1,8 +0,0 @@ -public class Test { - public static void checkCallFromJava() { - try { - String x = SubstitutedIterableKt.foo().iterator().next(); - throw new AssertionError("E should have been thrown"); - } catch (E e) { } - } -} diff --git a/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedList/substitutedList.kt b/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedList.kt similarity index 79% rename from compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedList/substitutedList.kt rename to compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedList.kt index fea7ae4c324..a827cf87bfc 100644 --- a/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedList/substitutedList.kt +++ b/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedList.kt @@ -1,3 +1,20 @@ +// FILE: Test.java + +class Test { + interface A { + boolean add(String s); + } + + static class D extends C {} + + void test() { + A a = new D(); + a.add("lol"); + } +} + +// FILE: test.kt + abstract class C : Test.A, List { override val size: Int get() = null!! override fun isEmpty(): Boolean = null!! diff --git a/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedList/Test.java b/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedList/Test.java deleted file mode 100644 index 434b2d7a2a5..00000000000 --- a/compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedList/Test.java +++ /dev/null @@ -1,12 +0,0 @@ -class Test { - interface A { - boolean add(String s); - } - - static class D extends C {} - - void test() { - A a = new D(); - a.add("lol"); - } -} diff --git a/compiler/testData/codegen/boxWithJava/casts/javaTypeIsFunK.kt b/compiler/testData/codegen/boxWithJava/casts/javaTypeIsFunK.kt new file mode 100644 index 00000000000..c42a27cccb7 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/casts/javaTypeIsFunK.kt @@ -0,0 +1,16 @@ +// FILE: JFun.java + +class JFun implements kotlin.jvm.functions.Function0 { + public String invoke() { + return "OK"; + } +} + +// FILE: test.kt + +fun box(): String { + val jfun = JFun() + val jf = jfun as Any + if (jf is Function0<*>) return jfun() + else return "Failed: jf is Function0<*>" +} diff --git a/compiler/testData/codegen/boxWithJava/casts/javaTypeIsFunK/JFun.java b/compiler/testData/codegen/boxWithJava/casts/javaTypeIsFunK/JFun.java deleted file mode 100644 index 5554bd18c15..00000000000 --- a/compiler/testData/codegen/boxWithJava/casts/javaTypeIsFunK/JFun.java +++ /dev/null @@ -1,5 +0,0 @@ -class JFun implements kotlin.jvm.functions.Function0 { - public String invoke() { - return "OK"; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/casts/javaTypeIsFunK/javaTypeIsFunK.kt b/compiler/testData/codegen/boxWithJava/casts/javaTypeIsFunK/javaTypeIsFunK.kt deleted file mode 100644 index f249b74f519..00000000000 --- a/compiler/testData/codegen/boxWithJava/casts/javaTypeIsFunK/javaTypeIsFunK.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - val jfun = JFun() - val jf = jfun as Any - if (jf is Function0<*>) return jfun() - else return "Failed: jf is Function0<*>" -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/casts/literalExpressionAsGenericArgument/Box.java b/compiler/testData/codegen/boxWithJava/casts/literalExpressionAsGenericArgument.kt similarity index 65% rename from compiler/testData/codegen/boxWithJava/casts/literalExpressionAsGenericArgument/Box.java rename to compiler/testData/codegen/boxWithJava/casts/literalExpressionAsGenericArgument.kt index 98690d3ebb1..e459ee256ed 100644 --- a/compiler/testData/codegen/boxWithJava/casts/literalExpressionAsGenericArgument/Box.java +++ b/compiler/testData/codegen/boxWithJava/casts/literalExpressionAsGenericArgument.kt @@ -1,3 +1,5 @@ +// FILE: Box.java + public class Box { private final T value; @@ -12,4 +14,11 @@ public class Box { public T getValue() { return value; } -} \ No newline at end of file +} + +// FILE: test.kt + +fun box(): String { + val sub = Box(-1) + return if (sub.value == -1L) "OK" else "fail" +} diff --git a/compiler/testData/codegen/boxWithJava/casts/literalExpressionAsGenericArgument/literalExpressionAsGenericArgument.kt b/compiler/testData/codegen/boxWithJava/casts/literalExpressionAsGenericArgument/literalExpressionAsGenericArgument.kt deleted file mode 100644 index c270553c35d..00000000000 --- a/compiler/testData/codegen/boxWithJava/casts/literalExpressionAsGenericArgument/literalExpressionAsGenericArgument.kt +++ /dev/null @@ -1,4 +0,0 @@ -fun box(): String { - val sub = Box(-1) - return if (sub.value == -1L) "OK" else "fail" -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/classCompanion/CompanionInitialization.kt b/compiler/testData/codegen/boxWithJava/classCompanion.kt similarity index 65% rename from compiler/testData/codegen/boxWithJava/classCompanion/CompanionInitialization.kt rename to compiler/testData/codegen/boxWithJava/classCompanion.kt index 6dea847c6c1..4b03c59c52f 100644 --- a/compiler/testData/codegen/boxWithJava/classCompanion/CompanionInitialization.kt +++ b/compiler/testData/codegen/boxWithJava/classCompanion.kt @@ -1,3 +1,15 @@ +// FILE: CompanionInitialization.java + +public class CompanionInitialization { + + public static Object getCompanion() { + return ConcreteWithStatic.Companion; + } + +} + +// FILE: CompanionInitialization.kt + interface IStatic open class Static(x: IStatic) { @@ -17,4 +29,4 @@ fun box(): String { if (companion != ConcreteWithStatic) return "fail 2" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxWithJava/classCompanion/CompanionInitialization.java b/compiler/testData/codegen/boxWithJava/classCompanion/CompanionInitialization.java deleted file mode 100644 index ceb302b9b0e..00000000000 --- a/compiler/testData/codegen/boxWithJava/classCompanion/CompanionInitialization.java +++ /dev/null @@ -1,7 +0,0 @@ -public class CompanionInitialization { - - public static Object getCompanion() { - return ConcreteWithStatic.Companion; - } - -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/classObjectAccessor/J.java b/compiler/testData/codegen/boxWithJava/classObjectAccessor/J.java deleted file mode 100644 index 1464f02b7bc..00000000000 --- a/compiler/testData/codegen/boxWithJava/classObjectAccessor/J.java +++ /dev/null @@ -1,5 +0,0 @@ -public class J { - public static int f() { - return A.Companion.getI1() + A.Companion.getI2() + B.Named.getI1() + B.Named.getI2(); - } -} diff --git a/compiler/testData/codegen/boxWithJava/collections/charSequence/charSequence.kt b/compiler/testData/codegen/boxWithJava/collections/charSequence.kt similarity index 52% rename from compiler/testData/codegen/boxWithJava/collections/charSequence/charSequence.kt rename to compiler/testData/codegen/boxWithJava/collections/charSequence.kt index 079c77d6f2f..4f10ab49343 100644 --- a/compiler/testData/codegen/boxWithJava/collections/charSequence/charSequence.kt +++ b/compiler/testData/codegen/boxWithJava/collections/charSequence.kt @@ -1,3 +1,37 @@ +// FILE: J.java + +import java.util.*; + +public class J { + + public static class B extends A { + public int getLength() { return 456; } + public char get(int index) { + if (index == 1) return 'a'; + return super.get(index); + } + } + + public static String foo() { + B b = new B(); + CharSequence cs = (CharSequence) b; + + if (cs.length() != 456) return "fail 01"; + if (b.length() != 456) return "fail 02"; + if (b.getLength() != 456) return "fail 03"; + + if (cs.charAt(0) != 'z') return "fail 1"; + if (b.get(0) != 'z') return "fail 2"; + + if (cs.charAt(1) != 'a') return "fail 3"; + if (b.get(1) != 'a') return "fail 4"; + + return "OK"; + } +} + +// FILE: test.kt + open class A : CharSequence { override val length: Int = 123 diff --git a/compiler/testData/codegen/boxWithJava/collections/charSequence/J.java b/compiler/testData/codegen/boxWithJava/collections/charSequence/J.java deleted file mode 100644 index 629aa1f0437..00000000000 --- a/compiler/testData/codegen/boxWithJava/collections/charSequence/J.java +++ /dev/null @@ -1,29 +0,0 @@ -import java.util.*; - -public class J { - - public static class B extends A { - public int getLength() { return 456; } - public char get(int index) { - if (index == 1) return 'a'; - return super.get(index); - } - } - - public static String foo() { - B b = new B(); - CharSequence cs = (CharSequence) b; - - if (cs.length() != 456) return "fail 01"; - if (b.length() != 456) return "fail 02"; - if (b.getLength() != 456) return "fail 03"; - - if (cs.charAt(0) != 'z') return "fail 1"; - if (b.get(0) != 'z') return "fail 2"; - - if (cs.charAt(1) != 'a') return "fail 3"; - if (b.get(1) != 'a') return "fail 4"; - - return "OK"; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/collections/implementCollectionThroughKotlin/J.java b/compiler/testData/codegen/boxWithJava/collections/implementCollectionThroughKotlin.kt similarity index 63% rename from compiler/testData/codegen/boxWithJava/collections/implementCollectionThroughKotlin/J.java rename to compiler/testData/codegen/boxWithJava/collections/implementCollectionThroughKotlin.kt index 632b22f68a3..2e8327beb3b 100644 --- a/compiler/testData/codegen/boxWithJava/collections/implementCollectionThroughKotlin/J.java +++ b/compiler/testData/codegen/boxWithJava/collections/implementCollectionThroughKotlin.kt @@ -1,3 +1,5 @@ +// FILE: J.java + import org.jetbrains.annotations.NotNull; import java.util.Collection; @@ -62,3 +64,32 @@ public class J extends MyList { return super.listIterator(); } } + +// FILE: test.kt + +abstract class MyList : List + +class ListImpl : J() { + override val size: Int get() = super.size + 1 +} + +fun box(): String { + val impl = ListImpl() + if (impl.size != 56) return "fail 1" + if (!impl.contains("abc")) return "fail 2" + + val l: List = impl + + if (l.size != 56) return "fail 3" + if (!l.contains("abc")) return "fail 4" + + val anyList: List = impl as List + + if (anyList.size != 56) return "fail 5" + if (!anyList.contains("abc")) return "fail 6" + + if (anyList.contains(1)) return "fail 7" + if (anyList.contains(null)) return "fail 8" + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithJava/collections/implementCollectionThroughKotlin/implementCollectionThroughKotlin.kt b/compiler/testData/codegen/boxWithJava/collections/implementCollectionThroughKotlin/implementCollectionThroughKotlin.kt deleted file mode 100644 index 499ac0043b0..00000000000 --- a/compiler/testData/codegen/boxWithJava/collections/implementCollectionThroughKotlin/implementCollectionThroughKotlin.kt +++ /dev/null @@ -1,26 +0,0 @@ -abstract class MyList : List - -class ListImpl : J() { - override val size: Int get() = super.size + 1 -} - -fun box(): String { - val impl = ListImpl() - if (impl.size != 56) return "fail 1" - if (!impl.contains("abc")) return "fail 2" - - val l: List = impl - - if (l.size != 56) return "fail 3" - if (!l.contains("abc")) return "fail 4" - - val anyList: List = impl as List - - if (anyList.size != 56) return "fail 5" - if (!anyList.contains("abc")) return "fail 6" - - if (anyList.contains(1)) return "fail 7" - if (anyList.contains(null)) return "fail 8" - - return "OK" -} diff --git a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequence/J.java b/compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequence.kt similarity index 66% rename from compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequence/J.java rename to compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequence.kt index c154786144b..203d89a5c8f 100644 --- a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequence/J.java +++ b/compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequence.kt @@ -1,3 +1,5 @@ +// FILE: J.java + public class J { abstract static public class AImpl { public char charAt(int index) { @@ -13,3 +15,14 @@ public class J { } } } + +// FILE: test.kt + +class X : J.A() + +fun box(): String { + val x = X() + if (x.length != 56) return "fail 1" + if (x[0] != 'A') return "fail 2" + return "OK" +} diff --git a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequence/irrelevantImplCharSequence.kt b/compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequence/irrelevantImplCharSequence.kt deleted file mode 100644 index 5bae53d8786..00000000000 --- a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequence/irrelevantImplCharSequence.kt +++ /dev/null @@ -1,9 +0,0 @@ - -class X : J.A() - -fun box(): String { - val x = X() - if (x.length != 56) return "fail 1" - if (x[0] != 'A') return "fail 2" - return "OK" -} diff --git a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequenceKotlin/irrelevantImplCharSequence.kt b/compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequenceKotlin.kt similarity index 55% rename from compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequenceKotlin/irrelevantImplCharSequence.kt rename to compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequenceKotlin.kt index 86867647d70..377254fc92f 100644 --- a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequenceKotlin/irrelevantImplCharSequence.kt +++ b/compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequenceKotlin.kt @@ -1,3 +1,15 @@ +// FILE: J.java + +public class J { + public static class A extends AImpl implements CharSequence { + public CharSequence subSequence(int start, int end) { + return null; + } + } +} + +// FILE: test.kt + abstract class AImpl { fun charAt(index: Int): Char { return 'A' diff --git a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequenceKotlin/J.java b/compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequenceKotlin/J.java deleted file mode 100644 index 02f3225135a..00000000000 --- a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequenceKotlin/J.java +++ /dev/null @@ -1,7 +0,0 @@ -public class J { - public static class A extends AImpl implements CharSequence { - public CharSequence subSequence(int start, int end) { - return null; - } - } -} diff --git a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableList/J.java b/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableList.kt similarity index 91% rename from compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableList/J.java rename to compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableList.kt index b5c6b17aef3..c5aa8d88389 100644 --- a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableList/J.java +++ b/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableList.kt @@ -1,3 +1,5 @@ +// FILE: J.java + import java.util.*; public class J { abstract static public class AImpl { @@ -97,3 +99,15 @@ public class J { public static class A extends AImpl implements List { } } + +// FILE: test.kt + +class X : J.A() + +fun box(): String { + val x = X() + if (x.size != 56) return "fail 1" + if (!x.contains("")) return "fail 2" + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableList/irrelevantImplMutableList.kt b/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableList/irrelevantImplMutableList.kt deleted file mode 100644 index 2b28ae42ed8..00000000000 --- a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableList/irrelevantImplMutableList.kt +++ /dev/null @@ -1,10 +0,0 @@ - -class X : J.A() - -fun box(): String { - val x = X() - if (x.size != 56) return "fail 1" - if (!x.contains("")) return "fail 2" - - return "OK" -} diff --git a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListKotlin/irrelevantImplMutableListKotlin.kt b/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListKotlin.kt similarity index 91% rename from compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListKotlin/irrelevantImplMutableListKotlin.kt rename to compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListKotlin.kt index 5ec84c5c6be..f7ccb51249c 100644 --- a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListKotlin/irrelevantImplMutableListKotlin.kt +++ b/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListKotlin.kt @@ -1,3 +1,12 @@ +// FILE: A.java + +public class A extends AImpl implements java.util.List { + public T[] toArray(T[] a) {return null;} + public Object[] toArray() {return null;} +} + +// FILE: test.kt + public abstract class AImpl { fun add(element: String): Boolean { throw UnsupportedOperationException() diff --git a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListKotlin/A.java b/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListKotlin/A.java deleted file mode 100644 index 6e788aa2682..00000000000 --- a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListKotlin/A.java +++ /dev/null @@ -1,4 +0,0 @@ -public class A extends AImpl implements java.util.List { - public T[] toArray(T[] a) {return null;} - public Object[] toArray() {return null;} -} diff --git a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListSubstitution/J.java b/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListSubstitution.kt similarity index 91% rename from compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListSubstitution/J.java rename to compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListSubstitution.kt index 91037088d37..15f8f0aa042 100644 --- a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListSubstitution/J.java +++ b/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListSubstitution.kt @@ -1,3 +1,5 @@ +// FILE: J.java + import java.util.*; public class J { abstract static public class AImpl { @@ -97,3 +99,15 @@ public class J { public static class A extends AImpl implements List { } } + +// FILE: test.kt + +class X : J.A() + +fun box(): String { + val x = X() + if (x.size != 56) return "fail 1" + if (!x.contains(null)) return "fail 2" + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListSubstitution/irrelevantImplMutableListSubstitution.kt b/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListSubstitution/irrelevantImplMutableListSubstitution.kt deleted file mode 100644 index aa2075cc778..00000000000 --- a/compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListSubstitution/irrelevantImplMutableListSubstitution.kt +++ /dev/null @@ -1,10 +0,0 @@ - -class X : J.A() - -fun box(): String { - val x = X() - if (x.size != 56) return "fail 1" - if (!x.contains(null)) return "fail 2" - - return "OK" -} diff --git a/compiler/testData/codegen/boxWithJava/collections/irrelevantRemoveAtOverrideInJava/irrelevantRemoveAtOverrideInJava.kt b/compiler/testData/codegen/boxWithJava/collections/irrelevantRemoveAtOverrideInJava.kt similarity index 94% rename from compiler/testData/codegen/boxWithJava/collections/irrelevantRemoveAtOverrideInJava/irrelevantRemoveAtOverrideInJava.kt rename to compiler/testData/codegen/boxWithJava/collections/irrelevantRemoveAtOverrideInJava.kt index 0b473335efa..2dd4e8dd3e8 100644 --- a/compiler/testData/codegen/boxWithJava/collections/irrelevantRemoveAtOverrideInJava/irrelevantRemoveAtOverrideInJava.kt +++ b/compiler/testData/codegen/boxWithJava/collections/irrelevantRemoveAtOverrideInJava.kt @@ -1,3 +1,13 @@ +// FILE: J.java + +import java.util.*; + +public class J implements Container { + final public String removeAt(int index) { return "abc"; } +} + +// FILE: test.kt + interface Container { fun removeAt(x: Int): String } diff --git a/compiler/testData/codegen/boxWithJava/collections/irrelevantRemoveAtOverrideInJava/J.java b/compiler/testData/codegen/boxWithJava/collections/irrelevantRemoveAtOverrideInJava/J.java deleted file mode 100644 index 6fd107fc11f..00000000000 --- a/compiler/testData/codegen/boxWithJava/collections/irrelevantRemoveAtOverrideInJava/J.java +++ /dev/null @@ -1,5 +0,0 @@ -import java.util.*; - -public class J implements Container { - final public String removeAt(int index) { return "abc"; } -} diff --git a/compiler/testData/codegen/boxWithJava/collections/irrelevantSizeOverrideInJava/irrelevantSizeOverrideInJava.kt b/compiler/testData/codegen/boxWithJava/collections/irrelevantSizeOverrideInJava.kt similarity index 83% rename from compiler/testData/codegen/boxWithJava/collections/irrelevantSizeOverrideInJava/irrelevantSizeOverrideInJava.kt rename to compiler/testData/codegen/boxWithJava/collections/irrelevantSizeOverrideInJava.kt index 8e382956c79..e25bcafa7cd 100644 --- a/compiler/testData/codegen/boxWithJava/collections/irrelevantSizeOverrideInJava/irrelevantSizeOverrideInJava.kt +++ b/compiler/testData/codegen/boxWithJava/collections/irrelevantSizeOverrideInJava.kt @@ -1,3 +1,13 @@ +// FILE: J.java + +import java.util.*; + +public class J implements Sized { + final public int getSize() { return 123; } +} + +// FILE: test.kt + interface Sized { val size: Int } diff --git a/compiler/testData/codegen/boxWithJava/collections/irrelevantSizeOverrideInJava/J.java b/compiler/testData/codegen/boxWithJava/collections/irrelevantSizeOverrideInJava/J.java deleted file mode 100644 index 891235751f4..00000000000 --- a/compiler/testData/codegen/boxWithJava/collections/irrelevantSizeOverrideInJava/J.java +++ /dev/null @@ -1,5 +0,0 @@ -import java.util.*; - -public class J implements Sized { - final public int getSize() { return 123; } -} diff --git a/compiler/testData/codegen/boxWithJava/collections/mutableList/mutableList.kt b/compiler/testData/codegen/boxWithJava/collections/mutableList.kt similarity index 84% rename from compiler/testData/codegen/boxWithJava/collections/mutableList/mutableList.kt rename to compiler/testData/codegen/boxWithJava/collections/mutableList.kt index a5cfaea0e40..74d19ed0ad1 100644 --- a/compiler/testData/codegen/boxWithJava/collections/mutableList/mutableList.kt +++ b/compiler/testData/codegen/boxWithJava/collections/mutableList.kt @@ -1,3 +1,21 @@ +// FILE: J.java + +import java.util.*; + +public class J { + + private static class MyList extends KList {} + + public static String foo() { + Collection collection = new MyList(); + if (!collection.contains("ABCDE")) return "fail 1"; + if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2"; + return "OK"; + } +} + +// FILE: test.kt + open class KList : MutableList { override fun add(e: E): Boolean { throw UnsupportedOperationException() diff --git a/compiler/testData/codegen/boxWithJava/collections/mutableList/J.java b/compiler/testData/codegen/boxWithJava/collections/mutableList/J.java deleted file mode 100644 index cfc22995761..00000000000 --- a/compiler/testData/codegen/boxWithJava/collections/mutableList/J.java +++ /dev/null @@ -1,13 +0,0 @@ -import java.util.*; - -public class J { - - private static class MyList extends KList {} - - public static String foo() { - Collection collection = new MyList(); - if (!collection.contains("ABCDE")) return "fail 1"; - if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2"; - return "OK"; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/collections/platformValueContains/platformValueContains.kt b/compiler/testData/codegen/boxWithJava/collections/platformValueContains.kt similarity index 86% rename from compiler/testData/codegen/boxWithJava/collections/platformValueContains/platformValueContains.kt rename to compiler/testData/codegen/boxWithJava/collections/platformValueContains.kt index 8172f14bfb8..ca587bdc198 100644 --- a/compiler/testData/codegen/boxWithJava/collections/platformValueContains/platformValueContains.kt +++ b/compiler/testData/codegen/boxWithJava/collections/platformValueContains.kt @@ -1,3 +1,15 @@ +// FILE: J.java + +import java.util.*; + +public class J { + public static String nullValue() { + return null; + } +} + +// FILE: test.kt + class MySet : Set { override val size: Int get() = throw UnsupportedOperationException() @@ -37,4 +49,4 @@ fun box(): String { null in anySet return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxWithJava/collections/platformValueContains/J.java b/compiler/testData/codegen/boxWithJava/collections/platformValueContains/J.java deleted file mode 100644 index 2f9e2cb1da2..00000000000 --- a/compiler/testData/codegen/boxWithJava/collections/platformValueContains/J.java +++ /dev/null @@ -1,7 +0,0 @@ -import java.util.*; - -public class J { - public static String nullValue() { - return null; - } -} diff --git a/compiler/testData/codegen/boxWithJava/collections/readOnlyList/readOnlyList.kt b/compiler/testData/codegen/boxWithJava/collections/readOnlyList.kt similarity index 71% rename from compiler/testData/codegen/boxWithJava/collections/readOnlyList/readOnlyList.kt rename to compiler/testData/codegen/boxWithJava/collections/readOnlyList.kt index fbe4312ae11..172c19260df 100644 --- a/compiler/testData/codegen/boxWithJava/collections/readOnlyList/readOnlyList.kt +++ b/compiler/testData/codegen/boxWithJava/collections/readOnlyList.kt @@ -1,3 +1,21 @@ +// FILE: J.java + +import java.util.*; + +public class J { + + private static class MyList extends KList {} + + public static String foo() { + Collection collection = new MyList(); + if (!collection.contains("ABCDE")) return "fail 1"; + if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2"; + return "OK"; + } +} + +// FILE: test.kt + open class KList : List { override val size: Int get() = throw UnsupportedOperationException() @@ -37,4 +55,4 @@ open class KList : List { } } -fun box() = J.foo() \ No newline at end of file +fun box() = J.foo() diff --git a/compiler/testData/codegen/boxWithJava/collections/readOnlyList/J.java b/compiler/testData/codegen/boxWithJava/collections/readOnlyList/J.java deleted file mode 100644 index cfc22995761..00000000000 --- a/compiler/testData/codegen/boxWithJava/collections/readOnlyList/J.java +++ /dev/null @@ -1,13 +0,0 @@ -import java.util.*; - -public class J { - - private static class MyList extends KList {} - - public static String foo() { - Collection collection = new MyList(); - if (!collection.contains("ABCDE")) return "fail 1"; - if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2"; - return "OK"; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/collections/readOnlyMap/readOnlyMap.kt b/compiler/testData/codegen/boxWithJava/collections/readOnlyMap.kt similarity index 63% rename from compiler/testData/codegen/boxWithJava/collections/readOnlyMap/readOnlyMap.kt rename to compiler/testData/codegen/boxWithJava/collections/readOnlyMap.kt index 2f506290bea..b5e6710540a 100644 --- a/compiler/testData/codegen/boxWithJava/collections/readOnlyMap/readOnlyMap.kt +++ b/compiler/testData/codegen/boxWithJava/collections/readOnlyMap.kt @@ -1,3 +1,21 @@ +// FILE: J.java + +import java.util.*; + +public class J { + + private static class MyMap extends KMap {} + + public static String foo() { + Map collection = new MyMap(); + if (!collection.containsKey("ABCDE")) return "fail 1"; + if (!collection.containsValue(1)) return "fail 2"; + return "OK"; + } +} + +// FILE: test.kt + open class KMap : Map { override val size: Int get() = throw UnsupportedOperationException() diff --git a/compiler/testData/codegen/boxWithJava/collections/readOnlyMap/J.java b/compiler/testData/codegen/boxWithJava/collections/readOnlyMap/J.java deleted file mode 100644 index d938c43279d..00000000000 --- a/compiler/testData/codegen/boxWithJava/collections/readOnlyMap/J.java +++ /dev/null @@ -1,13 +0,0 @@ -import java.util.*; - -public class J { - - private static class MyMap extends KMap {} - - public static String foo() { - Map collection = new MyMap(); - if (!collection.containsKey("ABCDE")) return "fail 1"; - if (!collection.containsValue(1)) return "fail 2"; - return "OK"; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/collections/removeAtInt/removeAtInt.kt b/compiler/testData/codegen/boxWithJava/collections/removeAtInt.kt similarity index 78% rename from compiler/testData/codegen/boxWithJava/collections/removeAtInt/removeAtInt.kt rename to compiler/testData/codegen/boxWithJava/collections/removeAtInt.kt index 511843957ac..a78cca18661 100644 --- a/compiler/testData/codegen/boxWithJava/collections/removeAtInt/removeAtInt.kt +++ b/compiler/testData/codegen/boxWithJava/collections/removeAtInt.kt @@ -1,3 +1,28 @@ +// FILE: J.java + +import java.util.*; + +public class J { + + private static class MyList extends A {} + + public static String foo() { + MyList myList = new MyList(); + List list = (List) myList; + + if (!list.remove((Integer) 1)) return "fail 1"; + if (list.remove((int) 1) != 123) return "fail 2"; + + if (!myList.remove((Integer) 1)) return "fail 3"; + if (myList.remove((int) 1) != 123) return "fail 4"; + + if (myList.removeAt(1) != 123) return "fail 5"; + return "OK"; + } +} + +// FILE: test.kt + open class A : MutableList { override val size: Int get() = throw UnsupportedOperationException() @@ -76,4 +101,4 @@ open class A : MutableList { } } -fun box() = J.foo() \ No newline at end of file +fun box() = J.foo() diff --git a/compiler/testData/codegen/boxWithJava/collections/removeAtInt/J.java b/compiler/testData/codegen/boxWithJava/collections/removeAtInt/J.java deleted file mode 100644 index de6211e82e9..00000000000 --- a/compiler/testData/codegen/boxWithJava/collections/removeAtInt/J.java +++ /dev/null @@ -1,20 +0,0 @@ -import java.util.*; - -public class J { - - private static class MyList extends A {} - - public static String foo() { - MyList myList = new MyList(); - List list = (List) myList; - - if (!list.remove((Integer) 1)) return "fail 1"; - if (list.remove((int) 1) != 123) return "fail 2"; - - if (!myList.remove((Integer) 1)) return "fail 3"; - if (myList.remove((int) 1) != 123) return "fail 4"; - - if (myList.removeAt(1) != 123) return "fail 5"; - return "OK"; - } -} diff --git a/compiler/testData/codegen/boxWithJava/collections/strList/strList.kt b/compiler/testData/codegen/boxWithJava/collections/strList.kt similarity index 85% rename from compiler/testData/codegen/boxWithJava/collections/strList/strList.kt rename to compiler/testData/codegen/boxWithJava/collections/strList.kt index 508b521c719..57ed9af7ee2 100644 --- a/compiler/testData/codegen/boxWithJava/collections/strList/strList.kt +++ b/compiler/testData/codegen/boxWithJava/collections/strList.kt @@ -1,3 +1,21 @@ +// FILE: J.java + +import java.util.*; + +public class J { + + private static class MyList extends KList {} + + public static String foo() { + Collection collection = new MyList(); + if (!collection.contains("ABCDE")) return "fail 1"; + if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2"; + return "OK"; + } +} + +// FILE: test.kt + abstract class KList : MutableList { override val size: Int get() = throw UnsupportedOperationException() diff --git a/compiler/testData/codegen/boxWithJava/collections/strList/J.java b/compiler/testData/codegen/boxWithJava/collections/strList/J.java deleted file mode 100644 index 9c9ed7d421a..00000000000 --- a/compiler/testData/codegen/boxWithJava/collections/strList/J.java +++ /dev/null @@ -1,13 +0,0 @@ -import java.util.*; - -public class J { - - private static class MyList extends KList {} - - public static String foo() { - Collection collection = new MyList(); - if (!collection.contains("ABCDE")) return "fail 1"; - if (!collection.containsAll(Arrays.asList(1, 2, 3))) return "fail 2"; - return "OK"; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/classObjectAccessor/classObject.kt b/compiler/testData/codegen/boxWithJava/companionObjectAccessor.kt similarity index 59% rename from compiler/testData/codegen/boxWithJava/classObjectAccessor/classObject.kt rename to compiler/testData/codegen/boxWithJava/companionObjectAccessor.kt index d8d1b09b117..05fe91d7549 100644 --- a/compiler/testData/codegen/boxWithJava/classObjectAccessor/classObject.kt +++ b/compiler/testData/codegen/boxWithJava/companionObjectAccessor.kt @@ -1,3 +1,13 @@ +// FILE: J.java + +public class J { + public static int f() { + return A.Companion.getI1() + A.Companion.getI2() + B.Named.getI1() + B.Named.getI2(); + } +} + +// FILE: test.kt + class A { companion object { val i1 = 1 diff --git a/compiler/testData/codegen/boxWithJava/covariantOverrideWithDeclarationSiteProjection/JavaClass.java b/compiler/testData/codegen/boxWithJava/covariantOverrideWithDeclarationSiteProjection.kt similarity index 51% rename from compiler/testData/codegen/boxWithJava/covariantOverrideWithDeclarationSiteProjection/JavaClass.java rename to compiler/testData/codegen/boxWithJava/covariantOverrideWithDeclarationSiteProjection.kt index 89eadf58002..fac871fb05d 100644 --- a/compiler/testData/codegen/boxWithJava/covariantOverrideWithDeclarationSiteProjection/JavaClass.java +++ b/compiler/testData/codegen/boxWithJava/covariantOverrideWithDeclarationSiteProjection.kt @@ -1,3 +1,5 @@ +// FILE: JavaClass.java + public class JavaClass { public static class C extends B { @@ -21,3 +23,24 @@ public class JavaClass { return "OK"; } } + +// FILE: main.kt + +class OutPair(val x: X, val y: Y) +class In { + fun make(x: Z): String = x.toString() +} + +interface A { + fun foo(): OutPair<@JvmWildcard CharSequence, @JvmSuppressWildcards(false) Number> + fun bar(): In<@JvmWildcard String> +} + +abstract class B : A { + override fun foo(): OutPair = OutPair("OK", 123) + override fun bar(): In = In() +} + +fun box(): String { + return JavaClass.test(); +} diff --git a/compiler/testData/codegen/boxWithJava/covariantOverrideWithDeclarationSiteProjection/main.kt b/compiler/testData/codegen/boxWithJava/covariantOverrideWithDeclarationSiteProjection/main.kt deleted file mode 100644 index 0f77d0fb2f9..00000000000 --- a/compiler/testData/codegen/boxWithJava/covariantOverrideWithDeclarationSiteProjection/main.kt +++ /dev/null @@ -1,18 +0,0 @@ -class OutPair(val x: X, val y: Y) -class In { - fun make(x: Z): String = x.toString() -} - -interface A { - fun foo(): OutPair<@JvmWildcard CharSequence, @JvmSuppressWildcards(false) Number> - fun bar(): In<@JvmWildcard String> -} - -abstract class B : A { - override fun foo(): OutPair = OutPair("OK", 123) - override fun bar(): In = In() -} - -fun box(): String { - return JavaClass.test(); -} diff --git a/compiler/testData/codegen/boxWithJava/deprecatedFieldForObject/B.java b/compiler/testData/codegen/boxWithJava/deprecatedFieldForObject/B.java deleted file mode 100644 index 5fd876495ec..00000000000 --- a/compiler/testData/codegen/boxWithJava/deprecatedFieldForObject/B.java +++ /dev/null @@ -1,4 +0,0 @@ -public class B { - public static int a = A.INSTANCE.getC(); - public static int b = A.INSTANCE.foo(); -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/deprecatedFieldForObject/deprecatedInstanceFieldForObject.kt b/compiler/testData/codegen/boxWithJava/deprecatedFieldForObject/deprecatedInstanceFieldForObject.kt deleted file mode 100644 index 8831ecce551..00000000000 --- a/compiler/testData/codegen/boxWithJava/deprecatedFieldForObject/deprecatedInstanceFieldForObject.kt +++ /dev/null @@ -1,10 +0,0 @@ -import B - -object A { - val c = 1 - fun foo() = 4 -} - -fun box(): String { - return if (B.a == 1 && B.b == 4) "OK" else "${B.a} ${B.b}" -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/enhancedPrimitives/J.java b/compiler/testData/codegen/boxWithJava/enhancedPrimitives.kt similarity index 84% rename from compiler/testData/codegen/boxWithJava/enhancedPrimitives/J.java rename to compiler/testData/codegen/boxWithJava/enhancedPrimitives.kt index eef9a061740..29c66ca88a7 100644 --- a/compiler/testData/codegen/boxWithJava/enhancedPrimitives/J.java +++ b/compiler/testData/codegen/boxWithJava/enhancedPrimitives.kt @@ -1,3 +1,5 @@ +// FILE: J.java + public class J { // This test checks that although type '@org.jetbrains.annotations.NotNull Integer' is perceived as simple Int, // it's correctly mapped to 'Lj.l.Integer' by JVM backend @@ -5,3 +7,7 @@ public class J { return "OK"; } } + +// FILE: box.kt + +fun box() = J.test(1) diff --git a/compiler/testData/codegen/boxWithJava/enhancedPrimitives/box.kt b/compiler/testData/codegen/boxWithJava/enhancedPrimitives/box.kt deleted file mode 100644 index c64158e4833..00000000000 --- a/compiler/testData/codegen/boxWithJava/enhancedPrimitives/box.kt +++ /dev/null @@ -1 +0,0 @@ -fun box() = J.test(1) diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/differentFiles.kt b/compiler/testData/codegen/boxWithJava/fileClasses/differentFiles.kt new file mode 100644 index 00000000000..887a1af5cc5 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/fileClasses/differentFiles.kt @@ -0,0 +1,21 @@ +// FILE: Baz.java + +public class Baz { + public static String baz() { + return Foo.foo() + Bar.bar(); + } +} + +// FILE: bar.kt + +@file:JvmName("Bar") +public fun bar(): String = "K" + +// FILE: foo.kt + +@file:JvmName("Foo") +public fun foo(): String = "O" + +// FILE: test.kt + +fun box(): String = Baz.baz() diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/differentFiles/Baz.java b/compiler/testData/codegen/boxWithJava/fileClasses/differentFiles/Baz.java deleted file mode 100644 index 3af00b277ef..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/differentFiles/Baz.java +++ /dev/null @@ -1,5 +0,0 @@ -public class Baz { - public static String baz() { - return Foo.foo() + Bar.bar(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/differentFiles/bar.kt b/compiler/testData/codegen/boxWithJava/fileClasses/differentFiles/bar.kt deleted file mode 100644 index 82f819e335a..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/differentFiles/bar.kt +++ /dev/null @@ -1,2 +0,0 @@ -@file:JvmName("Bar") -public fun bar(): String = "K" \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/differentFiles/differentFiles.kt b/compiler/testData/codegen/boxWithJava/fileClasses/differentFiles/differentFiles.kt deleted file mode 100644 index 936b887daa8..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/differentFiles/differentFiles.kt +++ /dev/null @@ -1 +0,0 @@ -fun box(): String = Baz.baz() \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/differentFiles/foo.kt b/compiler/testData/codegen/boxWithJava/fileClasses/differentFiles/foo.kt deleted file mode 100644 index ed0aecdce4d..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/differentFiles/foo.kt +++ /dev/null @@ -1,2 +0,0 @@ -@file:JvmName("Foo") -public fun foo(): String = "O" \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/annotatedFileClasses/javaAnnotationOnFileFacade/StringHolder.java b/compiler/testData/codegen/boxWithJava/fileClasses/javaAnnotationOnFileFacade.kt similarity index 59% rename from compiler/testData/codegen/boxWithJava/annotatedFileClasses/javaAnnotationOnFileFacade/StringHolder.java rename to compiler/testData/codegen/boxWithJava/fileClasses/javaAnnotationOnFileFacade.kt index 9ad0c301567..d4db0df8d60 100644 --- a/compiler/testData/codegen/boxWithJava/annotatedFileClasses/javaAnnotationOnFileFacade/StringHolder.java +++ b/compiler/testData/codegen/boxWithJava/fileClasses/javaAnnotationOnFileFacade.kt @@ -1,3 +1,5 @@ +// FILE: StringHolder.java + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -7,4 +9,11 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) public @interface StringHolder { public String value(); -} \ No newline at end of file +} + +// FILE: fileFacade.kt + +@file:StringHolder("OK") + +fun box(): String = + Class.forName("FileFacadeKt").getAnnotation(StringHolder::class.java)?.value ?: "null" diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWith2Files.kt b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWith2Files.kt new file mode 100644 index 00000000000..fc240cd9899 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWith2Files.kt @@ -0,0 +1,22 @@ +// FILE: Baz.java + +public class Baz { + public static String baz() { + return Util.foo() + Util.bar(); + } +} + +// FILE: bar.kt + +@file:JvmName("Util") +@file:JvmMultifileClass +public fun bar(): String = "K" + +// FILE: foo.kt + +@file:[JvmName("Util") JvmMultifileClass] +public fun foo(): String = "O" + +// FILE: test.kt + +fun box(): String = Baz.baz() diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWith2Files/Baz.java b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWith2Files/Baz.java deleted file mode 100644 index d5fd7bcb24a..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWith2Files/Baz.java +++ /dev/null @@ -1,5 +0,0 @@ -public class Baz { - public static String baz() { - return Util.foo() + Util.bar(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWith2Files/bar.kt b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWith2Files/bar.kt deleted file mode 100644 index f5d29e0a6fc..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWith2Files/bar.kt +++ /dev/null @@ -1,3 +0,0 @@ -@file:JvmName("Util") -@file:JvmMultifileClass -public fun bar(): String = "K" \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWith2Files/foo.kt b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWith2Files/foo.kt deleted file mode 100644 index 3ad9ce5bde9..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWith2Files/foo.kt +++ /dev/null @@ -1,2 +0,0 @@ -@file:[JvmName("Util") JvmMultifileClass] -public fun foo(): String = "O" \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWith2Files/multifileClassWith2Files.kt b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWith2Files/multifileClassWith2Files.kt deleted file mode 100644 index 936b887daa8..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWith2Files/multifileClassWith2Files.kt +++ /dev/null @@ -1 +0,0 @@ -fun box(): String = Baz.baz() \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithCrossCall.kt b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithCrossCall.kt new file mode 100644 index 00000000000..0a2e8bd496d --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithCrossCall.kt @@ -0,0 +1,27 @@ +// FILE: Baz.java + +public class Baz { + public static String baz() { + return Util.foo() + Util.bar(); + } +} + +// FILE: bar.kt + +@file:JvmName("Util") +@file:JvmMultifileClass +public fun bar(): String = barx() + +public fun foox(): String = "O" + +// FILE: foo.kt + +@file:JvmName("Util") +@file:JvmMultifileClass +public fun foo(): String = foox() + +public fun barx(): String = "K" + +// FILE: test.kt + +fun box(): String = Baz.baz() diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithCrossCall/Baz.java b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithCrossCall/Baz.java deleted file mode 100644 index d5fd7bcb24a..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithCrossCall/Baz.java +++ /dev/null @@ -1,5 +0,0 @@ -public class Baz { - public static String baz() { - return Util.foo() + Util.bar(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithCrossCall/bar.kt b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithCrossCall/bar.kt deleted file mode 100644 index 9ba3b952920..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithCrossCall/bar.kt +++ /dev/null @@ -1,5 +0,0 @@ -@file:JvmName("Util") -@file:JvmMultifileClass -public fun bar(): String = barx() - -public fun foox(): String = "O" \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithCrossCall/foo.kt b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithCrossCall/foo.kt deleted file mode 100644 index 6c6939f4453..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithCrossCall/foo.kt +++ /dev/null @@ -1,5 +0,0 @@ -@file:JvmName("Util") -@file:JvmMultifileClass -public fun foo(): String = foox() - -public fun barx(): String = "K" \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithCrossCall/multifileClassWithInternal.kt b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithCrossCall/multifileClassWithInternal.kt deleted file mode 100644 index 936b887daa8..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithCrossCall/multifileClassWithInternal.kt +++ /dev/null @@ -1 +0,0 @@ -fun box(): String = Baz.baz() \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithPrivate.kt b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithPrivate.kt new file mode 100644 index 00000000000..3227619a9cc --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithPrivate.kt @@ -0,0 +1,27 @@ +// FILE: Baz.java + +public class Baz { + public static String baz() { + return Util.foo() + Util.bar(); + } +} + +// FILE: bar.kt + +@file:JvmName("Util") +@file:JvmMultifileClass +public fun bar(): String = barx() + +private fun barx(): String = "K" + +// FILE: foo.kt + +@file:JvmName("Util") +@file:JvmMultifileClass +public fun foo(): String = foox() + +private fun foox(): String = "O" + +// FILE: test.kt + +fun box(): String = Baz.baz() diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithPrivate/Baz.java b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithPrivate/Baz.java deleted file mode 100644 index d5fd7bcb24a..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithPrivate/Baz.java +++ /dev/null @@ -1,5 +0,0 @@ -public class Baz { - public static String baz() { - return Util.foo() + Util.bar(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithPrivate/bar.kt b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithPrivate/bar.kt deleted file mode 100644 index a220905840a..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithPrivate/bar.kt +++ /dev/null @@ -1,5 +0,0 @@ -@file:JvmName("Util") -@file:JvmMultifileClass -public fun bar(): String = barx() - -private fun barx(): String = "K" \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithPrivate/foo.kt b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithPrivate/foo.kt deleted file mode 100644 index 92b45cb2dc2..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithPrivate/foo.kt +++ /dev/null @@ -1,5 +0,0 @@ -@file:JvmName("Util") -@file:JvmMultifileClass -public fun foo(): String = foox() - -private fun foox(): String = "O" \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithPrivate/multifileClassWithPrivate.kt b/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithPrivate/multifileClassWithPrivate.kt deleted file mode 100644 index 936b887daa8..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithPrivate/multifileClassWithPrivate.kt +++ /dev/null @@ -1 +0,0 @@ -fun box(): String = Baz.baz() \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/simple.kt b/compiler/testData/codegen/boxWithJava/fileClasses/simple.kt new file mode 100644 index 00000000000..fd2feb7393a --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/fileClasses/simple.kt @@ -0,0 +1,16 @@ +// FILE: Bar.java + +public class Bar { + public static String bar() { + return Foo.foo(); + } +} + +// FILE: foo.kt + +@file:JvmName("Foo") +public fun foo(): String = "OK" + +// FILE: simple.kt + +fun box(): String = Bar.bar() diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/simple/Bar.java b/compiler/testData/codegen/boxWithJava/fileClasses/simple/Bar.java deleted file mode 100644 index 2ef76a82c6f..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/simple/Bar.java +++ /dev/null @@ -1,5 +0,0 @@ -public class Bar { - public static String bar() { - return Foo.foo(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/simple/foo.kt b/compiler/testData/codegen/boxWithJava/fileClasses/simple/foo.kt deleted file mode 100644 index 5f19fc06f65..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/simple/foo.kt +++ /dev/null @@ -1,2 +0,0 @@ -@file:JvmName("Foo") -public fun foo(): String = "OK" \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/fileClasses/simple/simple.kt b/compiler/testData/codegen/boxWithJava/fileClasses/simple/simple.kt deleted file mode 100644 index f60eab480fd..00000000000 --- a/compiler/testData/codegen/boxWithJava/fileClasses/simple/simple.kt +++ /dev/null @@ -1 +0,0 @@ -fun box(): String = Bar.bar() diff --git a/compiler/testData/codegen/boxWithJava/inline.kt b/compiler/testData/codegen/boxWithJava/inline.kt new file mode 100644 index 00000000000..fa448a79b9d --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/inline.kt @@ -0,0 +1,27 @@ +// FILE: Test.java + +public class Test { + + protected String data = "O"; + + protected Test() { + + } + + protected static String testStatic() { + return "K"; + } + +} + +// FILE: test.kt + +public inline fun test(): String { + val p = object : Test() {} + return p.data + Test.testStatic(); +} + + +fun box(): String { + return test() +} diff --git a/compiler/testData/codegen/boxWithJava/inline/Test.java b/compiler/testData/codegen/boxWithJava/inline/Test.java deleted file mode 100644 index 083be6c0664..00000000000 --- a/compiler/testData/codegen/boxWithJava/inline/Test.java +++ /dev/null @@ -1,13 +0,0 @@ -public class Test { - - protected String data = "O"; - - protected Test() { - - } - - protected static String testStatic() { - return "K"; - } - -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/inline/javaProtectedVisibility.kt b/compiler/testData/codegen/boxWithJava/inline/javaProtectedVisibility.kt deleted file mode 100644 index b8635015f98..00000000000 --- a/compiler/testData/codegen/boxWithJava/inline/javaProtectedVisibility.kt +++ /dev/null @@ -1,10 +0,0 @@ - -public inline fun test(): String { - val p = object : Test() {} - return p.data + Test.testStatic(); -} - - -fun box(): String { - return test() -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/innerClass/Kotlin.kt b/compiler/testData/codegen/boxWithJava/innerClass.kt similarity index 62% rename from compiler/testData/codegen/boxWithJava/innerClass/Kotlin.kt rename to compiler/testData/codegen/boxWithJava/innerClass.kt index 125d6417f6b..2e80b2bc847 100644 --- a/compiler/testData/codegen/boxWithJava/innerClass/Kotlin.kt +++ b/compiler/testData/codegen/boxWithJava/innerClass.kt @@ -1,3 +1,15 @@ +// FILE: JavaClass.java + +public abstract class JavaClass { + public abstract InnerClass onCreateInner(); + + public class InnerClass { + + } +} + +// FILE: Kotlin.kt + public class MyWallpaperService : JavaClass() { override fun onCreateInner(): JavaClass.InnerClass = MyEngine() @@ -6,4 +18,4 @@ public class MyWallpaperService : JavaClass() { fun box(): String { return if (MyWallpaperService().onCreateInner() != null) return "OK" else "fail" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxWithJava/innerClass/JavaClass.java b/compiler/testData/codegen/boxWithJava/innerClass/JavaClass.java deleted file mode 100644 index a5b6cbb06ce..00000000000 --- a/compiler/testData/codegen/boxWithJava/innerClass/JavaClass.java +++ /dev/null @@ -1,7 +0,0 @@ -public abstract class JavaClass { - public abstract InnerClass onCreateInner(); - - public class InnerClass { - - } -} diff --git a/compiler/testData/codegen/boxWithJava/innerGenericClass/Kotlin.kt b/compiler/testData/codegen/boxWithJava/innerGenericClass.kt similarity index 60% rename from compiler/testData/codegen/boxWithJava/innerGenericClass/Kotlin.kt rename to compiler/testData/codegen/boxWithJava/innerGenericClass.kt index deffb928d1d..de22812b35f 100644 --- a/compiler/testData/codegen/boxWithJava/innerGenericClass/Kotlin.kt +++ b/compiler/testData/codegen/boxWithJava/innerGenericClass.kt @@ -1,3 +1,13 @@ +// FILE: JavaClass.java + +public abstract class JavaClass { + public static String test() { + return Test.INSTANCE.foo(new Outer("OK").new Inner(1)); + } +} + +// FILE: Kotlin.kt + class Outer(val x: E) { inner class Inner(val y: F) { fun foo() = x.toString() + y.toString() diff --git a/compiler/testData/codegen/boxWithJava/innerGenericClass/JavaClass.java b/compiler/testData/codegen/boxWithJava/innerGenericClass/JavaClass.java deleted file mode 100644 index 41c4032833c..00000000000 --- a/compiler/testData/codegen/boxWithJava/innerGenericClass/JavaClass.java +++ /dev/null @@ -1,5 +0,0 @@ -public abstract class JavaClass { - public static String test() { - return Test.INSTANCE.foo(new Outer("OK").new Inner(1)); - } -} diff --git a/compiler/testData/codegen/boxWithJava/interfaceCompanion/CompanionInitialization.kt b/compiler/testData/codegen/boxWithJava/interfaceCompanion.kt similarity index 67% rename from compiler/testData/codegen/boxWithJava/interfaceCompanion/CompanionInitialization.kt rename to compiler/testData/codegen/boxWithJava/interfaceCompanion.kt index b648ac53472..b2b9353b3df 100644 --- a/compiler/testData/codegen/boxWithJava/interfaceCompanion/CompanionInitialization.kt +++ b/compiler/testData/codegen/boxWithJava/interfaceCompanion.kt @@ -1,3 +1,15 @@ +// FILE: CompanionInitialization.java + +public class CompanionInitialization { + + public static Object getCompanion() { + return IStatic.Companion; + } + +} + +// FILE: CompanionInitialization.kt + open class Static(): IStatic { val p = IStatic::class.java.getDeclaredField("const").get(null) } @@ -19,4 +31,4 @@ fun box(): String { if (companion != IStatic) return "fail 2" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxWithJava/interfaceCompanion/CompanionInitialization.java b/compiler/testData/codegen/boxWithJava/interfaceCompanion/CompanionInitialization.java deleted file mode 100644 index 273e04a0f33..00000000000 --- a/compiler/testData/codegen/boxWithJava/interfaceCompanion/CompanionInitialization.java +++ /dev/null @@ -1,7 +0,0 @@ -public class CompanionInitialization { - - public static Object getCompanion() { - return IStatic.Companion; - } - -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/interfaceDefaultImpls/main.kt b/compiler/testData/codegen/boxWithJava/interfaceDefaultImpls.kt similarity index 57% rename from compiler/testData/codegen/boxWithJava/interfaceDefaultImpls/main.kt rename to compiler/testData/codegen/boxWithJava/interfaceDefaultImpls.kt index 1114dd547a4..ee63c78a9c3 100644 --- a/compiler/testData/codegen/boxWithJava/interfaceDefaultImpls/main.kt +++ b/compiler/testData/codegen/boxWithJava/interfaceDefaultImpls.kt @@ -1,3 +1,13 @@ +// FILE: B.java + +class B { + static String test(A x) { + return A.DefaultImpls.foo(x); + } +} + +// FILE: main.kt + interface A { fun foo() = "OK" } diff --git a/compiler/testData/codegen/boxWithJava/interfaceDefaultImpls/B.java b/compiler/testData/codegen/boxWithJava/interfaceDefaultImpls/B.java deleted file mode 100644 index 423e5a8a207..00000000000 --- a/compiler/testData/codegen/boxWithJava/interfaceDefaultImpls/B.java +++ /dev/null @@ -1,5 +0,0 @@ -class B { - static String test(A x) { - return A.DefaultImpls.foo(x); - } -} diff --git a/compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface/KC.kt b/compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface.kt similarity index 56% rename from compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface/KC.kt rename to compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface.kt index 7106000b428..de2cad0065d 100644 --- a/compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface/KC.kt +++ b/compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface.kt @@ -1,3 +1,13 @@ +// FILE: ExtendsKCWithT.java + +public class ExtendsKCWithT extends KC { + public static String bar() { + return new ExtendsKCWithT().foo(); + } +} + +// FILE: KC.kt + // KT-3407 Implementing (in Java) an abstract Kotlin class that implements a trait does not respect trait method definition interface T { diff --git a/compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface/ExtendsKCWithT.java b/compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface/ExtendsKCWithT.java deleted file mode 100644 index ca7ed42961a..00000000000 --- a/compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface/ExtendsKCWithT.java +++ /dev/null @@ -1,5 +0,0 @@ -public class ExtendsKCWithT extends KC { - public static String bar() { - return new ExtendsKCWithT().foo(); - } -} diff --git a/compiler/testData/codegen/boxWithJava/interfaces/inheritJavaInterface/interfaceInheritance.kt b/compiler/testData/codegen/boxWithJava/interfaces/inheritJavaInterface.kt similarity index 62% rename from compiler/testData/codegen/boxWithJava/interfaces/inheritJavaInterface/interfaceInheritance.kt rename to compiler/testData/codegen/boxWithJava/interfaces/inheritJavaInterface.kt index bceff8b3b05..97a9c78a949 100644 --- a/compiler/testData/codegen/boxWithJava/interfaces/inheritJavaInterface/interfaceInheritance.kt +++ b/compiler/testData/codegen/boxWithJava/interfaces/inheritJavaInterface.kt @@ -1,3 +1,12 @@ +// FILE: MyInt.java + +public interface MyInt { + + String test(); +} + +// FILE: test.kt + interface A : MyInt { override public fun test(): String? { return "OK" @@ -8,4 +17,4 @@ class B: A fun box() : String { return B().test()!! -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxWithJava/interfaces/inheritJavaInterface/MyInt.java b/compiler/testData/codegen/boxWithJava/interfaces/inheritJavaInterface/MyInt.java deleted file mode 100644 index 8a9dc92f8f1..00000000000 --- a/compiler/testData/codegen/boxWithJava/interfaces/inheritJavaInterface/MyInt.java +++ /dev/null @@ -1,4 +0,0 @@ -public interface MyInt { - - String test(); -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/invariantArgumentsNoWildcard/main.kt b/compiler/testData/codegen/boxWithJava/invariantArgumentsNoWildcard.kt similarity index 64% rename from compiler/testData/codegen/boxWithJava/invariantArgumentsNoWildcard/main.kt rename to compiler/testData/codegen/boxWithJava/invariantArgumentsNoWildcard.kt index 5b49da06360..16f977a6cd8 100644 --- a/compiler/testData/codegen/boxWithJava/invariantArgumentsNoWildcard/main.kt +++ b/compiler/testData/codegen/boxWithJava/invariantArgumentsNoWildcard.kt @@ -1,3 +1,13 @@ +// FILE: JavaClass.java + +public class JavaClass { + public static String test() { + return MainKt.bar(MainKt.foo()); + } +} + +// FILE: main.kt + class Pair(val x: X, val y: Y) class Inv(val x: T) diff --git a/compiler/testData/codegen/boxWithJava/invariantArgumentsNoWildcard/JavaClass.java b/compiler/testData/codegen/boxWithJava/invariantArgumentsNoWildcard/JavaClass.java deleted file mode 100644 index 8a74860ebce..00000000000 --- a/compiler/testData/codegen/boxWithJava/invariantArgumentsNoWildcard/JavaClass.java +++ /dev/null @@ -1,5 +0,0 @@ -public class JavaClass { - public static String test() { - return MainKt.bar(MainKt.foo()); - } -} diff --git a/compiler/testData/codegen/boxWithJava/invokeOnSyntheticProperty/main.kt b/compiler/testData/codegen/boxWithJava/invokeOnSyntheticProperty.kt similarity index 55% rename from compiler/testData/codegen/boxWithJava/invokeOnSyntheticProperty/main.kt rename to compiler/testData/codegen/boxWithJava/invokeOnSyntheticProperty.kt index 60a7c672f9c..b5fc13e457b 100644 --- a/compiler/testData/codegen/boxWithJava/invokeOnSyntheticProperty/main.kt +++ b/compiler/testData/codegen/boxWithJava/invokeOnSyntheticProperty.kt @@ -1,3 +1,13 @@ +// FILE: JavaClass.java + +public class JavaClass { + public String getO() { + return "O"; + } +} + +// FILE: main.kt + // KT-9522 Allow invoke convention for synthetic property operator fun String.invoke() = this + "K" diff --git a/compiler/testData/codegen/boxWithJava/invokeOnSyntheticProperty/JavaClass.java b/compiler/testData/codegen/boxWithJava/invokeOnSyntheticProperty/JavaClass.java deleted file mode 100644 index bbcfc7d5ffe..00000000000 --- a/compiler/testData/codegen/boxWithJava/invokeOnSyntheticProperty/JavaClass.java +++ /dev/null @@ -1,5 +0,0 @@ -public class JavaClass { - public String getO() { - return "O"; - } -} diff --git a/compiler/testData/codegen/boxWithJava/javaProperty/boxedGetter/kotlin.kt b/compiler/testData/codegen/boxWithJava/javaProperty/boxedGetter.kt similarity index 54% rename from compiler/testData/codegen/boxWithJava/javaProperty/boxedGetter/kotlin.kt rename to compiler/testData/codegen/boxWithJava/javaProperty/boxedGetter.kt index eb6c8219fc2..91bbd678060 100644 --- a/compiler/testData/codegen/boxWithJava/javaProperty/boxedGetter/kotlin.kt +++ b/compiler/testData/codegen/boxWithJava/javaProperty/boxedGetter.kt @@ -1,3 +1,20 @@ +// FILE: JavaClass.java + +public class JavaClass { + + private Boolean value; + + public Boolean isValue() { + return value; + } + + public void setValue(boolean value) { + this.value = value; + } +} + +// FILE: kotlin.kt + fun box(): String { val javaClass = JavaClass() @@ -10,4 +27,4 @@ fun box(): String { if (javaClass.isValue != true) return "fail 3" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxWithJava/javaProperty/boxedGetter/JavaClass.java b/compiler/testData/codegen/boxWithJava/javaProperty/boxedGetter/JavaClass.java deleted file mode 100644 index f499564b631..00000000000 --- a/compiler/testData/codegen/boxWithJava/javaProperty/boxedGetter/JavaClass.java +++ /dev/null @@ -1,12 +0,0 @@ -public class JavaClass { - - private Boolean value; - - public Boolean isValue() { - return value; - } - - public void setValue(boolean value) { - this.value = value; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/javaProperty/boxedSetter.kt b/compiler/testData/codegen/boxWithJava/javaProperty/boxedSetter.kt new file mode 100644 index 00000000000..862cf066e98 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/javaProperty/boxedSetter.kt @@ -0,0 +1,28 @@ +// FILE: JavaClass.java + +public class JavaClass { + + private boolean value; + + public boolean isValue() { + return value; + } + + public void setValue(Boolean value) { + this.value = value; + } +} + +// FILE: kotlin.kt + +fun box(): String { + val javaClass = JavaClass() + + if (javaClass.isValue != false) return "fail 1" + + javaClass.isValue = true + + if (javaClass.isValue != true) return "fail 2" + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithJava/javaProperty/boxedSetter/JavaClass.java b/compiler/testData/codegen/boxWithJava/javaProperty/boxedSetter/JavaClass.java deleted file mode 100644 index ef4c6ae312c..00000000000 --- a/compiler/testData/codegen/boxWithJava/javaProperty/boxedSetter/JavaClass.java +++ /dev/null @@ -1,12 +0,0 @@ -public class JavaClass { - - private boolean value; - - public boolean isValue() { - return value; - } - - public void setValue(Boolean value) { - this.value = value; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/javaProperty/boxedSetter/kotlin.kt b/compiler/testData/codegen/boxWithJava/javaProperty/boxedSetter/kotlin.kt deleted file mode 100644 index 808731f722b..00000000000 --- a/compiler/testData/codegen/boxWithJava/javaProperty/boxedSetter/kotlin.kt +++ /dev/null @@ -1,11 +0,0 @@ -fun box(): String { - val javaClass = JavaClass() - - if (javaClass.isValue != false) return "fail 1" - - javaClass.isValue = true - - if (javaClass.isValue != true) return "fail 2" - - return "OK" -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/jvmField/constructorProperty.kt b/compiler/testData/codegen/boxWithJava/jvmField/constructorProperty.kt new file mode 100644 index 00000000000..ea0ed56d726 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/jvmField/constructorProperty.kt @@ -0,0 +1,18 @@ +// FILE: Test.java + +public class Test { + public static String invokeMethodWithPublicField() { + C c = new C("OK"); + return c.foo; + } +} + +// FILE: simple.kt + +class C(@JvmField val foo: String) { + +} + +fun box(): String { + return Test.invokeMethodWithPublicField() +} diff --git a/compiler/testData/codegen/boxWithJava/jvmField/constructorProperty/Test.java b/compiler/testData/codegen/boxWithJava/jvmField/constructorProperty/Test.java deleted file mode 100644 index 6158f269fb6..00000000000 --- a/compiler/testData/codegen/boxWithJava/jvmField/constructorProperty/Test.java +++ /dev/null @@ -1,6 +0,0 @@ -public class Test { - public static String invokeMethodWithPublicField() { - C c = new C("OK"); - return c.foo; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/jvmField/constructorProperty/simple.kt b/compiler/testData/codegen/boxWithJava/jvmField/constructorProperty/simple.kt deleted file mode 100644 index 5cf5feca94f..00000000000 --- a/compiler/testData/codegen/boxWithJava/jvmField/constructorProperty/simple.kt +++ /dev/null @@ -1,7 +0,0 @@ -class C(@JvmField val foo: String) { - -} - -fun box(): String { - return Test.invokeMethodWithPublicField() -} diff --git a/compiler/testData/codegen/boxWithJava/jvmField/simple.kt b/compiler/testData/codegen/boxWithJava/jvmField/simple.kt new file mode 100644 index 00000000000..4112b0f189b --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/jvmField/simple.kt @@ -0,0 +1,18 @@ +// FILE: Test.java + +public class Test { + public static String invokeMethodWithPublicField() { + C c = new C(); + return c.foo; + } +} + +// FILE: simple.kt + +class C { + @JvmField public val foo: String = "OK" +} + +fun box(): String { + return Test.invokeMethodWithPublicField() +} diff --git a/compiler/testData/codegen/boxWithJava/jvmField/simple/Test.java b/compiler/testData/codegen/boxWithJava/jvmField/simple/Test.java deleted file mode 100644 index 846c2246310..00000000000 --- a/compiler/testData/codegen/boxWithJava/jvmField/simple/Test.java +++ /dev/null @@ -1,6 +0,0 @@ -public class Test { - public static String invokeMethodWithPublicField() { - C c = new C(); - return c.foo; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/jvmField/simple/simple.kt b/compiler/testData/codegen/boxWithJava/jvmField/simple/simple.kt deleted file mode 100644 index 55a5b7ad4e3..00000000000 --- a/compiler/testData/codegen/boxWithJava/jvmField/simple/simple.kt +++ /dev/null @@ -1,7 +0,0 @@ -class C { - @JvmField public val foo: String = "OK" -} - -fun box(): String { - return Test.invokeMethodWithPublicField() -} diff --git a/compiler/testData/codegen/boxWithJava/jvmName.kt b/compiler/testData/codegen/boxWithJava/jvmName.kt new file mode 100644 index 00000000000..c8e1c1661fc --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/jvmName.kt @@ -0,0 +1,23 @@ +// FILE: FakePlatformName.java + +import kotlin.jvm.JvmName; + +public class FakePlatformName { + @JvmName(name = "fake") + public String foo() { + return "foo"; + } + + public String fake() { + return "fake"; + } +} + +// FILE: FakePlatformName.kt + +fun box(): String { + val test1 = FakePlatformName().foo() + if (test1 != "foo") return "Failed: FakePlatformName().foo()==$test1" + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithJava/jvmName/FakePlatformName.java b/compiler/testData/codegen/boxWithJava/jvmName/FakePlatformName.java deleted file mode 100644 index 3fd27a352ee..00000000000 --- a/compiler/testData/codegen/boxWithJava/jvmName/FakePlatformName.java +++ /dev/null @@ -1,12 +0,0 @@ -import kotlin.jvm.JvmName; - -public class FakePlatformName { - @JvmName(name = "fake") - public String foo() { - return "foo"; - } - - public String fake() { - return "fake"; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/jvmName/FakePlatformName.kt b/compiler/testData/codegen/boxWithJava/jvmName/FakePlatformName.kt deleted file mode 100644 index bdad08e86bb..00000000000 --- a/compiler/testData/codegen/boxWithJava/jvmName/FakePlatformName.kt +++ /dev/null @@ -1,6 +0,0 @@ -fun box(): String { - val test1 = FakePlatformName().foo() - if (test1 != "foo") return "Failed: FakePlatformName().foo()==$test1" - - return "OK" -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/jvmOverloads/generics.kt b/compiler/testData/codegen/boxWithJava/jvmOverloads/generics.kt new file mode 100644 index 00000000000..b63fe927dcd --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/jvmOverloads/generics.kt @@ -0,0 +1,18 @@ +// FILE: Test.java + +public class Test { + public static String invokeMethodWithOverloads() { + C c = new C(); + return c.foo("O"); + } +} + +// FILE: generics.kt + +class C { + @kotlin.jvm.JvmOverloads public fun foo(o: T, k: String = "K"): String = o.toString() + k +} + +fun box(): String { + return Test.invokeMethodWithOverloads() +} diff --git a/compiler/testData/codegen/boxWithJava/jvmOverloads/generics/Test.java b/compiler/testData/codegen/boxWithJava/jvmOverloads/generics/Test.java deleted file mode 100644 index 577b15680b4..00000000000 --- a/compiler/testData/codegen/boxWithJava/jvmOverloads/generics/Test.java +++ /dev/null @@ -1,6 +0,0 @@ -public class Test { - public static String invokeMethodWithOverloads() { - C c = new C(); - return c.foo("O"); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/jvmOverloads/generics/generics.kt b/compiler/testData/codegen/boxWithJava/jvmOverloads/generics/generics.kt deleted file mode 100644 index a840a848e32..00000000000 --- a/compiler/testData/codegen/boxWithJava/jvmOverloads/generics/generics.kt +++ /dev/null @@ -1,7 +0,0 @@ -class C { - @kotlin.jvm.JvmOverloads public fun foo(o: T, k: String = "K"): String = o.toString() + k -} - -fun box(): String { - return Test.invokeMethodWithOverloads() -} diff --git a/compiler/testData/codegen/boxWithJava/jvmOverloads/simple/simple.kt b/compiler/testData/codegen/boxWithJava/jvmOverloads/simple.kt similarity index 50% rename from compiler/testData/codegen/boxWithJava/jvmOverloads/simple/simple.kt rename to compiler/testData/codegen/boxWithJava/jvmOverloads/simple.kt index f09c10e1223..a0303197512 100644 --- a/compiler/testData/codegen/boxWithJava/jvmOverloads/simple/simple.kt +++ b/compiler/testData/codegen/boxWithJava/jvmOverloads/simple.kt @@ -1,3 +1,14 @@ +// FILE: Test.java + +public class Test { + public static String invokeMethodWithOverloads() { + C c = new C(); + return c.foo(); + } +} + +// FILE: simple.kt + class C { @kotlin.jvm.JvmOverloads public fun foo(o: String = "O", k: String = "K"): String = o + k } diff --git a/compiler/testData/codegen/boxWithJava/jvmOverloads/simple/Test.java b/compiler/testData/codegen/boxWithJava/jvmOverloads/simple/Test.java deleted file mode 100644 index 1ff372bd00d..00000000000 --- a/compiler/testData/codegen/boxWithJava/jvmOverloads/simple/Test.java +++ /dev/null @@ -1,6 +0,0 @@ -public class Test { - public static String invokeMethodWithOverloads() { - C c = new C(); - return c.foo(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/jvmStatic/annotations/Test.java b/compiler/testData/codegen/boxWithJava/jvmStatic/annotations.kt similarity index 62% rename from compiler/testData/codegen/boxWithJava/jvmStatic/annotations/Test.java rename to compiler/testData/codegen/boxWithJava/jvmStatic/annotations.kt index e207ad6cad1..9fe86d3c03b 100644 --- a/compiler/testData/codegen/boxWithJava/jvmStatic/annotations/Test.java +++ b/compiler/testData/codegen/boxWithJava/jvmStatic/annotations.kt @@ -1,3 +1,5 @@ +// FILE: Test.java + import java.lang.String; import java.lang.annotation.Annotation; @@ -26,3 +28,33 @@ class Test { } } + +// FILE: test.kt + +import kotlin.jvm.JvmStatic + +@Retention(AnnotationRetention.RUNTIME) +annotation class testAnnotation + +class A { + + companion object { + val b: String = "OK" + + @JvmStatic @testAnnotation fun test1() = b + } +} + +object B { + val b: String = "OK" + + @JvmStatic @testAnnotation fun test1() = b +} + +fun box(): String { + if (Test.test1() != "OK") return "fail 1" + + if (Test.test2() != "OK") return "fail 2" + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithJava/jvmStatic/annotations/simpleClassObject.kt b/compiler/testData/codegen/boxWithJava/jvmStatic/annotations/simpleClassObject.kt deleted file mode 100644 index 0447b4190f1..00000000000 --- a/compiler/testData/codegen/boxWithJava/jvmStatic/annotations/simpleClassObject.kt +++ /dev/null @@ -1,27 +0,0 @@ -import kotlin.jvm.JvmStatic - -@Retention(AnnotationRetention.RUNTIME) -annotation class testAnnotation - -class A { - - companion object { - val b: String = "OK" - - @JvmStatic @testAnnotation fun test1() = b - } -} - -object B { - val b: String = "OK" - - @JvmStatic @testAnnotation fun test1() = b -} - -fun box(): String { - if (Test.test1() != "OK") return "fail 1" - - if (Test.test2() != "OK") return "fail 2" - - return "OK" -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/jvmStatic/classObject/Test.java b/compiler/testData/codegen/boxWithJava/jvmStatic/classObject/Test.java deleted file mode 100644 index db8195b5106..00000000000 --- a/compiler/testData/codegen/boxWithJava/jvmStatic/classObject/Test.java +++ /dev/null @@ -1,19 +0,0 @@ -class Test { - - public static String test1() { - return A.test1(); - } - - public static String test2() { - return A.test2(); - } - - public static String test3() { - return A.test3("JAVA"); - } - - public static String test4() { - return A.getC(); - } - -} diff --git a/compiler/testData/codegen/boxWithJava/jvmStatic/classObject/simpleClassObject.kt b/compiler/testData/codegen/boxWithJava/jvmStatic/companionObject.kt similarity index 57% rename from compiler/testData/codegen/boxWithJava/jvmStatic/classObject/simpleClassObject.kt rename to compiler/testData/codegen/boxWithJava/jvmStatic/companionObject.kt index 72b3776dabf..13d937d9b4b 100644 --- a/compiler/testData/codegen/boxWithJava/jvmStatic/classObject/simpleClassObject.kt +++ b/compiler/testData/codegen/boxWithJava/jvmStatic/companionObject.kt @@ -1,4 +1,26 @@ -import kotlin.jvm.JvmStatic +// FILE: Test.java + +class Test { + + public static String test1() { + return A.test1(); + } + + public static String test2() { + return A.test2(); + } + + public static String test3() { + return A.test3("JAVA"); + } + + public static String test4() { + return A.getC(); + } + +} + +// FILE: simpleCompanionObject.kt class A { @@ -25,4 +47,4 @@ fun box(): String { if (Test.test4() != "OK") return "fail 4" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxWithJava/jvmStatic/enumCompanion/enumCompanionObject.kt b/compiler/testData/codegen/boxWithJava/jvmStatic/enumCompanion.kt similarity index 58% rename from compiler/testData/codegen/boxWithJava/jvmStatic/enumCompanion/enumCompanionObject.kt rename to compiler/testData/codegen/boxWithJava/jvmStatic/enumCompanion.kt index df900b3dfe6..857cd983d20 100644 --- a/compiler/testData/codegen/boxWithJava/jvmStatic/enumCompanion/enumCompanionObject.kt +++ b/compiler/testData/codegen/boxWithJava/jvmStatic/enumCompanion.kt @@ -1,3 +1,25 @@ +// FILE: Test.java + +class Test { + public static String foo() { + return A.foo; + } + + public static String constBar() { + return A.constBar; + } + + public static String getBar() { + return A.getBar(); + } + + public static String baz() { + return A.baz(); + } +} + +// FILE: enumCompanionObject.kt + import kotlin.jvm.JvmStatic enum class A { diff --git a/compiler/testData/codegen/boxWithJava/jvmStatic/enumCompanion/Test.java b/compiler/testData/codegen/boxWithJava/jvmStatic/enumCompanion/Test.java deleted file mode 100644 index 3a26873920f..00000000000 --- a/compiler/testData/codegen/boxWithJava/jvmStatic/enumCompanion/Test.java +++ /dev/null @@ -1,17 +0,0 @@ -class Test { - public static String foo() { - return A.foo; - } - - public static String constBar() { - return A.constBar; - } - - public static String getBar() { - return A.getBar(); - } - - public static String baz() { - return A.baz(); - } -} diff --git a/compiler/testData/codegen/boxWithJava/jvmStatic/object/simpleObject.kt b/compiler/testData/codegen/boxWithJava/jvmStatic/object.kt similarity index 56% rename from compiler/testData/codegen/boxWithJava/jvmStatic/object/simpleObject.kt rename to compiler/testData/codegen/boxWithJava/jvmStatic/object.kt index 0ed7a005f11..ae861722998 100644 --- a/compiler/testData/codegen/boxWithJava/jvmStatic/object/simpleObject.kt +++ b/compiler/testData/codegen/boxWithJava/jvmStatic/object.kt @@ -1,3 +1,27 @@ +// FILE: Test.java + +class Test { + + public static String test1() { + return A.test1(); + } + + public static String test2() { + return A.test2(); + } + + public static String test3() { + return A.test3("JAVA"); + } + + public static String test4() { + return A.getC(); + } + +} + +// FILE: simpleObject.kt + import kotlin.jvm.JvmStatic object A { @@ -23,4 +47,4 @@ fun box(): String { if (Test.test4() != "OK") return "fail 4" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxWithJava/jvmStatic/object/Test.java b/compiler/testData/codegen/boxWithJava/jvmStatic/object/Test.java deleted file mode 100644 index db8195b5106..00000000000 --- a/compiler/testData/codegen/boxWithJava/jvmStatic/object/Test.java +++ /dev/null @@ -1,19 +0,0 @@ -class Test { - - public static String test1() { - return A.test1(); - } - - public static String test2() { - return A.test2(); - } - - public static String test3() { - return A.test3("JAVA"); - } - - public static String test4() { - return A.getC(); - } - -} diff --git a/compiler/testData/codegen/boxWithJava/mangling/internalOverride.kt b/compiler/testData/codegen/boxWithJava/mangling.kt similarity index 63% rename from compiler/testData/codegen/boxWithJava/mangling/internalOverride.kt rename to compiler/testData/codegen/boxWithJava/mangling.kt index 62d0799db85..9dca5f60fd0 100644 --- a/compiler/testData/codegen/boxWithJava/mangling/internalOverride.kt +++ b/compiler/testData/codegen/boxWithJava/mangling.kt @@ -1,3 +1,13 @@ +// FILE: JavaClass.java + +public class JavaClass extends A { + public String test() { + return "Java"; + } +} + +// FILE: test.kt + open class A { internal open fun test(): String = "Kotlin" } @@ -8,4 +18,4 @@ fun box(): String { if (JavaClass().test() != "Java") return "fail 2: ${JavaClass().test()}" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxWithJava/mangling/JavaClass.java b/compiler/testData/codegen/boxWithJava/mangling/JavaClass.java deleted file mode 100644 index 24276d92581..00000000000 --- a/compiler/testData/codegen/boxWithJava/mangling/JavaClass.java +++ /dev/null @@ -1,5 +0,0 @@ -public class JavaClass extends A { - public String test() { - return "Java"; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/notNullAssertions/extensionReceiverParameter/Test.java b/compiler/testData/codegen/boxWithJava/notNullAssertions/extensionReceiverParameter.kt similarity index 73% rename from compiler/testData/codegen/boxWithJava/notNullAssertions/extensionReceiverParameter/Test.java rename to compiler/testData/codegen/boxWithJava/notNullAssertions/extensionReceiverParameter.kt index 793e6e2dad9..343266d93f0 100644 --- a/compiler/testData/codegen/boxWithJava/notNullAssertions/extensionReceiverParameter/Test.java +++ b/compiler/testData/codegen/boxWithJava/notNullAssertions/extensionReceiverParameter.kt @@ -1,3 +1,5 @@ +// FILE: Test.java + public class Test { public static String invokeFoo() { try { @@ -15,3 +17,13 @@ public class Test { return "Fail: assertion must have been fired"; } } + +// FILE: extension.kt + +fun Any.foo() { } + +val Any.bar: String get() = "" + +fun box(): String { + return Test.invokeFoo() +} diff --git a/compiler/testData/codegen/boxWithJava/notNullAssertions/extensionReceiverParameter/extension.kt b/compiler/testData/codegen/boxWithJava/notNullAssertions/extensionReceiverParameter/extension.kt deleted file mode 100644 index 465cb26e91a..00000000000 --- a/compiler/testData/codegen/boxWithJava/notNullAssertions/extensionReceiverParameter/extension.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun Any.foo() { } - -val Any.bar: String get() = "" - -fun box(): String { - return Test.invokeFoo() -} diff --git a/compiler/testData/codegen/boxWithJava/number/FortyTwoExtractor.kt b/compiler/testData/codegen/boxWithJava/number.kt similarity index 65% rename from compiler/testData/codegen/boxWithJava/number/FortyTwoExtractor.kt rename to compiler/testData/codegen/boxWithJava/number.kt index d08d9a00233..86572780b85 100644 --- a/compiler/testData/codegen/boxWithJava/number/FortyTwoExtractor.kt +++ b/compiler/testData/codegen/boxWithJava/number.kt @@ -1,3 +1,15 @@ +// FILE: FortyTwoExtractor.java + +public class FortyTwoExtractor { + private Number fortyTwo = new FortyTwo(); + + public int intValue() { + return fortyTwo.intValue(); + } +} + +// FILE: FortyTwoExtractor.kt + class FortyTwo : Number() { override fun toByte() = 42.toByte() @@ -18,4 +30,4 @@ fun box(): String { val extractor = FortyTwoExtractor() if (extractor.intValue() != 42) return "FAIL" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxWithJava/number/FortyTwoExtractor.java b/compiler/testData/codegen/boxWithJava/number/FortyTwoExtractor.java deleted file mode 100644 index 123c96689f4..00000000000 --- a/compiler/testData/codegen/boxWithJava/number/FortyTwoExtractor.java +++ /dev/null @@ -1,8 +0,0 @@ -public class FortyTwoExtractor { - private Number fortyTwo = new FortyTwo(); - - public int intValue() { - return fortyTwo.intValue(); - } -} - diff --git a/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty/JavaClass.java b/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty.kt similarity index 57% rename from compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty/JavaClass.java rename to compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty.kt index 36e889b6abd..12e90aca638 100644 --- a/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty/JavaClass.java +++ b/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty.kt @@ -1,3 +1,5 @@ +// FILE: JavaClass.java + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -13,4 +15,18 @@ public class JavaClass { return KotlinClass.FOO_STRING + JavaClass.class.getMethod("test").getAnnotation(Foo.class).value(); } -} \ No newline at end of file +} + +// FILE: kotlinClass.kt + +class KotlinClass { + companion object { + const val FOO_INT: Int = 10 + @JvmField val FOO_STRING: String = "OK" + } +} + +fun box(): String { + val test = JavaClass().test() + return if (test == "OK10") "OK" else "fail : $test" +} diff --git a/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty/kotlinClass.kt b/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty/kotlinClass.kt deleted file mode 100644 index a03d7156cf3..00000000000 --- a/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty/kotlinClass.kt +++ /dev/null @@ -1,11 +0,0 @@ -class KotlinClass { - companion object { - const val FOO_INT: Int = 10 - @JvmField val FOO_STRING: String = "OK" - } -} - -fun box(): String { - val test = JavaClass().test() - return if (test == "OK10") "OK" else "fail : $test" -} diff --git a/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinPropertyFromInterfaceCompanion/JavaClass.java b/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinPropertyFromInterfaceCompanion.kt similarity index 57% rename from compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinPropertyFromInterfaceCompanion/JavaClass.java rename to compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinPropertyFromInterfaceCompanion.kt index df79bb0b350..9a223f8ab16 100644 --- a/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinPropertyFromInterfaceCompanion/JavaClass.java +++ b/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinPropertyFromInterfaceCompanion.kt @@ -1,3 +1,5 @@ +// FILE: JavaClass.java + import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -13,4 +15,18 @@ public class JavaClass { return KotlinInterface.FOO_STRING + JavaClass.class.getMethod("test").getAnnotation(Foo.class).value(); } -} \ No newline at end of file +} + +// FILE: KotlinInterface.kt + +interface KotlinInterface { + companion object { + const val FOO_INT: Int = 10 + const val FOO_STRING: String = "OK" + } +} + +fun box(): String { + val test = JavaClass().test() + return if (test == "OK10") "OK" else "fail : $test" +} diff --git a/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinPropertyFromInterfaceCompanion/KotlinInterface.kt b/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinPropertyFromInterfaceCompanion/KotlinInterface.kt deleted file mode 100644 index 0aca6fad078..00000000000 --- a/compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinPropertyFromInterfaceCompanion/KotlinInterface.kt +++ /dev/null @@ -1,11 +0,0 @@ -interface KotlinInterface { - companion object { - const val FOO_INT: Int = 10 - const val FOO_STRING: String = "OK" - } -} - -fun box(): String { - val test = JavaClass().test() - return if (test == "OK10") "OK" else "fail : $test" -} diff --git a/compiler/testData/codegen/boxWithJava/properties/classObjectProperties/classObjectProperties.kt b/compiler/testData/codegen/boxWithJava/properties/classObjectProperties/classObjectProperties.kt deleted file mode 100644 index 29ef9f2fead..00000000000 --- a/compiler/testData/codegen/boxWithJava/properties/classObjectProperties/classObjectProperties.kt +++ /dev/null @@ -1,22 +0,0 @@ -class Klass { - companion object { - const val NAME = "Klass" - @JvmField val JVM_NAME = "JvmKlass" - } -} - -interface Trait { - companion object { - const val NAME = "Trait" - } -} - -enum class Enoom { - ; - companion object { - const val NAME = "Enum" - @JvmField val JVM_NAME = "JvmEnum" - } -} - -fun box() = Test().test() diff --git a/compiler/testData/codegen/boxWithJava/properties/collectionSize/collectionSize.kt b/compiler/testData/codegen/boxWithJava/properties/collectionSize.kt similarity index 59% rename from compiler/testData/codegen/boxWithJava/properties/collectionSize/collectionSize.kt rename to compiler/testData/codegen/boxWithJava/properties/collectionSize.kt index 651f7ac015d..7ea71595d41 100644 --- a/compiler/testData/codegen/boxWithJava/properties/collectionSize/collectionSize.kt +++ b/compiler/testData/codegen/boxWithJava/properties/collectionSize.kt @@ -1,3 +1,12 @@ +// FILE: Test.java + +public class Test extends java.util.ArrayList { + public final int size() { + return 56; + } +} + +// FILE: test.kt class OurTest : Test() diff --git a/compiler/testData/codegen/boxWithJava/properties/collectionSize/Test.java b/compiler/testData/codegen/boxWithJava/properties/collectionSize/Test.java deleted file mode 100644 index d7ffd983187..00000000000 --- a/compiler/testData/codegen/boxWithJava/properties/collectionSize/Test.java +++ /dev/null @@ -1,5 +0,0 @@ -public class Test extends java.util.ArrayList { - public final int size() { - return 56; - } -} diff --git a/compiler/testData/codegen/boxWithJava/properties/commonProperties/commonProperties.kt b/compiler/testData/codegen/boxWithJava/properties/commonProperties.kt similarity index 80% rename from compiler/testData/codegen/boxWithJava/properties/commonProperties/commonProperties.kt rename to compiler/testData/codegen/boxWithJava/properties/commonProperties.kt index b8efdb806eb..dd68a1278b9 100644 --- a/compiler/testData/codegen/boxWithJava/properties/commonProperties/commonProperties.kt +++ b/compiler/testData/codegen/boxWithJava/properties/commonProperties.kt @@ -1,3 +1,32 @@ +// FILE: J.java + +public class J extends A { + + public boolean okField = false; + + public int getValProp() { + return 123; + } + + public int getVarProp() { + return 456; + } + + public void setVarProp(int x) { + okField = true; + } + + public int isProp() { + return 789; + } + + public void setProp(int x) { + okField = true; + } +} + +// FILE: test.kt + open class A { open val valProp: Int = -1 open var varProp: Int = -1 diff --git a/compiler/testData/codegen/boxWithJava/properties/commonProperties/J.java b/compiler/testData/codegen/boxWithJava/properties/commonProperties/J.java deleted file mode 100644 index 675f3fc9cb3..00000000000 --- a/compiler/testData/codegen/boxWithJava/properties/commonProperties/J.java +++ /dev/null @@ -1,24 +0,0 @@ -public class J extends A { - - public boolean okField = false; - - public int getValProp() { - return 123; - } - - public int getVarProp() { - return 456; - } - - public void setVarProp(int x) { - okField = true; - } - - public int isProp() { - return 789; - } - - public void setProp(int x) { - okField = true; - } -} diff --git a/compiler/testData/codegen/boxWithJava/properties/classObjectProperties/Test.java b/compiler/testData/codegen/boxWithJava/properties/companionObjectProperties.kt similarity index 60% rename from compiler/testData/codegen/boxWithJava/properties/classObjectProperties/Test.java rename to compiler/testData/codegen/boxWithJava/properties/companionObjectProperties.kt index fe3d92a9f84..385f8a0896f 100644 --- a/compiler/testData/codegen/boxWithJava/properties/classObjectProperties/Test.java +++ b/compiler/testData/codegen/boxWithJava/properties/companionObjectProperties.kt @@ -1,3 +1,5 @@ +// FILE: Test.java + class Test { String test() { String s; @@ -20,3 +22,28 @@ class Test { return "OK"; } } + +// FILE: test.kt + +class Klass { + companion object { + const val NAME = "Klass" + @JvmField val JVM_NAME = "JvmKlass" + } +} + +interface Trait { + companion object { + const val NAME = "Trait" + } +} + +enum class Enoom { + ; + companion object { + const val NAME = "Enum" + @JvmField val JVM_NAME = "JvmEnum" + } +} + +fun box() = Test().test() diff --git a/compiler/testData/codegen/boxWithJava/properties/protectedJavaProperty/kotlin.kt b/compiler/testData/codegen/boxWithJava/properties/protectedJavaProperty.kt similarity index 55% rename from compiler/testData/codegen/boxWithJava/properties/protectedJavaProperty/kotlin.kt rename to compiler/testData/codegen/boxWithJava/properties/protectedJavaProperty.kt index bdff5813b26..c6c0a16780a 100644 --- a/compiler/testData/codegen/boxWithJava/properties/protectedJavaProperty/kotlin.kt +++ b/compiler/testData/codegen/boxWithJava/properties/protectedJavaProperty.kt @@ -1,3 +1,20 @@ +// FILE: JavaBaseClass.java + +public class JavaBaseClass { + + private String field = "fail"; + + protected String getFoo() { + return field; + } + + protected void setFoo(String foo) { + field = foo; + } +} + +// FILE: kotlin.kt + package z import JavaBaseClass @@ -16,4 +33,4 @@ fun runSlowly(f: () -> String): String { fun box(): String { return KotlinExtender.test() -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxWithJava/properties/protectedJavaProperty/JavaBaseClass.java b/compiler/testData/codegen/boxWithJava/properties/protectedJavaProperty/JavaBaseClass.java deleted file mode 100644 index d68097f4239..00000000000 --- a/compiler/testData/codegen/boxWithJava/properties/protectedJavaProperty/JavaBaseClass.java +++ /dev/null @@ -1,12 +0,0 @@ -public class JavaBaseClass { - - private String field = "fail"; - - protected String getFoo() { - return field; - } - - protected void setFoo(String foo) { - field = foo; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/properties/protectedJavaPropertyInCompanion/kotlin.kt b/compiler/testData/codegen/boxWithJava/properties/protectedJavaPropertyInCompanion.kt similarity index 64% rename from compiler/testData/codegen/boxWithJava/properties/protectedJavaPropertyInCompanion/kotlin.kt rename to compiler/testData/codegen/boxWithJava/properties/protectedJavaPropertyInCompanion.kt index c2bd125c81e..99d6f8e15f3 100644 --- a/compiler/testData/codegen/boxWithJava/properties/protectedJavaPropertyInCompanion/kotlin.kt +++ b/compiler/testData/codegen/boxWithJava/properties/protectedJavaPropertyInCompanion.kt @@ -1,3 +1,20 @@ +// FILE: JavaBaseClass.java + +public class JavaBaseClass { + + private String field = "fail"; + + protected String getFoo() { + return field; + } + + protected void setFoo(String foo) { + field = foo; + } +} + +// FILE: kotlin.kt + package z import JavaBaseClass @@ -24,4 +41,4 @@ fun box(): String { if (a.foo != "Kotlin") return "fail" return A.test() -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxWithJava/properties/protectedJavaPropertyInCompanion/JavaBaseClass.java b/compiler/testData/codegen/boxWithJava/properties/protectedJavaPropertyInCompanion/JavaBaseClass.java deleted file mode 100644 index d68097f4239..00000000000 --- a/compiler/testData/codegen/boxWithJava/properties/protectedJavaPropertyInCompanion/JavaBaseClass.java +++ /dev/null @@ -1,12 +0,0 @@ -public class JavaBaseClass { - - private String field = "fail"; - - protected String getFoo() { - return field; - } - - protected void setFoo(String foo) { - field = foo; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/properties/substituteJavaSuperField/substituteJavaSuperField.kt b/compiler/testData/codegen/boxWithJava/properties/substituteJavaSuperField.kt similarity index 55% rename from compiler/testData/codegen/boxWithJava/properties/substituteJavaSuperField/substituteJavaSuperField.kt rename to compiler/testData/codegen/boxWithJava/properties/substituteJavaSuperField.kt index 37b781bab5b..dc97cae19cd 100644 --- a/compiler/testData/codegen/boxWithJava/properties/substituteJavaSuperField/substituteJavaSuperField.kt +++ b/compiler/testData/codegen/boxWithJava/properties/substituteJavaSuperField.kt @@ -1,3 +1,11 @@ +// FILE: Test.java + +public abstract class Test { + protected final F value = null; +} + +// FILE: test.kt + class A : Test() { fun foo(): String? = value } diff --git a/compiler/testData/codegen/boxWithJava/properties/substituteJavaSuperField/Test.java b/compiler/testData/codegen/boxWithJava/properties/substituteJavaSuperField/Test.java deleted file mode 100644 index 2bc5113a515..00000000000 --- a/compiler/testData/codegen/boxWithJava/properties/substituteJavaSuperField/Test.java +++ /dev/null @@ -1,3 +0,0 @@ -public abstract class Test { - protected final F value = null; -} diff --git a/compiler/testData/codegen/boxWithJava/protectedInInline.kt b/compiler/testData/codegen/boxWithJava/protectedInInline.kt new file mode 100644 index 00000000000..2242fce00ec --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/protectedInInline.kt @@ -0,0 +1,19 @@ +// FILE: JavaClass.java + +public class JavaClass { + + protected String FIELD = "OK"; + +} + +// FILE: Kotlin.kt + +package test + +import JavaClass + +class B : JavaClass() { + inline fun bar() = FIELD +} + +fun box() = B().bar() diff --git a/compiler/testData/codegen/boxWithJava/protectedInInline/JavaClass.java b/compiler/testData/codegen/boxWithJava/protectedInInline/JavaClass.java deleted file mode 100644 index 346dff3f2f0..00000000000 --- a/compiler/testData/codegen/boxWithJava/protectedInInline/JavaClass.java +++ /dev/null @@ -1,5 +0,0 @@ -public class JavaClass { - - protected String FIELD = "OK"; - -} diff --git a/compiler/testData/codegen/boxWithJava/protectedInInline/Kotlin.kt b/compiler/testData/codegen/boxWithJava/protectedInInline/Kotlin.kt deleted file mode 100644 index c79521acae2..00000000000 --- a/compiler/testData/codegen/boxWithJava/protectedInInline/Kotlin.kt +++ /dev/null @@ -1,9 +0,0 @@ -package test - -import JavaClass - -class B : JavaClass() { - inline fun bar() = FIELD -} - -fun box() = B().bar() \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/reflection/annotationsOnJavaMembers/K.kt b/compiler/testData/codegen/boxWithJava/reflection/annotationsOnJavaMembers.kt similarity index 65% rename from compiler/testData/codegen/boxWithJava/reflection/annotationsOnJavaMembers/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/annotationsOnJavaMembers.kt index adfaa64d385..4947956755a 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/annotationsOnJavaMembers/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/annotationsOnJavaMembers.kt @@ -1,3 +1,19 @@ +// FILE: J.java + +@Anno("J") +public class J { + @Anno("foo") + public static int foo = 42; + + @Anno("bar") + public static void bar() {} + + @Anno("constructor") + public J() {} +} + +// FILE: K.kt + import kotlin.test.assertEquals annotation class Anno(val value: String) diff --git a/compiler/testData/codegen/boxWithJava/reflection/annotationsOnJavaMembers/J.java b/compiler/testData/codegen/boxWithJava/reflection/annotationsOnJavaMembers/J.java deleted file mode 100644 index 6bf42851cf0..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/annotationsOnJavaMembers/J.java +++ /dev/null @@ -1,11 +0,0 @@ -@Anno("J") -public class J { - @Anno("foo") - public static int foo = 42; - - @Anno("bar") - public static void bar() {} - - @Anno("constructor") - public J() {} -} diff --git a/compiler/testData/codegen/boxWithJava/reflection/callInstanceJavaMethod/K.kt b/compiler/testData/codegen/boxWithJava/reflection/callInstanceJavaMethod.kt similarity index 62% rename from compiler/testData/codegen/boxWithJava/reflection/callInstanceJavaMethod/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/callInstanceJavaMethod.kt index c23aa185150..b02cf4892eb 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/callInstanceJavaMethod/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/callInstanceJavaMethod.kt @@ -1,3 +1,19 @@ +// FILE: J.java + +public class J { + private final int param; + + public J(int param) { + this.param = param; + } + + public String foo(int[] arr, Object[] arr2, Integer y) { + return "" + param + arr[0] + arr2[0] + y; + } +} + +// FILE: K.kt + import kotlin.reflect.jvm.* import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/boxWithJava/reflection/callInstanceJavaMethod/J.java b/compiler/testData/codegen/boxWithJava/reflection/callInstanceJavaMethod/J.java deleted file mode 100644 index 850e468878b..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/callInstanceJavaMethod/J.java +++ /dev/null @@ -1,11 +0,0 @@ -public class J { - private final int param; - - public J(int param) { - this.param = param; - } - - public String foo(int[] arr, Object[] arr2, Integer y) { - return "" + param + arr[0] + arr2[0] + y; - } -} diff --git a/compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod/K.kt b/compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod.kt similarity index 72% rename from compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod.kt index 874c862d488..5ce51bff71a 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod.kt @@ -1,3 +1,19 @@ +// FILE: J.java + +public class J { + private final String result; + + private J(String result) { + this.result = result; + } + + private String getResult() { + return result; + } +} + +// FILE: K.kt + import kotlin.reflect.* import kotlin.reflect.jvm.* import kotlin.test.* diff --git a/compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod/J.java b/compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod/J.java deleted file mode 100644 index 55a31a8667d..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod/J.java +++ /dev/null @@ -1,11 +0,0 @@ -public class J { - private final String result; - - private J(String result) { - this.result = result; - } - - private String getResult() { - return result; - } -} diff --git a/compiler/testData/codegen/boxWithJava/reflection/callStaticJavaMethod/K.kt b/compiler/testData/codegen/boxWithJava/reflection/callStaticJavaMethod.kt similarity index 69% rename from compiler/testData/codegen/boxWithJava/reflection/callStaticJavaMethod/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/callStaticJavaMethod.kt index dae545428f9..9121ae15c50 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/callStaticJavaMethod/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/callStaticJavaMethod.kt @@ -1,3 +1,13 @@ +// FILE: J.java + +public class J { + public static String foo(int x, int[] arr, Object[] arr2) { + return "" + x + arr[0] + arr2[0]; + } +} + +// FILE: K.kt + import kotlin.reflect.jvm.* import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/boxWithJava/reflection/callStaticJavaMethod/J.java b/compiler/testData/codegen/boxWithJava/reflection/callStaticJavaMethod/J.java deleted file mode 100644 index 296781a4fef..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/callStaticJavaMethod/J.java +++ /dev/null @@ -1,5 +0,0 @@ -public class J { - public static String foo(int x, int[] arr, Object[] arr2) { - return "" + x + arr[0] + arr2[0]; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedFunctions/K.kt b/compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedFunctions.kt similarity index 91% rename from compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedFunctions/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedFunctions.kt index c56a8d37967..2260351e564 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedFunctions/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedFunctions.kt @@ -1,3 +1,14 @@ +// FILE: J.java + +public class J { + public void publicMemberJ() {} + private void privateMemberJ() {} + public static void publicStaticJ() {} + private static void privateStaticJ() {} +} + +// FILE: K.kt + import kotlin.reflect.* import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedFunctions/J.java b/compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedFunctions/J.java deleted file mode 100644 index 19d0543fb14..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedFunctions/J.java +++ /dev/null @@ -1,6 +0,0 @@ -public class J { - public void publicMemberJ() {} - private void privateMemberJ() {} - public static void publicStaticJ() {} - private static void privateStaticJ() {} -} diff --git a/compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedProperties/K.kt b/compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedProperties.kt similarity index 89% rename from compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedProperties/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedProperties.kt index f4c6cdd8ecf..1a21b4b0cd9 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedProperties/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedProperties.kt @@ -1,3 +1,14 @@ +// FILE: J.java + +public class J { + public String publicMemberJ; + private String privateMemberJ; + public static String publicStaticJ; + private static String privateStaticJ; +} + +// FILE: K.kt + import kotlin.reflect.* import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedProperties/J.java b/compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedProperties/J.java deleted file mode 100644 index 58db865e2e7..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedProperties/J.java +++ /dev/null @@ -1,6 +0,0 @@ -public class J { - public String publicMemberJ; - private String privateMemberJ; - public static String publicStaticJ; - private static String privateStaticJ; -} diff --git a/compiler/testData/codegen/boxWithJava/reflection/functionReferenceErasedToKFunction/J.java b/compiler/testData/codegen/boxWithJava/reflection/functionReferenceErasedToKFunction.kt similarity index 55% rename from compiler/testData/codegen/boxWithJava/reflection/functionReferenceErasedToKFunction/J.java rename to compiler/testData/codegen/boxWithJava/reflection/functionReferenceErasedToKFunction.kt index 100310e99de..d7096212f86 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/functionReferenceErasedToKFunction/J.java +++ b/compiler/testData/codegen/boxWithJava/reflection/functionReferenceErasedToKFunction.kt @@ -1,3 +1,5 @@ +// FILE: J.java + import kotlin.jvm.functions.Function2; import kotlin.reflect.KFunction; @@ -8,3 +10,19 @@ public class J { return (String) result; } } + +// FILE: K.kt + +class K { + fun reverse(s: String): String { + return s.reversed() + } + + companion object { + fun getRef() = K::reverse + } +} + +fun box(): String { + return J.go() +} diff --git a/compiler/testData/codegen/boxWithJava/reflection/functionReferenceErasedToKFunction/K.kt b/compiler/testData/codegen/boxWithJava/reflection/functionReferenceErasedToKFunction/K.kt deleted file mode 100644 index fdc08268557..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/functionReferenceErasedToKFunction/K.kt +++ /dev/null @@ -1,13 +0,0 @@ -class K { - fun reverse(s: String): String { - return s.reversed() - } - - companion object { - fun getRef() = K::reverse - } -} - -fun box(): String { - return J.go() -} diff --git a/compiler/testData/codegen/boxWithJava/reflection/javaClassGetFunctions/K.kt b/compiler/testData/codegen/boxWithJava/reflection/javaClassGetFunctions.kt similarity index 75% rename from compiler/testData/codegen/boxWithJava/reflection/javaClassGetFunctions/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/javaClassGetFunctions.kt index 238668dd38c..8b06ce6459e 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/javaClassGetFunctions/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/javaClassGetFunctions.kt @@ -1,3 +1,18 @@ +// FILE: J.java + +public class J { + public J() { + } + + public void member(String s) { + } + + public static void staticMethod(int x) { + } +} + +// FILE: K.kt + import kotlin.reflect.* import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/boxWithJava/reflection/javaClassGetFunctions/J.java b/compiler/testData/codegen/boxWithJava/reflection/javaClassGetFunctions/J.java deleted file mode 100644 index e825ba543c3..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/javaClassGetFunctions/J.java +++ /dev/null @@ -1,10 +0,0 @@ -public class J { - public J() { - } - - public void member(String s) { - } - - public static void staticMethod(int x) { - } -} diff --git a/compiler/testData/codegen/boxWithJava/reflection/javaMethodsSmokeTest/J.java b/compiler/testData/codegen/boxWithJava/reflection/javaMethodsSmokeTest.kt similarity index 59% rename from compiler/testData/codegen/boxWithJava/reflection/javaMethodsSmokeTest/J.java rename to compiler/testData/codegen/boxWithJava/reflection/javaMethodsSmokeTest.kt index 975e4890ddf..0ecb2875573 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/javaMethodsSmokeTest/J.java +++ b/compiler/testData/codegen/boxWithJava/reflection/javaMethodsSmokeTest.kt @@ -1,3 +1,5 @@ +// FILE: J.java + import java.util.List; public class J { @@ -23,3 +25,23 @@ public class J { List l, List m ) {} } + +// FILE: K.kt + +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/javaMethodsSmokeTest/K.kt b/compiler/testData/codegen/boxWithJava/reflection/javaMethodsSmokeTest/K.kt deleted file mode 100644 index e162e1fdfe3..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/javaMethodsSmokeTest/K.kt +++ /dev/null @@ -1,17 +0,0 @@ -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/javaPropertyInheritedInKotlin/K.kt b/compiler/testData/codegen/boxWithJava/reflection/javaPropertyInheritedInKotlin.kt similarity index 64% rename from compiler/testData/codegen/boxWithJava/reflection/javaPropertyInheritedInKotlin/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/javaPropertyInheritedInKotlin.kt index 3baf0015d15..318b0da999e 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/javaPropertyInheritedInKotlin/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/javaPropertyInheritedInKotlin.kt @@ -1,3 +1,11 @@ +// FILE: J.java + +public class J { + public String result = null; +} + +// FILE: K.kt + class K : J() fun box(): String { diff --git a/compiler/testData/codegen/boxWithJava/reflection/javaPropertyInheritedInKotlin/J.java b/compiler/testData/codegen/boxWithJava/reflection/javaPropertyInheritedInKotlin/J.java deleted file mode 100644 index e852bb0bc83..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/javaPropertyInheritedInKotlin/J.java +++ /dev/null @@ -1,3 +0,0 @@ -public class J { - public String result = null; -} diff --git a/compiler/testData/codegen/boxWithJava/reflection/javaStaticField/K.kt b/compiler/testData/codegen/boxWithJava/reflection/javaStaticField.kt similarity index 78% rename from compiler/testData/codegen/boxWithJava/reflection/javaStaticField/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/javaStaticField.kt index 9055ef9c1a1..1f40ab18c87 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/javaStaticField/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/javaStaticField.kt @@ -1,3 +1,11 @@ +// FILE: J.java + +public class J { + static String x; +} + +// FILE: K.kt + import kotlin.test.assertEquals fun box(): String { diff --git a/compiler/testData/codegen/boxWithJava/reflection/javaStaticField/J.java b/compiler/testData/codegen/boxWithJava/reflection/javaStaticField/J.java deleted file mode 100644 index 00317c601f4..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/javaStaticField/J.java +++ /dev/null @@ -1,3 +0,0 @@ -public class J { - static String x; -} diff --git a/compiler/testData/codegen/boxWithJava/reflection/kotlinPropertyInheritedInJava/K.kt b/compiler/testData/codegen/boxWithJava/reflection/kotlinPropertyInheritedInJava.kt similarity index 96% rename from compiler/testData/codegen/boxWithJava/reflection/kotlinPropertyInheritedInJava/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/kotlinPropertyInheritedInJava.kt index ef982e72349..8a08b664ab5 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/kotlinPropertyInheritedInJava/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/kotlinPropertyInheritedInJava.kt @@ -1,3 +1,10 @@ +// FILE: J.java + +public class J extends K { +} + +// FILE: K.kt + import kotlin.reflect.* import kotlin.reflect.jvm.* diff --git a/compiler/testData/codegen/boxWithJava/reflection/kotlinPropertyInheritedInJava/J.java b/compiler/testData/codegen/boxWithJava/reflection/kotlinPropertyInheritedInJava/J.java deleted file mode 100644 index 7d75ade1df2..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/kotlinPropertyInheritedInJava/J.java +++ /dev/null @@ -1,2 +0,0 @@ -public class J extends K { -} diff --git a/compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaInstanceField/K.kt b/compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaInstanceField.kt similarity index 73% rename from compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaInstanceField/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaInstanceField.kt index 3365f880f9e..16030d194a5 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaInstanceField/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaInstanceField.kt @@ -1,3 +1,11 @@ +// FILE: J.java + +public class J { + private String result = "Fail"; +} + +// FILE: K.kt + import kotlin.reflect.* import kotlin.reflect.jvm.* diff --git a/compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaInstanceField/J.java b/compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaInstanceField/J.java deleted file mode 100644 index 4027c1cedd5..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaInstanceField/J.java +++ /dev/null @@ -1,3 +0,0 @@ -public class J { - private String result = "Fail"; -} diff --git a/compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaStaticField/K.kt b/compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaStaticField.kt similarity index 71% rename from compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaStaticField/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaStaticField.kt index 14a60a22c27..3d853c18d6a 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaStaticField/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaStaticField.kt @@ -1,3 +1,11 @@ +// FILE: J.java + +public class J { + private static String result = "Fail"; +} + +// FILE: K.kt + import kotlin.reflect.* import kotlin.reflect.jvm.* diff --git a/compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaStaticField/J.java b/compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaStaticField/J.java deleted file mode 100644 index 6403ad28ce0..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaStaticField/J.java +++ /dev/null @@ -1,3 +0,0 @@ -public class J { - private static String result = "Fail"; -} diff --git a/compiler/testData/codegen/boxWithJava/reflection/nestedClasses/J.java b/compiler/testData/codegen/boxWithJava/reflection/nestedClasses.kt similarity index 51% rename from compiler/testData/codegen/boxWithJava/reflection/nestedClasses/J.java rename to compiler/testData/codegen/boxWithJava/reflection/nestedClasses.kt index 212f25c946d..4ccd0f612ec 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/nestedClasses/J.java +++ b/compiler/testData/codegen/boxWithJava/reflection/nestedClasses.kt @@ -1,3 +1,5 @@ +// FILE: J.java + public class J { public class Inner {} @@ -8,3 +10,13 @@ public class J { // This anonymous class should not appear in 'nestedClasses' private final Object o = new Object() {}; } + +// FILE: K.kt + +import kotlin.test.assertEquals + +fun box(): String { + assertEquals(listOf("Inner", "Nested", "PrivateNested"), J::class.nestedClasses.map { it.simpleName!! }.sorted()) + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithJava/reflection/nestedClasses/K.kt b/compiler/testData/codegen/boxWithJava/reflection/nestedClasses/K.kt deleted file mode 100644 index 5dfe7b77ae5..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/nestedClasses/K.kt +++ /dev/null @@ -1,7 +0,0 @@ -import kotlin.test.assertEquals - -fun box(): String { - assertEquals(listOf("Inner", "Nested", "PrivateNested"), J::class.nestedClasses.map { it.simpleName!! }.sorted()) - - return "OK" -} diff --git a/compiler/testData/codegen/boxWithJava/reflection/noConflictOnKotlinGetterAndJavaField/K.kt b/compiler/testData/codegen/boxWithJava/reflection/noConflictOnKotlinGetterAndJavaField.kt similarity index 82% rename from compiler/testData/codegen/boxWithJava/reflection/noConflictOnKotlinGetterAndJavaField/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/noConflictOnKotlinGetterAndJavaField.kt index d78c60c8661..ffd0b270986 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/noConflictOnKotlinGetterAndJavaField/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/noConflictOnKotlinGetterAndJavaField.kt @@ -1,3 +1,11 @@ +// FILE: J.java + +public class J { + public String foo = ""; +} + +// FILE: K.kt + import kotlin.test.* class K : J() { diff --git a/compiler/testData/codegen/boxWithJava/reflection/noConflictOnKotlinGetterAndJavaField/J.java b/compiler/testData/codegen/boxWithJava/reflection/noConflictOnKotlinGetterAndJavaField/J.java deleted file mode 100644 index c081e6d25cf..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/noConflictOnKotlinGetterAndJavaField/J.java +++ /dev/null @@ -1,3 +0,0 @@ -public class J { - public String foo = ""; -} diff --git a/compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames/K.kt b/compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames.kt similarity index 65% rename from compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames.kt index b3f6eecd696..930dde99cb3 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames.kt @@ -1,3 +1,13 @@ +// FILE: J.java + +public class J { + void foo(String s, int i) {} + + static void bar(J j) {} +} + +// FILE: K.kt + import kotlin.test.assertEquals fun box(): String { diff --git a/compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames/J.java b/compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames/J.java deleted file mode 100644 index 18cd4e12e6a..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames/J.java +++ /dev/null @@ -1,5 +0,0 @@ -public class J { - void foo(String s, int i) {} - - static void bar(J j) {} -} diff --git a/compiler/testData/codegen/boxWithJava/reflection/platformTypeNotEqualToKotlinType/K.kt b/compiler/testData/codegen/boxWithJava/reflection/platformTypeNotEqualToKotlinType.kt similarity index 71% rename from compiler/testData/codegen/boxWithJava/reflection/platformTypeNotEqualToKotlinType/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/platformTypeNotEqualToKotlinType.kt index 9c90ecfb1d8..8980cd4d7ab 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/platformTypeNotEqualToKotlinType/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/platformTypeNotEqualToKotlinType.kt @@ -1,3 +1,13 @@ +// FILE: J.java + +public class J { + public static String foo() { + return ""; + } +} + +// FILE: K.kt + import kotlin.test.assertNotEquals fun nonNullString(): String = "" diff --git a/compiler/testData/codegen/boxWithJava/reflection/platformTypeNotEqualToKotlinType/J.java b/compiler/testData/codegen/boxWithJava/reflection/platformTypeNotEqualToKotlinType/J.java deleted file mode 100644 index ef7ec61093c..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/platformTypeNotEqualToKotlinType/J.java +++ /dev/null @@ -1,5 +0,0 @@ -public class J { - public static String foo() { - return ""; - } -} diff --git a/compiler/testData/codegen/boxWithJava/reflection/platformTypeToString/K.kt b/compiler/testData/codegen/boxWithJava/reflection/platformTypeToString.kt similarity index 53% rename from compiler/testData/codegen/boxWithJava/reflection/platformTypeToString/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/platformTypeToString.kt index 20f74b537ab..89a5ab0403c 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/platformTypeToString/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/platformTypeToString.kt @@ -1,3 +1,19 @@ +// FILE: J.java + +import java.util.List; + +public class J { + public static String string() { + return ""; + } + + public static List list() { + return null; + } +} + +// FILE: K.kt + import kotlin.test.assertEquals fun box(): String { diff --git a/compiler/testData/codegen/boxWithJava/reflection/platformTypeToString/J.java b/compiler/testData/codegen/boxWithJava/reflection/platformTypeToString/J.java deleted file mode 100644 index f1774740e19..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/platformTypeToString/J.java +++ /dev/null @@ -1,11 +0,0 @@ -import java.util.List; - -public class J { - public static String string() { - return ""; - } - - public static List list() { - return null; - } -} diff --git a/compiler/testData/codegen/boxWithJava/reflection/referenceToJavaFieldOfKotlinSubclass/K.kt b/compiler/testData/codegen/boxWithJava/reflection/referenceToJavaFieldOfKotlinSubclass.kt similarity index 58% rename from compiler/testData/codegen/boxWithJava/reflection/referenceToJavaFieldOfKotlinSubclass/K.kt rename to compiler/testData/codegen/boxWithJava/reflection/referenceToJavaFieldOfKotlinSubclass.kt index 77f1ede74ec..200d01265a7 100644 --- a/compiler/testData/codegen/boxWithJava/reflection/referenceToJavaFieldOfKotlinSubclass/K.kt +++ b/compiler/testData/codegen/boxWithJava/reflection/referenceToJavaFieldOfKotlinSubclass.kt @@ -1,3 +1,11 @@ +// FILE: J.java + +public class J extends K { + public final int value = 42; +} + +// FILE: K.kt + open class K fun box(): String { diff --git a/compiler/testData/codegen/boxWithJava/reflection/referenceToJavaFieldOfKotlinSubclass/J.java b/compiler/testData/codegen/boxWithJava/reflection/referenceToJavaFieldOfKotlinSubclass/J.java deleted file mode 100644 index 9e92f8601ef..00000000000 --- a/compiler/testData/codegen/boxWithJava/reflection/referenceToJavaFieldOfKotlinSubclass/J.java +++ /dev/null @@ -1,3 +0,0 @@ -public class J extends K { - public final int value = 42; -} diff --git a/compiler/testData/codegen/boxWithJava/reified/asCheck/kotlin.kt b/compiler/testData/codegen/boxWithJava/reified/asCheck.kt similarity index 59% rename from compiler/testData/codegen/boxWithJava/reified/asCheck/kotlin.kt rename to compiler/testData/codegen/boxWithJava/reified/asCheck.kt index 1b9f417c06e..cb2629ad128 100644 --- a/compiler/testData/codegen/boxWithJava/reified/asCheck/kotlin.kt +++ b/compiler/testData/codegen/boxWithJava/reified/asCheck.kt @@ -1,3 +1,19 @@ +// FILE: JavaClass.java + +public class JavaClass { + + public static String nullString() { + return null; + } + + public static String nonnullString() { + return "OK"; + } + +} + +// FILE: kotlin.kt + fun box(): String { val nullStr = JavaClass.nullString() val nonnullStr = JavaClass.nonnullString() @@ -13,4 +29,4 @@ fun box(): String { inline fun T.foo(): T = this as T -inline fun T.fooN(): T? = this as T? \ No newline at end of file +inline fun T.fooN(): T? = this as T? diff --git a/compiler/testData/codegen/boxWithJava/reified/asCheck/JavaClass.java b/compiler/testData/codegen/boxWithJava/reified/asCheck/JavaClass.java deleted file mode 100644 index ac3dfc287c2..00000000000 --- a/compiler/testData/codegen/boxWithJava/reified/asCheck/JavaClass.java +++ /dev/null @@ -1,11 +0,0 @@ -public class JavaClass { - - public static String nullString() { - return null; - } - - public static String nonnullString() { - return "OK"; - } - -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/reified/isCheck/kotlin.kt b/compiler/testData/codegen/boxWithJava/reified/isCheck.kt similarity index 58% rename from compiler/testData/codegen/boxWithJava/reified/isCheck/kotlin.kt rename to compiler/testData/codegen/boxWithJava/reified/isCheck.kt index 39b4128cc93..84497d9425f 100644 --- a/compiler/testData/codegen/boxWithJava/reified/isCheck/kotlin.kt +++ b/compiler/testData/codegen/boxWithJava/reified/isCheck.kt @@ -1,3 +1,19 @@ +// FILE: JavaClass.java + +public class JavaClass { + + public static String nullString() { + return null; + } + + public static String nonnullString() { + return "OK"; + } + +} + +// FILE: kotlin.kt + fun box(): String { val nullStr = JavaClass.nullString() val nonnullStr = JavaClass.nonnullString() @@ -13,4 +29,4 @@ fun box(): String { inline fun T.foo(): Boolean = this is T -inline fun T.fooN(): Boolean = this is T? \ No newline at end of file +inline fun T.fooN(): Boolean = this is T? diff --git a/compiler/testData/codegen/boxWithJava/reified/isCheck/JavaClass.java b/compiler/testData/codegen/boxWithJava/reified/isCheck/JavaClass.java deleted file mode 100644 index ac3dfc287c2..00000000000 --- a/compiler/testData/codegen/boxWithJava/reified/isCheck/JavaClass.java +++ /dev/null @@ -1,11 +0,0 @@ -public class JavaClass { - - public static String nullString() { - return null; - } - - public static String nonnullString() { - return "OK"; - } - -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withGenerics/WithGenerics.kt b/compiler/testData/codegen/boxWithJava/secondaryConstructors/withGenerics.kt similarity index 55% rename from compiler/testData/codegen/boxWithJava/secondaryConstructors/withGenerics/WithGenerics.kt rename to compiler/testData/codegen/boxWithJava/secondaryConstructors/withGenerics.kt index d978d9530e9..acc8e92458e 100644 --- a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withGenerics/WithGenerics.kt +++ b/compiler/testData/codegen/boxWithJava/secondaryConstructors/withGenerics.kt @@ -1,3 +1,19 @@ +// FILE: WithGenerics.java + +class WithGenerics { + public static String foo1() { + A x = new A("OK"); + return x.toString(); + } + + public static String foo2() { + A x = new A(123); + return x.toString(); + } +} + +// FILE: WithGenerics.kt + open class A { val prop: String constructor(x: String) { diff --git a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withGenerics/WithGenerics.java b/compiler/testData/codegen/boxWithJava/secondaryConstructors/withGenerics/WithGenerics.java deleted file mode 100644 index 9c4f43d07d8..00000000000 --- a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withGenerics/WithGenerics.java +++ /dev/null @@ -1,11 +0,0 @@ -class WithGenerics { - public static String foo1() { - A x = new A("OK"); - return x.toString(); - } - - public static String foo2() { - A x = new A(123); - return x.toString(); - } -} diff --git a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withPrimary/WithPrimary.kt b/compiler/testData/codegen/boxWithJava/secondaryConstructors/withPrimary.kt similarity index 65% rename from compiler/testData/codegen/boxWithJava/secondaryConstructors/withPrimary/WithPrimary.kt rename to compiler/testData/codegen/boxWithJava/secondaryConstructors/withPrimary.kt index fd847910b19..a7d762aaa92 100644 --- a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withPrimary/WithPrimary.kt +++ b/compiler/testData/codegen/boxWithJava/secondaryConstructors/withPrimary.kt @@ -1,3 +1,22 @@ +// FILE: WithPrimary.java + +class WithPrimary { + public static A test1() { + return new A("123", "abc"); + } + public static A test2() { + return new A(); + } + public static A test3() { + return new A("123", 456); + } + public static A test4() { + return new A(1.0); + } +} + +// FILE: WithPrimary.kt + class A(val x: String = "def_x", val y: String = "1") { constructor(x: String, y: Int): this(x, y.toString()) {} constructor(x: Double): this(x.toString(), "def_y") {} diff --git a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withPrimary/WithPrimary.java b/compiler/testData/codegen/boxWithJava/secondaryConstructors/withPrimary/WithPrimary.java deleted file mode 100644 index 504d408a718..00000000000 --- a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withPrimary/WithPrimary.java +++ /dev/null @@ -1,14 +0,0 @@ -class WithPrimary { - public static A test1() { - return new A("123", "abc"); - } - public static A test2() { - return new A(); - } - public static A test3() { - return new A("123", 456); - } - public static A test4() { - return new A(1.0); - } -} diff --git a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withVarargs/withVarargs.kt b/compiler/testData/codegen/boxWithJava/secondaryConstructors/withVarargs.kt similarity index 68% rename from compiler/testData/codegen/boxWithJava/secondaryConstructors/withVarargs/withVarargs.kt rename to compiler/testData/codegen/boxWithJava/secondaryConstructors/withVarargs.kt index c38d977573f..c5a79b8c0ee 100644 --- a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withVarargs/withVarargs.kt +++ b/compiler/testData/codegen/boxWithJava/secondaryConstructors/withVarargs.kt @@ -1,3 +1,13 @@ +// FILE: WithVarargs.java + +public class WithVarargs { + public static String foo() { + return new A("1", "2", "3").getProp(); + } +} + +// FILE: withVarargs.kt + fun join(x: Array): String { var result = "" for (i in x) { diff --git a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withVarargs/WithVarargs.java b/compiler/testData/codegen/boxWithJava/secondaryConstructors/withVarargs/WithVarargs.java deleted file mode 100644 index f8645637258..00000000000 --- a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withVarargs/WithVarargs.java +++ /dev/null @@ -1,5 +0,0 @@ -public class WithVarargs { - public static String foo() { - return new A("1", "2", "3").getProp(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary/WithoutPrimary.kt b/compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary.kt similarity index 69% rename from compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary/WithoutPrimary.kt rename to compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary.kt index eb3431a45a0..ba69f21ae6c 100644 --- a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary/WithoutPrimary.kt +++ b/compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary.kt @@ -1,3 +1,19 @@ +// FILE: WithoutPrimary.java + +class WithoutPrimary { + public static A test1() { + return new A("123", "abc"); + } + public static A test3() { + return new A("123", 456); + } + public static A test4() { + return new A(1.0); + } +} + +// FILE: WithoutPrimary.kt + class A { val x: String val y: String diff --git a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary/WithoutPrimary.java b/compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary/WithoutPrimary.java deleted file mode 100644 index 1734b589a48..00000000000 --- a/compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary/WithoutPrimary.java +++ /dev/null @@ -1,11 +0,0 @@ -class WithoutPrimary { - public static A test1() { - return new A("123", "abc"); - } - public static A test3() { - return new A("123", 456); - } - public static A test4() { - return new A(1.0); - } -} diff --git a/compiler/testData/codegen/boxWithJava/statics/fields/test.kt b/compiler/testData/codegen/boxWithJava/statics/fields.kt similarity index 57% rename from compiler/testData/codegen/boxWithJava/statics/fields/test.kt rename to compiler/testData/codegen/boxWithJava/statics/fields.kt index da4171e95b1..ce88ce7a5f9 100644 --- a/compiler/testData/codegen/boxWithJava/statics/fields/test.kt +++ b/compiler/testData/codegen/boxWithJava/statics/fields.kt @@ -1,3 +1,19 @@ +// FILE: Child.java + +class Child extends Parent { + public static int b = 3; + public static int c = 4; +} + +// FILE: Parent.java + +class Parent { + public static int a = 1; + public static int b = 2; +} + +// FILE: test.kt + fun box(): String { if (Parent.a != 1) return "expected Parent.a == 1" if (Parent.b != 2) return "expected Parent.b == 2" diff --git a/compiler/testData/codegen/boxWithJava/statics/fields/Child.java b/compiler/testData/codegen/boxWithJava/statics/fields/Child.java deleted file mode 100644 index 4b743397bfc..00000000000 --- a/compiler/testData/codegen/boxWithJava/statics/fields/Child.java +++ /dev/null @@ -1,4 +0,0 @@ -class Child extends Parent { - public static int b = 3; - public static int c = 4; -} diff --git a/compiler/testData/codegen/boxWithJava/statics/fields/Parent.java b/compiler/testData/codegen/boxWithJava/statics/fields/Parent.java deleted file mode 100644 index f4c1d9a5b39..00000000000 --- a/compiler/testData/codegen/boxWithJava/statics/fields/Parent.java +++ /dev/null @@ -1,4 +0,0 @@ -class Parent { - public static int a = 1; - public static int b = 2; -} diff --git a/compiler/testData/codegen/boxWithJava/statics/functions/test.kt b/compiler/testData/codegen/boxWithJava/statics/functions.kt similarity index 50% rename from compiler/testData/codegen/boxWithJava/statics/functions/test.kt rename to compiler/testData/codegen/boxWithJava/statics/functions.kt index 56d167d2ece..ef74fc93920 100644 --- a/compiler/testData/codegen/boxWithJava/statics/functions/test.kt +++ b/compiler/testData/codegen/boxWithJava/statics/functions.kt @@ -1,3 +1,27 @@ +// FILE: Child.java + +class Child extends Parent { + public static String bar() { + return "Child.bar"; + } + public static String baz() { + return "Child.baz"; + } +} + +// FILE: Parent.java + +class Parent { + public static String foo() { + return "Parent.foo"; + } + public static String baz() { + return "Parent.baz"; + } +} + +// FILE: test.kt + fun box(): String { if (Parent.foo() != "Parent.foo") return "expected: Parent.foo" if (Parent.baz() != "Parent.baz") return "expected: Parent.baz" diff --git a/compiler/testData/codegen/boxWithJava/statics/functions/Child.java b/compiler/testData/codegen/boxWithJava/statics/functions/Child.java deleted file mode 100644 index 63e6f8766c6..00000000000 --- a/compiler/testData/codegen/boxWithJava/statics/functions/Child.java +++ /dev/null @@ -1,8 +0,0 @@ -class Child extends Parent { - public static String bar() { - return "Child.bar"; - } - public static String baz() { - return "Child.baz"; - } -} diff --git a/compiler/testData/codegen/boxWithJava/statics/functions/Parent.java b/compiler/testData/codegen/boxWithJava/statics/functions/Parent.java deleted file mode 100644 index 8184cffb3df..00000000000 --- a/compiler/testData/codegen/boxWithJava/statics/functions/Parent.java +++ /dev/null @@ -1,8 +0,0 @@ -class Parent { - public static String foo() { - return "Parent.foo"; - } - public static String baz() { - return "Parent.baz"; - } -} diff --git a/compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic.kt b/compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic.kt new file mode 100644 index 00000000000..4a9918d5df2 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic.kt @@ -0,0 +1,30 @@ +// FILE: Child.java + +class Child extends Parent { + public static String a = "2"; + public static String foo() { + return "Child.foo()"; + } + public static String foo(int i) { + return "Child.foo(int)"; + } +} + +// FILE: Parent.java + +class Parent { + private static int a = 1; + private static String foo() { + return "Parent.foo"; + } +} + +// FILE: test.kt + +fun box(): String { + if (Child.a != "2") return "Fail #1" + if (Child.foo() != "Child.foo()") return "Fail #2" + if (Child.foo(1) != "Child.foo(int)") return "Fail #3" + + return "OK" +} diff --git a/compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic/Child.java b/compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic/Child.java deleted file mode 100644 index 7dd71b702ac..00000000000 --- a/compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic/Child.java +++ /dev/null @@ -1,9 +0,0 @@ -class Child extends Parent { - public static String a = "2"; - public static String foo() { - return "Child.foo()"; - } - public static String foo(int i) { - return "Child.foo(int)"; - } -} diff --git a/compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic/Parent.java b/compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic/Parent.java deleted file mode 100644 index 592175f5c4f..00000000000 --- a/compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic/Parent.java +++ /dev/null @@ -1,6 +0,0 @@ -class Parent { - private static int a = 1; - private static String foo() { - return "Parent.foo"; - } -} diff --git a/compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic/test.kt b/compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic/test.kt deleted file mode 100644 index 90645449b07..00000000000 --- a/compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic/test.kt +++ /dev/null @@ -1,7 +0,0 @@ -fun box(): String { - if (Child.a != "2") return "Fail #1" - if (Child.foo() != "Child.foo()") return "Fail #2" - if (Child.foo(1) != "Child.foo(int)") return "Fail #3" - - return "OK" -} diff --git a/compiler/testData/codegen/boxWithJava/statics/protectedSamConstructor.kt b/compiler/testData/codegen/boxWithJava/statics/protectedSamConstructor.kt new file mode 100644 index 00000000000..b0bc2ad6462 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/statics/protectedSamConstructor.kt @@ -0,0 +1,27 @@ +// FILE: JavaClass.java + +public class JavaClass { + + public String runZ(Z z) { + return z.run("O", "K"); + } + + protected interface Z { + String run(String s1, String s2); + } +} + +// FILE: Kotlin.kt + +package zzz + +import JavaClass +import JavaClass.Z + +class A : JavaClass() { + fun test() = runZ(JavaClass.Z {a, b -> a + b}) +} + +fun box(): String { + return A().test() +} diff --git a/compiler/testData/codegen/boxWithJava/statics/protectedSamConstructor/JavaClass.java b/compiler/testData/codegen/boxWithJava/statics/protectedSamConstructor/JavaClass.java deleted file mode 100644 index e8949e5a732..00000000000 --- a/compiler/testData/codegen/boxWithJava/statics/protectedSamConstructor/JavaClass.java +++ /dev/null @@ -1,10 +0,0 @@ -public class JavaClass { - - public String runZ(Z z) { - return z.run("O", "K"); - } - - protected interface Z { - String run(String s1, String s2); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/statics/protectedSamConstructor/Kotlin.kt b/compiler/testData/codegen/boxWithJava/statics/protectedSamConstructor/Kotlin.kt deleted file mode 100644 index 7ea4551fdee..00000000000 --- a/compiler/testData/codegen/boxWithJava/statics/protectedSamConstructor/Kotlin.kt +++ /dev/null @@ -1,12 +0,0 @@ -package zzz - -import JavaClass -import JavaClass.Z - -class A : JavaClass() { - fun test() = runZ(JavaClass.Z {a, b -> a + b}) -} - -fun box(): String { - return A().test() -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/statics/protectedStatic/First.kt b/compiler/testData/codegen/boxWithJava/statics/protectedStatic.kt similarity index 71% rename from compiler/testData/codegen/boxWithJava/statics/protectedStatic/First.kt rename to compiler/testData/codegen/boxWithJava/statics/protectedStatic.kt index 822826ed391..3f0db541e10 100644 --- a/compiler/testData/codegen/boxWithJava/statics/protectedStatic/First.kt +++ b/compiler/testData/codegen/boxWithJava/statics/protectedStatic.kt @@ -1,3 +1,15 @@ +// FILE: First.java + +public abstract class First { + protected static String TEST = "OK"; + + protected static String test() { + return TEST; + } +} + +// FILE: First.kt + package anotherPackage import First @@ -20,4 +32,4 @@ fun box(): String { if (Second().foo2().invoke() != "OK") return "fail 4" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxWithJava/statics/protectedStatic/First.java b/compiler/testData/codegen/boxWithJava/statics/protectedStatic/First.java deleted file mode 100644 index 5dc5860e7b4..00000000000 --- a/compiler/testData/codegen/boxWithJava/statics/protectedStatic/First.java +++ /dev/null @@ -1,7 +0,0 @@ -public abstract class First { - protected static String TEST = "OK"; - - protected static String test() { - return TEST; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/statics/protectedStatic2/Kotlin.kt b/compiler/testData/codegen/boxWithJava/statics/protectedStatic2.kt similarity index 61% rename from compiler/testData/codegen/boxWithJava/statics/protectedStatic2/Kotlin.kt rename to compiler/testData/codegen/boxWithJava/statics/protectedStatic2.kt index bb1b8eb82d8..89fb41cfe73 100644 --- a/compiler/testData/codegen/boxWithJava/statics/protectedStatic2/Kotlin.kt +++ b/compiler/testData/codegen/boxWithJava/statics/protectedStatic2.kt @@ -1,3 +1,30 @@ +// FILE: Base.java + +public class Base { + + protected static String BASE_ONLY = "BASE"; + + protected static String baseOnly() { + return BASE_ONLY; + } + + protected static String TEST = "BASE"; + + protected static String test() { + return TEST; + } + + public static class Derived extends Base { + protected static String TEST = "DERIVED"; + + protected static String test() { + return TEST; + } + } +} + +// FILE: Kotlin.kt + package anotherPackage import Base.Derived @@ -28,4 +55,4 @@ class Kotlin : Base.Derived() { fun box(): String { return Kotlin().doTest() -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxWithJava/statics/protectedStatic2/Base.java b/compiler/testData/codegen/boxWithJava/statics/protectedStatic2/Base.java deleted file mode 100644 index ca2c6f34927..00000000000 --- a/compiler/testData/codegen/boxWithJava/statics/protectedStatic2/Base.java +++ /dev/null @@ -1,22 +0,0 @@ -public class Base { - - protected static String BASE_ONLY = "BASE"; - - protected static String baseOnly() { - return BASE_ONLY; - } - - protected static String TEST = "BASE"; - - protected static String test() { - return TEST; - } - - public static class Derived extends Base { - protected static String TEST = "DERIVED"; - - protected static String test() { - return TEST; - } - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/statics/protectedStaticAndInline/Kotlin.kt b/compiler/testData/codegen/boxWithJava/statics/protectedStaticAndInline.kt similarity index 50% rename from compiler/testData/codegen/boxWithJava/statics/protectedStaticAndInline/Kotlin.kt rename to compiler/testData/codegen/boxWithJava/statics/protectedStaticAndInline.kt index 30ef19c065b..547ccf125ca 100644 --- a/compiler/testData/codegen/boxWithJava/statics/protectedStaticAndInline/Kotlin.kt +++ b/compiler/testData/codegen/boxWithJava/statics/protectedStaticAndInline.kt @@ -1,3 +1,15 @@ +// FILE: First.java + +public abstract class First { + protected static String TEST = "O"; + + protected static String test() { + return "K"; + } +} + +// FILE: Kotlin.kt + package anotherPackage import First @@ -11,4 +23,4 @@ class Test : First() { fun box(): String { return Test().doTest() -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxWithJava/statics/protectedStaticAndInline/First.java b/compiler/testData/codegen/boxWithJava/statics/protectedStaticAndInline/First.java deleted file mode 100644 index 1c54e9f5ae6..00000000000 --- a/compiler/testData/codegen/boxWithJava/statics/protectedStaticAndInline/First.java +++ /dev/null @@ -1,7 +0,0 @@ -public abstract class First { - protected static String TEST = "O"; - - protected static String test() { - return "K"; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/boxWithJava/varargs/A.kt b/compiler/testData/codegen/boxWithJava/varargs.kt similarity index 58% rename from compiler/testData/codegen/boxWithJava/varargs/A.kt rename to compiler/testData/codegen/boxWithJava/varargs.kt index f6e2595886f..e1433969364 100644 --- a/compiler/testData/codegen/boxWithJava/varargs/A.kt +++ b/compiler/testData/codegen/boxWithJava/varargs.kt @@ -1,3 +1,15 @@ +// FILE: A.java + +public class A { + public int foo(int x, String ... args) { + return x + args.length; + } + + public static String[] ar = new String[] { "a", "b"}; +} + +// FILE: test.kt + fun bar(args: Array?): Int { var res = 0 @@ -16,4 +28,4 @@ fun box(): String { if (bar(A.ar) != 6) return "Fail" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/boxWithJava/varargs/A.java b/compiler/testData/codegen/boxWithJava/varargs/A.java deleted file mode 100644 index c21e1304771..00000000000 --- a/compiler/testData/codegen/boxWithJava/varargs/A.java +++ /dev/null @@ -1,7 +0,0 @@ -public class A { - public int foo(int x, String ... args) { - return x + args.length; - } - - public static String[] ar = new String[] { "a", "b"}; -} \ No newline at end of file diff --git a/compiler/testData/codegen/java8/box/defaultMethodCallFromInterface.kt b/compiler/testData/codegen/java8/box/defaultMethodCallFromInterface.kt new file mode 100644 index 00000000000..5bfa5f60b0d --- /dev/null +++ b/compiler/testData/codegen/java8/box/defaultMethodCallFromInterface.kt @@ -0,0 +1,28 @@ +// FILE: Simple.java + +public interface Simple { + default String test(String s) { + return s + "K"; + } + + static String testStatic(String s) { + return s + "K"; + } +} + +// FILE: main.kt + +interface KInterface : Simple { + fun bar(): String { + return test("O") + Simple.testStatic("O") + } +} + +class Test : KInterface {} + +fun box(): String { + val test = Test().bar() + if (test != "OKOK") return "fail $test" + + return "OK" +} diff --git a/compiler/testData/codegen/java8/box/defaultMethodCallViaClass.kt b/compiler/testData/codegen/java8/box/defaultMethodCallViaClass.kt new file mode 100644 index 00000000000..2e5fba7dc1f --- /dev/null +++ b/compiler/testData/codegen/java8/box/defaultMethodCallViaClass.kt @@ -0,0 +1,22 @@ +// FILE: Simple.java + +interface Simple { + default String test(String s) { + return s + "K"; + } + + static String testStatic(String s) { + return s + "K"; + } +} + +// FILE: main.kt + +class Test : Simple {} + +fun box(): String { + val test = Test().test("O") + if (test != "OK") return "fail $test" + + return Simple.testStatic("O") +} diff --git a/compiler/testData/codegen/java8/box/defaultMethodCallViaInterface.kt b/compiler/testData/codegen/java8/box/defaultMethodCallViaInterface.kt new file mode 100644 index 00000000000..2151e66737e --- /dev/null +++ b/compiler/testData/codegen/java8/box/defaultMethodCallViaInterface.kt @@ -0,0 +1,23 @@ +// FILE: Simple.java + +public interface Simple { + default String test(String s) { + return s + "K"; + } + + static String testStatic(String s) { + return s + "K"; + } +} + +// FILE: main.kt + +interface TestInterface : Simple {} +class Test : TestInterface {} + +fun box(): String { + val test = Test().test("O") + if (test != "OK") return "fail $test" + + return Simple.testStatic("O") +} diff --git a/compiler/testData/codegen/java8/box/defaultMethodOverride.kt b/compiler/testData/codegen/java8/box/defaultMethodOverride.kt new file mode 100644 index 00000000000..54f10488c89 --- /dev/null +++ b/compiler/testData/codegen/java8/box/defaultMethodOverride.kt @@ -0,0 +1,23 @@ +// FILE: Simple.java + +public interface Simple { + default String test(String s) { + return s + "Fail"; + } +} + +// FILE: main.kt + +interface KInterface: Simple { + override fun test(s: String): String { + return s + "K" + } +} + +class Test : KInterface { + +} + +fun box(): String { + return Test().test("O") +} diff --git a/compiler/testData/codegen/java8/boxWithJava/dontDelegateToDefaultMethods/dontDelegate.kt b/compiler/testData/codegen/java8/box/dontDelegateToDefaultMethods.kt similarity index 62% rename from compiler/testData/codegen/java8/boxWithJava/dontDelegateToDefaultMethods/dontDelegate.kt rename to compiler/testData/codegen/java8/box/dontDelegateToDefaultMethods.kt index dc115d0bd78..7850a32b9fe 100644 --- a/compiler/testData/codegen/java8/boxWithJava/dontDelegateToDefaultMethods/dontDelegate.kt +++ b/compiler/testData/codegen/java8/box/dontDelegateToDefaultMethods.kt @@ -1,3 +1,16 @@ +// FILE: Test.java + +interface Test { + + T call(); + + default T testDefault(T p) { + return p; + } +} + +// FILE: main.kt + class Child : Test { override fun call() : String { return "OK" diff --git a/compiler/testData/codegen/java8/boxWithJava/inheritKotlin/defaultCall.kt b/compiler/testData/codegen/java8/box/inheritKotlin.kt similarity index 66% rename from compiler/testData/codegen/java8/boxWithJava/inheritKotlin/defaultCall.kt rename to compiler/testData/codegen/java8/box/inheritKotlin.kt index 533a2f49413..c030002894f 100644 --- a/compiler/testData/codegen/java8/boxWithJava/inheritKotlin/defaultCall.kt +++ b/compiler/testData/codegen/java8/box/inheritKotlin.kt @@ -1,15 +1,23 @@ -interface KTrait { +// FILE: Simple.java + +interface Simple extends KInterface { + default String test() { + return "simple"; + } +} + +// FILE: main.kt + +interface KInterface { fun test(): String { return "base"; } } class Test : Simple { - fun bar(): String { return super.test() } - } fun box(): String { @@ -20,4 +28,4 @@ fun box(): String { if (bar != "simple") return "fail 2 $bar" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/java8/boxWithJava/invokeDefaultViaSuper/tesk.kt b/compiler/testData/codegen/java8/box/invokeDefaultViaSuper.kt similarity index 69% rename from compiler/testData/codegen/java8/boxWithJava/invokeDefaultViaSuper/tesk.kt rename to compiler/testData/codegen/java8/box/invokeDefaultViaSuper.kt index 514daeb5d0a..d65a2e38516 100644 --- a/compiler/testData/codegen/java8/boxWithJava/invokeDefaultViaSuper/tesk.kt +++ b/compiler/testData/codegen/java8/box/invokeDefaultViaSuper.kt @@ -1,4 +1,14 @@ -interface KTrait : Test { +// FILE: Test.java + +public interface Test { + default String test() { + return "OK"; + } +} + +// FILE: test.kt + +interface KInterface : Test { } @@ -8,7 +18,7 @@ class KClass : Test { } } -class KTClass : KTrait { +class KTClass : KInterface { fun ktest(): String { return super.test() + test() } @@ -16,7 +26,7 @@ class KTClass : KTrait { fun box(): String { - val p = object : KTrait { + val p = object : KInterface { fun ktest(): String { return super.test() + test() } diff --git a/compiler/testData/codegen/java8/boxWithJava/longChainOfKotlinExtendsFromJavaWithDefault/derived.kt b/compiler/testData/codegen/java8/box/longChainOfKotlinExtendsFromJavaWithDefault.kt similarity index 54% rename from compiler/testData/codegen/java8/boxWithJava/longChainOfKotlinExtendsFromJavaWithDefault/derived.kt rename to compiler/testData/codegen/java8/box/longChainOfKotlinExtendsFromJavaWithDefault.kt index d692890341c..68492133b2d 100644 --- a/compiler/testData/codegen/java8/boxWithJava/longChainOfKotlinExtendsFromJavaWithDefault/derived.kt +++ b/compiler/testData/codegen/java8/box/longChainOfKotlinExtendsFromJavaWithDefault.kt @@ -1,3 +1,13 @@ +// FILE: Base.java + +public interface Base { + default String foo() { + return "OK"; + } +} + +// FILE: derived.kt + interface K1 : Base interface K2 : K1 diff --git a/compiler/testData/codegen/java8/boxWithJava/reflection/realParameterNames/K.kt b/compiler/testData/codegen/java8/box/reflection/realParameterNames.kt similarity index 78% rename from compiler/testData/codegen/java8/boxWithJava/reflection/realParameterNames/K.kt rename to compiler/testData/codegen/java8/box/reflection/realParameterNames.kt index 653f4042dbb..f92593a64b7 100644 --- a/compiler/testData/codegen/java8/boxWithJava/reflection/realParameterNames/K.kt +++ b/compiler/testData/codegen/java8/box/reflection/realParameterNames.kt @@ -1,3 +1,12 @@ +// FILE: J.java + +public class J { + public J(String constructorParam) {} + + public static void foo(int methodParam) {} +} + +// FILE: K.kt // JAVAC_OPTIONS: -parameters import kotlin.test.assertEquals diff --git a/compiler/testData/codegen/java8/boxWithJava/reflection/synthesizedParameterNames/K.kt b/compiler/testData/codegen/java8/box/reflection/synthesizedParameterNames.kt similarity index 76% rename from compiler/testData/codegen/java8/boxWithJava/reflection/synthesizedParameterNames/K.kt rename to compiler/testData/codegen/java8/box/reflection/synthesizedParameterNames.kt index b322f675287..bc724508e59 100644 --- a/compiler/testData/codegen/java8/boxWithJava/reflection/synthesizedParameterNames/K.kt +++ b/compiler/testData/codegen/java8/box/reflection/synthesizedParameterNames.kt @@ -1,3 +1,13 @@ +// FILE: J.java + +public class J { + public J(String constructorParam) {} + + public static void foo(int methodParam) {} +} + +// FILE: K.kt + import kotlin.test.assertEquals fun box(): String { diff --git a/compiler/testData/codegen/java8/box/samOnInterfaceWithDefaultMethod.kt b/compiler/testData/codegen/java8/box/samOnInterfaceWithDefaultMethod.kt new file mode 100644 index 00000000000..5c8094bdc61 --- /dev/null +++ b/compiler/testData/codegen/java8/box/samOnInterfaceWithDefaultMethod.kt @@ -0,0 +1,28 @@ +// FILE: JavaCall.java + +class JavaCall { + String call(Test test) { + return test.call(); + } +} + +// FILE: Test.java + +interface Test { + + String call(); + + default String test() { + return "K"; + } + + static String testStatic() { + return "K"; + } +} + +// FILE: sam.kt + +fun box(): String { + return JavaCall().call {"OK"} +} diff --git a/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallFromTrait/Simple.java b/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallFromTrait/Simple.java deleted file mode 100644 index 22216ab77a5..00000000000 --- a/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallFromTrait/Simple.java +++ /dev/null @@ -1,9 +0,0 @@ -public interface Simple { - default String test(String s) { - return s + "K"; - } - - static String testStatic(String s) { - return s + "K"; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallFromTrait/defaultCall.kt b/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallFromTrait/defaultCall.kt deleted file mode 100644 index 0239babedcf..00000000000 --- a/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallFromTrait/defaultCall.kt +++ /dev/null @@ -1,14 +0,0 @@ -interface KTrait : Simple { - fun bar(): String { - return test("O") + Simple.testStatic("O") - } -} - -class Test : KTrait {} - -fun box(): String { - val test = Test().bar() - if (test != "OKOK") return "fail $test" - - return "OK" -} \ No newline at end of file diff --git a/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallViaClass/Simple.java b/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallViaClass/Simple.java deleted file mode 100644 index 9e37ab67659..00000000000 --- a/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallViaClass/Simple.java +++ /dev/null @@ -1,9 +0,0 @@ -interface Simple { - default String test(String s) { - return s + "K"; - } - - static String testStatic(String s) { - return s + "K"; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallViaClass/defaultCall.kt b/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallViaClass/defaultCall.kt deleted file mode 100644 index 95f494533b2..00000000000 --- a/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallViaClass/defaultCall.kt +++ /dev/null @@ -1,8 +0,0 @@ -class Test : Simple {} - -fun box(): String { - val test = Test().test("O") - if (test != "OK") return "fail $test" - - return Simple.testStatic("O") -} \ No newline at end of file diff --git a/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallViaTrait/Simple.java b/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallViaTrait/Simple.java deleted file mode 100644 index 22216ab77a5..00000000000 --- a/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallViaTrait/Simple.java +++ /dev/null @@ -1,9 +0,0 @@ -public interface Simple { - default String test(String s) { - return s + "K"; - } - - static String testStatic(String s) { - return s + "K"; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallViaTrait/defaultMethodCallViaTrait.kt b/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallViaTrait/defaultMethodCallViaTrait.kt deleted file mode 100644 index e7ba10889c2..00000000000 --- a/compiler/testData/codegen/java8/boxWithJava/defaultMethodCallViaTrait/defaultMethodCallViaTrait.kt +++ /dev/null @@ -1,9 +0,0 @@ -interface TestTrait : Simple {} -class Test : TestTrait {} - -fun box(): String { - val test = Test().test("O") - if (test != "OK") return "fail $test" - - return Simple.testStatic("O") -} \ No newline at end of file diff --git a/compiler/testData/codegen/java8/boxWithJava/defaultMethodOverride/Simple.java b/compiler/testData/codegen/java8/boxWithJava/defaultMethodOverride/Simple.java deleted file mode 100644 index 0307abe7474..00000000000 --- a/compiler/testData/codegen/java8/boxWithJava/defaultMethodOverride/Simple.java +++ /dev/null @@ -1,5 +0,0 @@ -public interface Simple { - default String test(String s) { - return s + "Fail"; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/java8/boxWithJava/defaultMethodOverride/override.kt b/compiler/testData/codegen/java8/boxWithJava/defaultMethodOverride/override.kt deleted file mode 100644 index 9101da6aecf..00000000000 --- a/compiler/testData/codegen/java8/boxWithJava/defaultMethodOverride/override.kt +++ /dev/null @@ -1,13 +0,0 @@ -interface KTrait: Simple { - override fun test(s: String): String { - return s + "K" - } -} - -class Test : KTrait { - -} - -fun box(): String { - return Test().test("O") -} \ No newline at end of file diff --git a/compiler/testData/codegen/java8/boxWithJava/dontDelegateToDefaultMethods/Test.java b/compiler/testData/codegen/java8/boxWithJava/dontDelegateToDefaultMethods/Test.java deleted file mode 100644 index 1e92c6bc32d..00000000000 --- a/compiler/testData/codegen/java8/boxWithJava/dontDelegateToDefaultMethods/Test.java +++ /dev/null @@ -1,8 +0,0 @@ -interface Test { - - T call(); - - default T testDefault(T p) { - return p; - } -} diff --git a/compiler/testData/codegen/java8/boxWithJava/inheritKotlin/Simple.java b/compiler/testData/codegen/java8/boxWithJava/inheritKotlin/Simple.java deleted file mode 100644 index 02c979c1af1..00000000000 --- a/compiler/testData/codegen/java8/boxWithJava/inheritKotlin/Simple.java +++ /dev/null @@ -1,5 +0,0 @@ -interface Simple extends KTrait { - default String test() { - return "simple"; - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/java8/boxWithJava/invokeDefaultViaSuper/Test.java b/compiler/testData/codegen/java8/boxWithJava/invokeDefaultViaSuper/Test.java deleted file mode 100644 index f660dc34662..00000000000 --- a/compiler/testData/codegen/java8/boxWithJava/invokeDefaultViaSuper/Test.java +++ /dev/null @@ -1,5 +0,0 @@ -public interface Test { - default String test() { - return "OK"; - } -} diff --git a/compiler/testData/codegen/java8/boxWithJava/longChainOfKotlinExtendsFromJavaWithDefault/Base.java b/compiler/testData/codegen/java8/boxWithJava/longChainOfKotlinExtendsFromJavaWithDefault/Base.java deleted file mode 100644 index c628acd5cda..00000000000 --- a/compiler/testData/codegen/java8/boxWithJava/longChainOfKotlinExtendsFromJavaWithDefault/Base.java +++ /dev/null @@ -1,5 +0,0 @@ -public interface Base { - default String foo() { - return "OK"; - } -} diff --git a/compiler/testData/codegen/java8/boxWithJava/reflection/realParameterNames/J.java b/compiler/testData/codegen/java8/boxWithJava/reflection/realParameterNames/J.java deleted file mode 100644 index b5244858eaa..00000000000 --- a/compiler/testData/codegen/java8/boxWithJava/reflection/realParameterNames/J.java +++ /dev/null @@ -1,5 +0,0 @@ -public class J { - public J(String constructorParam) {} - - public static void foo(int methodParam) {} -} diff --git a/compiler/testData/codegen/java8/boxWithJava/reflection/synthesizedParameterNames/J.java b/compiler/testData/codegen/java8/boxWithJava/reflection/synthesizedParameterNames/J.java deleted file mode 100644 index b5244858eaa..00000000000 --- a/compiler/testData/codegen/java8/boxWithJava/reflection/synthesizedParameterNames/J.java +++ /dev/null @@ -1,5 +0,0 @@ -public class J { - public J(String constructorParam) {} - - public static void foo(int methodParam) {} -} diff --git a/compiler/testData/codegen/java8/boxWithJava/samOnInterfaceWithDefaultMethod/JavaCall.java b/compiler/testData/codegen/java8/boxWithJava/samOnInterfaceWithDefaultMethod/JavaCall.java deleted file mode 100644 index 44f7df52eff..00000000000 --- a/compiler/testData/codegen/java8/boxWithJava/samOnInterfaceWithDefaultMethod/JavaCall.java +++ /dev/null @@ -1,5 +0,0 @@ -class JavaCall { - String call(Test test) { - return test.call(); - } -} \ No newline at end of file diff --git a/compiler/testData/codegen/java8/boxWithJava/samOnInterfaceWithDefaultMethod/Test.java b/compiler/testData/codegen/java8/boxWithJava/samOnInterfaceWithDefaultMethod/Test.java deleted file mode 100644 index ae22869d2e4..00000000000 --- a/compiler/testData/codegen/java8/boxWithJava/samOnInterfaceWithDefaultMethod/Test.java +++ /dev/null @@ -1,12 +0,0 @@ -interface Test { - - String call(); - - default String test() { - return "K"; - } - - static String testStatic() { - return "K"; - } -} diff --git a/compiler/testData/codegen/java8/boxWithJava/samOnInterfaceWithDefaultMethod/sam.kt b/compiler/testData/codegen/java8/boxWithJava/samOnInterfaceWithDefaultMethod/sam.kt deleted file mode 100644 index bcfeefa593b..00000000000 --- a/compiler/testData/codegen/java8/boxWithJava/samOnInterfaceWithDefaultMethod/sam.kt +++ /dev/null @@ -1,3 +0,0 @@ -fun box(): String { - return JavaCall().call {"OK"} -} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxAgainstJavaCodegenTest.kt b/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxAgainstJavaCodegenTest.kt index 0aee0ba4af2..6cff07f5f4d 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxAgainstJavaCodegenTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxAgainstJavaCodegenTest.kt @@ -16,7 +16,6 @@ package org.jetbrains.kotlin.codegen -import com.intellij.ide.highlighter.JavaFileType import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import org.jetbrains.kotlin.test.ConfigurationKind @@ -25,16 +24,14 @@ import org.jetbrains.kotlin.test.TestJdkKind import java.io.File abstract class AbstractBlackBoxAgainstJavaCodegenTest : AbstractBlackBoxCodegenTest() { - override fun createEnvironment(jdkKind: TestJdkKind, javaSourceDir: File?) { - val javaOutputDir = javaSourceDir?.let { javaSourceDir -> - val javaSourceFilePaths = javaSourceDir.walk().mapNotNull { file -> - if (file.isFile && file.extension == JavaFileType.DEFAULT_EXTENSION) { - file.path - } - else null - }.toList() - - CodegenTestUtil.compileJava(javaSourceFilePaths, emptyList(), emptyList()) + override fun compileAndRun( + files: List, + javaSourceDir: File?, + jdkKind: TestJdkKind, + javacOptions: List + ) { + val javaOutputDir = javaSourceDir?.let { directory -> + CodegenTestUtil.compileJava(findJavaSourcesInDirectory(directory), emptyList(), javacOptions) } val configuration = KotlinTestUtils.compilerConfigurationForTests( @@ -42,5 +39,8 @@ abstract class AbstractBlackBoxAgainstJavaCodegenTest : AbstractBlackBoxCodegenT ) myEnvironment = KotlinCoreEnvironment.createForTests(testRootDisposable, configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES) + + loadMultiFiles(files) + blackBox() } } diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java b/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java index ee43aaba2a3..0f13e3235ef 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/AbstractBlackBoxCodegenTest.java @@ -16,9 +16,10 @@ package org.jetbrains.kotlin.codegen; +import com.intellij.ide.highlighter.JavaFileType; import com.intellij.openapi.util.io.FileUtil; -import com.intellij.util.ArrayUtil; import com.intellij.util.Processor; +import kotlin.collections.ArraysKt; import kotlin.io.FilesKt; import kotlin.text.Charsets; import org.jetbrains.annotations.NotNull; @@ -41,6 +42,7 @@ import org.jetbrains.kotlin.test.TestJdkKind; import org.jetbrains.kotlin.utils.ExceptionUtilsKt; import java.io.File; +import java.io.IOException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collections; @@ -62,15 +64,6 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase { } } - protected void doTestWithJava(@NotNull String filename) { - try { - blackBoxFileWithJavaByFullPath(filename); - } - catch (Exception e) { - throw ExceptionUtilsKt.rethrow(e); - } - } - protected void doTestWithStdlib(@NotNull String filename) { configurationKind = InTextDirectivesUtils.isDirectiveDefined( FilesKt.readText(new File(filename), Charsets.UTF_8), "NO_KOTLIN_REFLECT" @@ -85,22 +78,73 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase { private void doTestMultiFile(@NotNull List files, @Nullable File javaSourceDir) { TestJdkKind jdkKind = TestJdkKind.MOCK_JDK; + List javacOptions = new ArrayList(0); for (TestFile file : files) { if (isFullJdkDirectiveDefined(file.content)) { jdkKind = TestJdkKind.FULL_JDK; break; } + javacOptions.addAll(InTextDirectivesUtils.findListWithPrefixes(file.content, "// JAVAC_OPTIONS:")); } - createEnvironment(jdkKind, javaSourceDir); + compileAndRun(files, javaSourceDir, jdkKind, javacOptions); + } + + protected void compileAndRun( + @NotNull List files, + @Nullable File javaSourceDir, + @NotNull TestJdkKind jdkKind, + @NotNull List javacOptions + ) { + CompilerConfiguration configuration = compilerConfigurationForTests( + ConfigurationKind.ALL, jdkKind, Collections.singletonList(getAnnotationsJar()), + ArraysKt.filterNotNull(new File[] {javaSourceDir}) + ); + + myEnvironment = KotlinCoreEnvironment.createForTests( + getTestRootDisposable(), configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES + ); + loadMultiFiles(files); + + classFileFactory = GenerationUtils.compileManyFilesGetGenerationStateForTest( + myEnvironment.getProject(), myFiles.getPsiFiles(), new JvmPackagePartProvider(myEnvironment) + ).getFactory(); + + File kotlinOut; + try { + kotlinOut = KotlinTestUtils.tmpDir(toString()); + } + catch (IOException e) { + throw ExceptionUtilsKt.rethrow(e); + } + + OutputUtilsKt.writeAllTo(classFileFactory, kotlinOut); + + if (javaSourceDir != null) { + File output = + compileJava(findJavaSourcesInDirectory(javaSourceDir), Collections.singletonList(kotlinOut.getPath()), javacOptions); + // Add javac output to classpath so that the created class loader can find generated Java classes + JvmContentRootsKt.addJvmClasspathRoot(configuration, output); + } blackBox(); } - protected void createEnvironment(@NotNull TestJdkKind jdkKind, @Nullable File javaSourceDir) { - CompilerConfiguration configuration = compilerConfigurationForTests(ConfigurationKind.ALL, jdkKind, getAnnotationsJar()); - myEnvironment = - KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES); + @NotNull + protected static List findJavaSourcesInDirectory(@NotNull File directory) { + final List javaFilePaths = new ArrayList(1); + + FileUtil.processFilesRecursively(directory, new Processor() { + @Override + public boolean process(File file) { + if (file.isFile() && FilesKt.getExtension(file).equals(JavaFileType.DEFAULT_EXTENSION)) { + javaFilePaths.add(file.getPath()); + } + return true; + } + }); + + return javaFilePaths; } // NOTE: tests under fullJdk/ are run with FULL_JDK instead of MOCK_JDK @@ -118,48 +162,6 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase { return InTextDirectivesUtils.isDirectiveDefined(content, "FULL_JDK"); } - private void blackBoxFileWithJavaByFullPath(@NotNull String directory) throws Exception { - File dirFile = new File(directory); - - final List javaFilePaths = new ArrayList(); - final List ktFilePaths = new ArrayList(); - FileUtil.processFilesRecursively(dirFile, new Processor() { - @Override - public boolean process(File file) { - if (file.getName().endsWith(".kt")) { - ktFilePaths.add(relativePath(file)); - } - else if (file.getName().endsWith(".java")) { - javaFilePaths.add(file.getPath()); - } - return true; - } - }); - - CompilerConfiguration configuration = KotlinTestUtils.compilerConfigurationForTests( - ConfigurationKind.ALL, TestJdkKind.MOCK_JDK, KotlinTestUtils.getAnnotationsJar() - ); - JvmContentRootsKt.addJavaSourceRoot(configuration, dirFile); - myEnvironment = KotlinCoreEnvironment.createForTests(getTestRootDisposable(), configuration, EnvironmentConfigFiles.JVM_CONFIG_FILES); - loadFiles(ArrayUtil.toStringArray(ktFilePaths)); - classFileFactory = - GenerationUtils.compileManyFilesGetGenerationStateForTest(myEnvironment.getProject(), myFiles.getPsiFiles(), - new JvmPackagePartProvider(myEnvironment)).getFactory(); - File kotlinOut = KotlinTestUtils.tmpDir(toString()); - OutputUtilsKt.writeAllTo(classFileFactory, kotlinOut); - - List javacOptions = new ArrayList(0); - for (KtFile jetFile : myFiles.getPsiFiles()) { - javacOptions.addAll(InTextDirectivesUtils.findListWithPrefixes(jetFile.getText(), "// JAVAC_OPTIONS:")); - } - - File javaOut = compileJava(javaFilePaths, Collections.singletonList(kotlinOut.getPath()), javacOptions); - // Add javac output to classpath so that the created class loader can find generated Java classes - JvmContentRootsKt.addJvmClasspathRoot(configuration, javaOut); - - blackBox(); - } - private void blackBoxFileByFullPath(@NotNull String filename) { loadFileByFullPath(filename); blackBox(); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxWithJavaCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxWithJavaCodegenTestGenerated.java index df51005123e..6ddf8968439 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxWithJavaCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxWithJavaCodegenTestGenerated.java @@ -32,143 +32,121 @@ import java.util.regex.Pattern; @RunWith(JUnit3RunnerWithInners.class) public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInBoxWithJava() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("allWildcardsOnClass") + @TestMetadata("allWildcardsOnClass.kt") public void testAllWildcardsOnClass() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/allWildcardsOnClass/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/allWildcardsOnClass.kt"); + doTest(fileName); } - @TestMetadata("annotatedSamFunExpression") + @TestMetadata("annotatedSamFunExpression.kt") public void testAnnotatedSamFunExpression() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/annotatedSamFunExpression/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/annotatedSamFunExpression.kt"); + doTest(fileName); } - @TestMetadata("annotatedSamLambda") + @TestMetadata("annotatedSamLambda.kt") public void testAnnotatedSamLambda() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/annotatedSamLambda/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/annotatedSamLambda.kt"); + doTest(fileName); } - @TestMetadata("classCompanion") + @TestMetadata("classCompanion.kt") public void testClassCompanion() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/classCompanion/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/classCompanion.kt"); + doTest(fileName); } - @TestMetadata("classObjectAccessor") - public void testClassObjectAccessor() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/classObjectAccessor/"); - doTestWithJava(fileName); + @TestMetadata("companionObjectAccessor.kt") + public void testCompanionObjectAccessor() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/companionObjectAccessor.kt"); + doTest(fileName); } - @TestMetadata("covariantOverrideWithDeclarationSiteProjection") + @TestMetadata("covariantOverrideWithDeclarationSiteProjection.kt") public void testCovariantOverrideWithDeclarationSiteProjection() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/covariantOverrideWithDeclarationSiteProjection/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/covariantOverrideWithDeclarationSiteProjection.kt"); + doTest(fileName); } - @TestMetadata("deprecatedFieldForObject") - public void testDeprecatedFieldForObject() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/deprecatedFieldForObject/"); - doTestWithJava(fileName); - } - - @TestMetadata("enhancedPrimitives") + @TestMetadata("enhancedPrimitives.kt") public void testEnhancedPrimitives() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/enhancedPrimitives/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/enhancedPrimitives.kt"); + doTest(fileName); } - @TestMetadata("inline") + @TestMetadata("inline.kt") public void testInline() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/inline/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/inline.kt"); + doTest(fileName); } - @TestMetadata("innerClass") + @TestMetadata("innerClass.kt") public void testInnerClass() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/innerClass/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/innerClass.kt"); + doTest(fileName); } - @TestMetadata("innerGenericClass") + @TestMetadata("innerGenericClass.kt") public void testInnerGenericClass() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/innerGenericClass/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/innerGenericClass.kt"); + doTest(fileName); } - @TestMetadata("interfaceCompanion") + @TestMetadata("interfaceCompanion.kt") public void testInterfaceCompanion() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/interfaceCompanion/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/interfaceCompanion.kt"); + doTest(fileName); } - @TestMetadata("interfaceDefaultImpls") + @TestMetadata("interfaceDefaultImpls.kt") public void testInterfaceDefaultImpls() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/interfaceDefaultImpls/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/interfaceDefaultImpls.kt"); + doTest(fileName); } - @TestMetadata("invariantArgumentsNoWildcard") + @TestMetadata("invariantArgumentsNoWildcard.kt") public void testInvariantArgumentsNoWildcard() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/invariantArgumentsNoWildcard/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/invariantArgumentsNoWildcard.kt"); + doTest(fileName); } - @TestMetadata("invokeOnSyntheticProperty") + @TestMetadata("invokeOnSyntheticProperty.kt") public void testInvokeOnSyntheticProperty() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/invokeOnSyntheticProperty/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/invokeOnSyntheticProperty.kt"); + doTest(fileName); } - @TestMetadata("jvmName") + @TestMetadata("jvmName.kt") public void testJvmName() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmName/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmName.kt"); + doTest(fileName); } - @TestMetadata("mangling") + @TestMetadata("mangling.kt") public void testMangling() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/mangling/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/mangling.kt"); + doTest(fileName); } - @TestMetadata("number") + @TestMetadata("number.kt") public void testNumber() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/number/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/number.kt"); + doTest(fileName); } - @TestMetadata("protectedInInline") + @TestMetadata("protectedInInline.kt") public void testProtectedInInline() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/protectedInInline/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/protectedInInline.kt"); + doTest(fileName); } - @TestMetadata("varargs") + @TestMetadata("varargs.kt") public void testVarargs() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/varargs/"); - doTestWithJava(fileName); - } - - @TestMetadata("compiler/testData/codegen/boxWithJava/annotatedFileClasses") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class AnnotatedFileClasses extends AbstractBlackBoxCodegenTest { - public void testAllFilesPresentInAnnotatedFileClasses() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/annotatedFileClasses"), Pattern.compile("^([^\\.]+)$"), true); - } - - @TestMetadata("javaAnnotationOnFileFacade") - public void testJavaAnnotationOnFileFacade() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/annotatedFileClasses/javaAnnotationOnFileFacade/"); - doTestWithJava(fileName); - } - + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/varargs.kt"); + doTest(fileName); } @TestMetadata("compiler/testData/codegen/boxWithJava/annotationsWithKClass") @@ -176,27 +154,26 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege @RunWith(JUnit3RunnerWithInners.class) public static class AnnotationsWithKClass extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInAnnotationsWithKClass() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/annotationsWithKClass"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/annotationsWithKClass"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("array") + @TestMetadata("array.kt") public void testArray() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/annotationsWithKClass/array/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/annotationsWithKClass/array.kt"); + doTest(fileName); } - @TestMetadata("basic") + @TestMetadata("basic.kt") public void testBasic() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/annotationsWithKClass/basic/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/annotationsWithKClass/basic.kt"); + doTest(fileName); } - @TestMetadata("vararg") + @TestMetadata("vararg.kt") public void testVararg() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/annotationsWithKClass/vararg/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/annotationsWithKClass/vararg.kt"); + doTest(fileName); } - } @TestMetadata("compiler/testData/codegen/boxWithJava/builtinStubMethods") @@ -204,27 +181,26 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege @RunWith(JUnit3RunnerWithInners.class) public static class BuiltinStubMethods extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInBuiltinStubMethods() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/builtinStubMethods"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/builtinStubMethods"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("extendJavaCollections") + @TestMetadata("extendJavaCollections.kt") public void testExtendJavaCollections() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/builtinStubMethods/extendJavaCollections.kt"); + doTest(fileName); } - @TestMetadata("substitutedIterable") + @TestMetadata("substitutedIterable.kt") public void testSubstitutedIterable() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedIterable/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedIterable.kt"); + doTest(fileName); } - @TestMetadata("substitutedList") + @TestMetadata("substitutedList.kt") public void testSubstitutedList() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedList/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/builtinStubMethods/substitutedList.kt"); + doTest(fileName); } - } @TestMetadata("compiler/testData/codegen/boxWithJava/casts") @@ -232,21 +208,20 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege @RunWith(JUnit3RunnerWithInners.class) public static class Casts extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInCasts() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/casts"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/casts"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("javaTypeIsFunK") + @TestMetadata("javaTypeIsFunK.kt") public void testJavaTypeIsFunK() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/casts/javaTypeIsFunK/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/casts/javaTypeIsFunK.kt"); + doTest(fileName); } - @TestMetadata("literalExpressionAsGenericArgument") + @TestMetadata("literalExpressionAsGenericArgument.kt") public void testLiteralExpressionAsGenericArgument() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/casts/literalExpressionAsGenericArgument/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/casts/literalExpressionAsGenericArgument.kt"); + doTest(fileName); } - } @TestMetadata("compiler/testData/codegen/boxWithJava/collections") @@ -254,99 +229,98 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege @RunWith(JUnit3RunnerWithInners.class) public static class Collections extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInCollections() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/collections"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/collections"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("charSequence") + @TestMetadata("charSequence.kt") public void testCharSequence() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/charSequence/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/charSequence.kt"); + doTest(fileName); } - @TestMetadata("implementCollectionThroughKotlin") + @TestMetadata("implementCollectionThroughKotlin.kt") public void testImplementCollectionThroughKotlin() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/implementCollectionThroughKotlin/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/implementCollectionThroughKotlin.kt"); + doTest(fileName); } - @TestMetadata("irrelevantImplCharSequence") + @TestMetadata("irrelevantImplCharSequence.kt") public void testIrrelevantImplCharSequence() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequence/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequence.kt"); + doTest(fileName); } - @TestMetadata("irrelevantImplCharSequenceKotlin") + @TestMetadata("irrelevantImplCharSequenceKotlin.kt") public void testIrrelevantImplCharSequenceKotlin() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequenceKotlin/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/irrelevantImplCharSequenceKotlin.kt"); + doTest(fileName); } - @TestMetadata("irrelevantImplMutableList") + @TestMetadata("irrelevantImplMutableList.kt") public void testIrrelevantImplMutableList() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableList/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableList.kt"); + doTest(fileName); } - @TestMetadata("irrelevantImplMutableListKotlin") + @TestMetadata("irrelevantImplMutableListKotlin.kt") public void testIrrelevantImplMutableListKotlin() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListKotlin/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListKotlin.kt"); + doTest(fileName); } - @TestMetadata("irrelevantImplMutableListSubstitution") + @TestMetadata("irrelevantImplMutableListSubstitution.kt") public void testIrrelevantImplMutableListSubstitution() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListSubstitution/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/irrelevantImplMutableListSubstitution.kt"); + doTest(fileName); } - @TestMetadata("irrelevantRemoveAtOverrideInJava") + @TestMetadata("irrelevantRemoveAtOverrideInJava.kt") public void testIrrelevantRemoveAtOverrideInJava() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/irrelevantRemoveAtOverrideInJava/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/irrelevantRemoveAtOverrideInJava.kt"); + doTest(fileName); } - @TestMetadata("irrelevantSizeOverrideInJava") + @TestMetadata("irrelevantSizeOverrideInJava.kt") public void testIrrelevantSizeOverrideInJava() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/irrelevantSizeOverrideInJava/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/irrelevantSizeOverrideInJava.kt"); + doTest(fileName); } - @TestMetadata("mutableList") + @TestMetadata("mutableList.kt") public void testMutableList() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/mutableList/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/mutableList.kt"); + doTest(fileName); } - @TestMetadata("platformValueContains") + @TestMetadata("platformValueContains.kt") public void testPlatformValueContains() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/platformValueContains/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/platformValueContains.kt"); + doTest(fileName); } - @TestMetadata("readOnlyList") + @TestMetadata("readOnlyList.kt") public void testReadOnlyList() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/readOnlyList/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/readOnlyList.kt"); + doTest(fileName); } - @TestMetadata("readOnlyMap") + @TestMetadata("readOnlyMap.kt") public void testReadOnlyMap() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/readOnlyMap/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/readOnlyMap.kt"); + doTest(fileName); } - @TestMetadata("removeAtInt") + @TestMetadata("removeAtInt.kt") public void testRemoveAtInt() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/removeAtInt/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/removeAtInt.kt"); + doTest(fileName); } - @TestMetadata("strList") + @TestMetadata("strList.kt") public void testStrList() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/strList/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/collections/strList.kt"); + doTest(fileName); } - } @TestMetadata("compiler/testData/codegen/boxWithJava/fileClasses") @@ -354,61 +328,65 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege @RunWith(JUnit3RunnerWithInners.class) public static class FileClasses extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInFileClasses() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/fileClasses"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/fileClasses"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("differentFiles") + @TestMetadata("differentFiles.kt") public void testDifferentFiles() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/fileClasses/differentFiles/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/fileClasses/differentFiles.kt"); + doTest(fileName); } - @TestMetadata("multifileClassWith2Files") + @TestMetadata("javaAnnotationOnFileFacade.kt") + public void testJavaAnnotationOnFileFacade() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/fileClasses/javaAnnotationOnFileFacade.kt"); + doTest(fileName); + } + + @TestMetadata("multifileClassWith2Files.kt") public void testMultifileClassWith2Files() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWith2Files/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWith2Files.kt"); + doTest(fileName); } - @TestMetadata("multifileClassWithCrossCall") + @TestMetadata("multifileClassWithCrossCall.kt") public void testMultifileClassWithCrossCall() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithCrossCall/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithCrossCall.kt"); + doTest(fileName); } - @TestMetadata("multifileClassWithPrivate") + @TestMetadata("multifileClassWithPrivate.kt") public void testMultifileClassWithPrivate() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithPrivate/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/fileClasses/multifileClassWithPrivate.kt"); + doTest(fileName); } - @TestMetadata("simple") + @TestMetadata("simple.kt") public void testSimple() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/fileClasses/simple/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/fileClasses/simple.kt"); + doTest(fileName); } - } @TestMetadata("compiler/testData/codegen/boxWithJava/interfaces") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class Interfaces extends AbstractBlackBoxCodegenTest { - @TestMetadata("abstractClassInheritsFromInterface") + @TestMetadata("abstractClassInheritsFromInterface.kt") public void testAbstractClassInheritsFromInterface() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface.kt"); + doTest(fileName); } public void testAllFilesPresentInInterfaces() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/interfaces"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/interfaces"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("inheritJavaInterface") + @TestMetadata("inheritJavaInterface.kt") public void testInheritJavaInterface() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/interfaces/inheritJavaInterface/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/interfaces/inheritJavaInterface.kt"); + doTest(fileName); } - } @TestMetadata("compiler/testData/codegen/boxWithJava/javaProperty") @@ -416,21 +394,20 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege @RunWith(JUnit3RunnerWithInners.class) public static class JavaProperty extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInJavaProperty() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/javaProperty"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/javaProperty"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("boxedGetter") + @TestMetadata("boxedGetter.kt") public void testBoxedGetter() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/javaProperty/boxedGetter/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/javaProperty/boxedGetter.kt"); + doTest(fileName); } - @TestMetadata("boxedSetter") + @TestMetadata("boxedSetter.kt") public void testBoxedSetter() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/javaProperty/boxedSetter/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/javaProperty/boxedSetter.kt"); + doTest(fileName); } - } @TestMetadata("compiler/testData/codegen/boxWithJava/jvmField") @@ -438,21 +415,20 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege @RunWith(JUnit3RunnerWithInners.class) public static class JvmField extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInJvmField() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/jvmField"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/jvmField"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("constructorProperty") + @TestMetadata("constructorProperty.kt") public void testConstructorProperty() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmField/constructorProperty/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmField/constructorProperty.kt"); + doTest(fileName); } - @TestMetadata("simple") + @TestMetadata("simple.kt") public void testSimple() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmField/simple/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmField/simple.kt"); + doTest(fileName); } - } @TestMetadata("compiler/testData/codegen/boxWithJava/jvmOverloads") @@ -460,21 +436,20 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege @RunWith(JUnit3RunnerWithInners.class) public static class JvmOverloads extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInJvmOverloads() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/jvmOverloads"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/jvmOverloads"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("generics") + @TestMetadata("generics.kt") public void testGenerics() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmOverloads/generics/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmOverloads/generics.kt"); + doTest(fileName); } - @TestMetadata("simple") + @TestMetadata("simple.kt") public void testSimple() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmOverloads/simple/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmOverloads/simple.kt"); + doTest(fileName); } - } @TestMetadata("compiler/testData/codegen/boxWithJava/jvmStatic") @@ -482,33 +457,32 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege @RunWith(JUnit3RunnerWithInners.class) public static class JvmStatic extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInJvmStatic() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/jvmStatic"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/jvmStatic"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("annotations") + @TestMetadata("annotations.kt") public void testAnnotations() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmStatic/annotations/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmStatic/annotations.kt"); + doTest(fileName); } - @TestMetadata("classObject") - public void testClassObject() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmStatic/classObject/"); - doTestWithJava(fileName); + @TestMetadata("companionObject.kt") + public void testCompanionObject() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmStatic/companionObject.kt"); + doTest(fileName); } - @TestMetadata("enumCompanion") + @TestMetadata("enumCompanion.kt") public void testEnumCompanion() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmStatic/enumCompanion/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmStatic/enumCompanion.kt"); + doTest(fileName); } - @TestMetadata("object") + @TestMetadata("object.kt") public void testObject() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmStatic/object/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/jvmStatic/object.kt"); + doTest(fileName); } - } @TestMetadata("compiler/testData/codegen/boxWithJava/notNullAssertions") @@ -516,15 +490,14 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege @RunWith(JUnit3RunnerWithInners.class) public static class NotNullAssertions extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInNotNullAssertions() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/notNullAssertions"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/notNullAssertions"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("extensionReceiverParameter") + @TestMetadata("extensionReceiverParameter.kt") public void testExtensionReceiverParameter() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/notNullAssertions/extensionReceiverParameter/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/notNullAssertions/extensionReceiverParameter.kt"); + doTest(fileName); } - } @TestMetadata("compiler/testData/codegen/boxWithJava/properties") @@ -532,57 +505,56 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege @RunWith(JUnit3RunnerWithInners.class) public static class Properties extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInProperties() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/properties"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/properties"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("annotationWithKotlinProperty") + @TestMetadata("annotationWithKotlinProperty.kt") public void testAnnotationWithKotlinProperty() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinProperty.kt"); + doTest(fileName); } - @TestMetadata("annotationWithKotlinPropertyFromInterfaceCompanion") + @TestMetadata("annotationWithKotlinPropertyFromInterfaceCompanion.kt") public void testAnnotationWithKotlinPropertyFromInterfaceCompanion() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinPropertyFromInterfaceCompanion/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/annotationWithKotlinPropertyFromInterfaceCompanion.kt"); + doTest(fileName); } - @TestMetadata("classObjectProperties") - public void testClassObjectProperties() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/classObjectProperties/"); - doTestWithJava(fileName); - } - - @TestMetadata("collectionSize") + @TestMetadata("collectionSize.kt") public void testCollectionSize() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/collectionSize/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/collectionSize.kt"); + doTest(fileName); } - @TestMetadata("commonProperties") + @TestMetadata("commonProperties.kt") public void testCommonProperties() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/commonProperties/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/commonProperties.kt"); + doTest(fileName); } - @TestMetadata("protectedJavaProperty") + @TestMetadata("companionObjectProperties.kt") + public void testCompanionObjectProperties() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/companionObjectProperties.kt"); + doTest(fileName); + } + + @TestMetadata("protectedJavaProperty.kt") public void testProtectedJavaProperty() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/protectedJavaProperty/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/protectedJavaProperty.kt"); + doTest(fileName); } - @TestMetadata("protectedJavaPropertyInCompanion") + @TestMetadata("protectedJavaPropertyInCompanion.kt") public void testProtectedJavaPropertyInCompanion() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/protectedJavaPropertyInCompanion/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/protectedJavaPropertyInCompanion.kt"); + doTest(fileName); } - @TestMetadata("substituteJavaSuperField") + @TestMetadata("substituteJavaSuperField.kt") public void testSubstituteJavaSuperField() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/substituteJavaSuperField/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/properties/substituteJavaSuperField.kt"); + doTest(fileName); } - } @TestMetadata("compiler/testData/codegen/boxWithJava/reflection") @@ -590,129 +562,128 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege @RunWith(JUnit3RunnerWithInners.class) public static class Reflection extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInReflection() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/reflection"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/reflection"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("annotationsOnJavaMembers") + @TestMetadata("annotationsOnJavaMembers.kt") public void testAnnotationsOnJavaMembers() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/annotationsOnJavaMembers/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/annotationsOnJavaMembers.kt"); + doTest(fileName); } - @TestMetadata("callInstanceJavaMethod") + @TestMetadata("callInstanceJavaMethod.kt") public void testCallInstanceJavaMethod() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/callInstanceJavaMethod/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/callInstanceJavaMethod.kt"); + doTest(fileName); } - @TestMetadata("callPrivateJavaMethod") + @TestMetadata("callPrivateJavaMethod.kt") public void testCallPrivateJavaMethod() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/callPrivateJavaMethod.kt"); + doTest(fileName); } - @TestMetadata("callStaticJavaMethod") + @TestMetadata("callStaticJavaMethod.kt") public void testCallStaticJavaMethod() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/callStaticJavaMethod/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/callStaticJavaMethod.kt"); + doTest(fileName); } - @TestMetadata("declaredVsInheritedFunctions") + @TestMetadata("declaredVsInheritedFunctions.kt") public void testDeclaredVsInheritedFunctions() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedFunctions/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedFunctions.kt"); + doTest(fileName); } - @TestMetadata("declaredVsInheritedProperties") + @TestMetadata("declaredVsInheritedProperties.kt") public void testDeclaredVsInheritedProperties() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedProperties/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/declaredVsInheritedProperties.kt"); + doTest(fileName); } - @TestMetadata("functionReferenceErasedToKFunction") + @TestMetadata("functionReferenceErasedToKFunction.kt") public void testFunctionReferenceErasedToKFunction() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/functionReferenceErasedToKFunction/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/functionReferenceErasedToKFunction.kt"); + doTest(fileName); } - @TestMetadata("javaClassGetFunctions") + @TestMetadata("javaClassGetFunctions.kt") public void testJavaClassGetFunctions() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/javaClassGetFunctions/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/javaClassGetFunctions.kt"); + doTest(fileName); } - @TestMetadata("javaMethodsSmokeTest") + @TestMetadata("javaMethodsSmokeTest.kt") public void testJavaMethodsSmokeTest() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/javaMethodsSmokeTest/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/javaMethodsSmokeTest.kt"); + doTest(fileName); } - @TestMetadata("javaPropertyInheritedInKotlin") + @TestMetadata("javaPropertyInheritedInKotlin.kt") public void testJavaPropertyInheritedInKotlin() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/javaPropertyInheritedInKotlin/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/javaPropertyInheritedInKotlin.kt"); + doTest(fileName); } - @TestMetadata("javaStaticField") + @TestMetadata("javaStaticField.kt") public void testJavaStaticField() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/javaStaticField/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/javaStaticField.kt"); + doTest(fileName); } - @TestMetadata("kotlinPropertyInheritedInJava") + @TestMetadata("kotlinPropertyInheritedInJava.kt") public void testKotlinPropertyInheritedInJava() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/kotlinPropertyInheritedInJava/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/kotlinPropertyInheritedInJava.kt"); + doTest(fileName); } - @TestMetadata("mutatePrivateJavaInstanceField") + @TestMetadata("mutatePrivateJavaInstanceField.kt") public void testMutatePrivateJavaInstanceField() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaInstanceField/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaInstanceField.kt"); + doTest(fileName); } - @TestMetadata("mutatePrivateJavaStaticField") + @TestMetadata("mutatePrivateJavaStaticField.kt") public void testMutatePrivateJavaStaticField() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaStaticField/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/mutatePrivateJavaStaticField.kt"); + doTest(fileName); } - @TestMetadata("nestedClasses") + @TestMetadata("nestedClasses.kt") public void testNestedClasses() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/nestedClasses/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/nestedClasses.kt"); + doTest(fileName); } - @TestMetadata("noConflictOnKotlinGetterAndJavaField") + @TestMetadata("noConflictOnKotlinGetterAndJavaField.kt") public void testNoConflictOnKotlinGetterAndJavaField() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/noConflictOnKotlinGetterAndJavaField/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/noConflictOnKotlinGetterAndJavaField.kt"); + doTest(fileName); } - @TestMetadata("parametersHaveNoNames") + @TestMetadata("parametersHaveNoNames.kt") public void testParametersHaveNoNames() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/parametersHaveNoNames.kt"); + doTest(fileName); } - @TestMetadata("platformTypeNotEqualToKotlinType") + @TestMetadata("platformTypeNotEqualToKotlinType.kt") public void testPlatformTypeNotEqualToKotlinType() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/platformTypeNotEqualToKotlinType/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/platformTypeNotEqualToKotlinType.kt"); + doTest(fileName); } - @TestMetadata("platformTypeToString") + @TestMetadata("platformTypeToString.kt") public void testPlatformTypeToString() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/platformTypeToString/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/platformTypeToString.kt"); + doTest(fileName); } - @TestMetadata("referenceToJavaFieldOfKotlinSubclass") + @TestMetadata("referenceToJavaFieldOfKotlinSubclass.kt") public void testReferenceToJavaFieldOfKotlinSubclass() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/referenceToJavaFieldOfKotlinSubclass/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reflection/referenceToJavaFieldOfKotlinSubclass.kt"); + doTest(fileName); } - } @TestMetadata("compiler/testData/codegen/boxWithJava/reified") @@ -720,21 +691,20 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege @RunWith(JUnit3RunnerWithInners.class) public static class Reified extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInReified() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/reified"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/reified"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("asCheck") + @TestMetadata("asCheck.kt") public void testAsCheck() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reified/asCheck/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reified/asCheck.kt"); + doTest(fileName); } - @TestMetadata("isCheck") + @TestMetadata("isCheck.kt") public void testIsCheck() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reified/isCheck/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/reified/isCheck.kt"); + doTest(fileName); } - } @TestMetadata("compiler/testData/codegen/boxWithJava/secondaryConstructors") @@ -742,33 +712,32 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege @RunWith(JUnit3RunnerWithInners.class) public static class SecondaryConstructors extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInSecondaryConstructors() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/secondaryConstructors"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/secondaryConstructors"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("withGenerics") + @TestMetadata("withGenerics.kt") public void testWithGenerics() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/secondaryConstructors/withGenerics/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/secondaryConstructors/withGenerics.kt"); + doTest(fileName); } - @TestMetadata("withPrimary") + @TestMetadata("withPrimary.kt") public void testWithPrimary() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/secondaryConstructors/withPrimary/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/secondaryConstructors/withPrimary.kt"); + doTest(fileName); } - @TestMetadata("withVarargs") + @TestMetadata("withVarargs.kt") public void testWithVarargs() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/secondaryConstructors/withVarargs/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/secondaryConstructors/withVarargs.kt"); + doTest(fileName); } - @TestMetadata("withoutPrimary") + @TestMetadata("withoutPrimary.kt") public void testWithoutPrimary() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/secondaryConstructors/withoutPrimary.kt"); + doTest(fileName); } - } @TestMetadata("compiler/testData/codegen/boxWithJava/statics") @@ -776,51 +745,49 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege @RunWith(JUnit3RunnerWithInners.class) public static class Statics extends AbstractBlackBoxCodegenTest { public void testAllFilesPresentInStatics() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/statics"), Pattern.compile("^([^\\.]+)$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/statics"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("fields") + @TestMetadata("fields.kt") public void testFields() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/statics/fields/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/statics/fields.kt"); + doTest(fileName); } - @TestMetadata("functions") + @TestMetadata("functions.kt") public void testFunctions() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/statics/functions/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/statics/functions.kt"); + doTest(fileName); } - @TestMetadata("hidePrivateByPublic") + @TestMetadata("hidePrivateByPublic.kt") public void testHidePrivateByPublic() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/statics/hidePrivateByPublic.kt"); + doTest(fileName); } - @TestMetadata("protectedSamConstructor") + @TestMetadata("protectedSamConstructor.kt") public void testProtectedSamConstructor() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/statics/protectedSamConstructor/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/statics/protectedSamConstructor.kt"); + doTest(fileName); } - @TestMetadata("protectedStatic") + @TestMetadata("protectedStatic.kt") public void testProtectedStatic() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/statics/protectedStatic/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/statics/protectedStatic.kt"); + doTest(fileName); } - @TestMetadata("protectedStatic2") + @TestMetadata("protectedStatic2.kt") public void testProtectedStatic2() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/statics/protectedStatic2/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/statics/protectedStatic2.kt"); + doTest(fileName); } - @TestMetadata("protectedStaticAndInline") + @TestMetadata("protectedStaticAndInline.kt") public void testProtectedStaticAndInline() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/statics/protectedStaticAndInline/"); - doTestWithJava(fileName); + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/statics/protectedStaticAndInline.kt"); + doTest(fileName); } - } - } diff --git a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index e3e5247d2ad..558058d7849 100644 --- a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -213,7 +213,7 @@ fun main(args: Array) { } testClass("BlackBoxWithJavaCodegenTestGenerated") { - model("codegen/boxWithJava", testMethod = "doTestWithJava", extension = null, recursive = true, excludeParentDirs = true) + model("codegen/boxWithJava") } testClass("BlackBoxWithStdlibCodegenTestGenerated") { @@ -348,7 +348,7 @@ fun main(args: Array) { testGroup("compiler/java8-tests/tests", "compiler/testData") { testClass("BlackBoxWithJava8CodegenTestGenerated") { - model("codegen/java8/boxWithJava", testMethod = "doTestWithJava", extension = null, recursive = true, excludeParentDirs = true) + model("codegen/java8/box") } testClass("DiagnosticsWithJava8TestGenerated") { model("diagnostics/testsWithJava8")