diff --git a/compiler/testData/codegen/boxAgainstJava/sam/kt4753.java b/compiler/testData/codegen/boxAgainstJava/sam/kt4753.java new file mode 100644 index 00000000000..a8989e7017f --- /dev/null +++ b/compiler/testData/codegen/boxAgainstJava/sam/kt4753.java @@ -0,0 +1,6 @@ +interface Base { + void call(T t); +} + +interface Derived extends Base { +} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/kt4753.kt b/compiler/testData/codegen/boxAgainstJava/sam/kt4753.kt new file mode 100644 index 00000000000..07c6dadf65e --- /dev/null +++ b/compiler/testData/codegen/boxAgainstJava/sam/kt4753.kt @@ -0,0 +1,5 @@ +fun box(): String { + Base{}.call("") + Derived{}.call("") + return "OK" +} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/kt4753_2.java b/compiler/testData/codegen/boxAgainstJava/sam/kt4753_2.java new file mode 100644 index 00000000000..6ff3b5e69e6 --- /dev/null +++ b/compiler/testData/codegen/boxAgainstJava/sam/kt4753_2.java @@ -0,0 +1,8 @@ +class ParamBase {} + +interface F extends FBase> { +} + +interface FBase { + void call(T t); +} diff --git a/compiler/testData/codegen/boxAgainstJava/sam/kt4753_2.kt b/compiler/testData/codegen/boxAgainstJava/sam/kt4753_2.kt new file mode 100644 index 00000000000..f492b48eb3a --- /dev/null +++ b/compiler/testData/codegen/boxAgainstJava/sam/kt4753_2.kt @@ -0,0 +1,4 @@ +fun box(): String { + F>({}).call(ParamBase()) + return "OK" +} diff --git a/compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface/ExtendsKCWithT.java b/compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface/ExtendsKCWithT.java new file mode 100644 index 00000000000..ca7ed42961a --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface/ExtendsKCWithT.java @@ -0,0 +1,5 @@ +public class ExtendsKCWithT extends KC { + public static String bar() { + return new ExtendsKCWithT().foo(); + } +} diff --git a/compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface/KC.kt b/compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface/KC.kt new file mode 100644 index 00000000000..e8accf40d01 --- /dev/null +++ b/compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface/KC.kt @@ -0,0 +1,9 @@ +// KT-3407 Implementing (in Java) an abstract Kotlin class that implements a trait does not respect trait method definition + +trait T { + fun foo() = "OK" +} + +abstract class KC: T {} + +fun box() = ExtendsKCWithT.bar() diff --git a/compiler/testData/codegen/boxWithJava/trait/MyInt.java b/compiler/testData/codegen/boxWithJava/interfaces/inheritJavaInterface/MyInt.java similarity index 100% rename from compiler/testData/codegen/boxWithJava/trait/MyInt.java rename to compiler/testData/codegen/boxWithJava/interfaces/inheritJavaInterface/MyInt.java diff --git a/compiler/testData/codegen/boxWithJava/trait/interfaceInheritance.kt b/compiler/testData/codegen/boxWithJava/interfaces/inheritJavaInterface/interfaceInheritance.kt similarity index 100% rename from compiler/testData/codegen/boxWithJava/trait/interfaceInheritance.kt rename to compiler/testData/codegen/boxWithJava/interfaces/inheritJavaInterface/interfaceInheritance.kt diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxAgainstJavaCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxAgainstJavaCodegenTestGenerated.java index e1fbb449f6e..a37e80bc007 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxAgainstJavaCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxAgainstJavaCodegenTestGenerated.java @@ -526,6 +526,18 @@ public class BlackBoxAgainstJavaCodegenTestGenerated extends AbstractBlackBoxCod doTestAgainstJava(fileName); } + @TestMetadata("kt4753.kt") + public void testKt4753() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/kt4753.kt"); + doTestAgainstJava(fileName); + } + + @TestMetadata("kt4753_2.kt") + public void testKt4753_2() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/kt4753_2.kt"); + doTestAgainstJava(fileName); + } + @TestMetadata("samConstructorGenericSignature.kt") public void testSamConstructorGenericSignature() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxAgainstJava/sam/samConstructorGenericSignature.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java index d5eb7f34ec3..0d59069e2e2 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/generated/BlackBoxWithJavaCodegenTestGenerated.java @@ -71,12 +71,6 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege doTestWithJava(fileName); } - @TestMetadata("trait") - public void testTrait() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/trait/"); - doTestWithJava(fileName); - } - @TestMetadata("compiler/testData/codegen/boxWithJava/annotationsWithKClass") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -133,6 +127,28 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege } + @TestMetadata("compiler/testData/codegen/boxWithJava/interfaces") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Interfaces extends AbstractBlackBoxCodegenTest { + @TestMetadata("abstractClassInheritsFromInterface") + public void testAbstractClassInheritsFromInterface() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/interfaces/abstractClassInheritsFromInterface/"); + doTestWithJava(fileName); + } + + public void testAllFilesPresentInInterfaces() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/boxWithJava/interfaces"), Pattern.compile("^([^\\.]+)$"), true); + } + + @TestMetadata("inheritJavaInterface") + public void testInheritJavaInterface() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxWithJava/interfaces/inheritJavaInterface/"); + doTestWithJava(fileName); + } + + } + @TestMetadata("compiler/testData/codegen/boxWithJava/jvmOverloads") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -288,5 +304,4 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege } } - }