Added tests with SAM adapter overridden in Kotlin class.
This commit is contained in:
+7
@@ -0,0 +1,7 @@
|
|||||||
|
class Super {
|
||||||
|
public String lastCalled = null;
|
||||||
|
|
||||||
|
void foo(Runnable r) {
|
||||||
|
lastCalled = "super";
|
||||||
|
}
|
||||||
|
}
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
class Sub() : Super() {
|
||||||
|
override fun foo(r : (() -> Unit)?) {
|
||||||
|
lastCalled = "sub"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val sub = Sub()
|
||||||
|
|
||||||
|
(sub : Super).foo{ }
|
||||||
|
if (sub.lastCalled != "super") {
|
||||||
|
return "FAIL: ${sub.lastCalled} instead of super"
|
||||||
|
}
|
||||||
|
|
||||||
|
sub.foo{ }
|
||||||
|
if (sub.lastCalled != "sub") {
|
||||||
|
return "FAIL: ${sub.lastCalled} instead of sub"
|
||||||
|
}
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
public final class Sub : test.Super {
|
||||||
|
public constructor Sub()
|
||||||
|
internal open override /*1*/ fun foo(/*0*/ r: (() -> jet.Unit)?): jet.Unit
|
||||||
|
internal open override /*1*/ /*fake_override*/ fun foo(/*0*/ r: java.lang.Runnable?): jet.Unit
|
||||||
|
}
|
||||||
|
|
||||||
|
public open class Super : java.lang.Object {
|
||||||
|
public constructor Super()
|
||||||
|
public/*package*/ open /*synthesized*/ fun foo(/*0*/ r: (() -> jet.Unit)?): jet.Unit
|
||||||
|
public/*package*/ open fun foo(/*0*/ r: java.lang.Runnable?): jet.Unit
|
||||||
|
}
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
package test
|
||||||
|
|
||||||
|
public class Sub: Super() {
|
||||||
|
override fun foo(r: (() -> Unit)?) {
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package test;
|
||||||
|
|
||||||
|
public class Super {
|
||||||
|
void foo(Runnable r);
|
||||||
|
}
|
||||||
+5
@@ -160,6 +160,11 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
|
|||||||
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/inheritedOverriddenAdapter.kt");
|
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/inheritedOverriddenAdapter.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inheritedOverriddenAdapterInKotlin.kt")
|
||||||
|
public void testInheritedOverriddenAdapterInKotlin() throws Exception {
|
||||||
|
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/inheritedOverriddenAdapterInKotlin.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("inheritedSimple.kt")
|
@TestMetadata("inheritedSimple.kt")
|
||||||
public void testInheritedSimple() throws Exception {
|
public void testInheritedSimple() throws Exception {
|
||||||
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/inheritedSimple.kt");
|
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/inheritedSimple.kt");
|
||||||
|
|||||||
@@ -1427,6 +1427,11 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
|
|||||||
doTestJavaAgainstKotlin("compiler/testData/loadJava/javaAgainstKotlin/samAdapters/InheritSamAdapterInKotlin.txt");
|
doTestJavaAgainstKotlin("compiler/testData/loadJava/javaAgainstKotlin/samAdapters/InheritSamAdapterInKotlin.txt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("OverrideSamAdapterInKotlin.txt")
|
||||||
|
public void testOverrideSamAdapterInKotlin() throws Exception {
|
||||||
|
doTestJavaAgainstKotlin("compiler/testData/loadJava/javaAgainstKotlin/samAdapters/OverrideSamAdapterInKotlin.txt");
|
||||||
|
}
|
||||||
|
|
||||||
public static Test innerSuite() {
|
public static Test innerSuite() {
|
||||||
TestSuite suite = new TestSuite("SamAdapters");
|
TestSuite suite = new TestSuite("SamAdapters");
|
||||||
suite.addTestSuite(SamAdapters.class);
|
suite.addTestSuite(SamAdapters.class);
|
||||||
|
|||||||
Reference in New Issue
Block a user