Added tests with SAM adapter overridden in Java class.
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
class Super {
|
||||
public String lastCalled = null;
|
||||
|
||||
void foo(Runnable r) {
|
||||
lastCalled = "super";
|
||||
}
|
||||
}
|
||||
|
||||
class Sub extends Super {
|
||||
void foo(jet.Function0<jet.Unit> r) {
|
||||
lastCalled = "sub";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
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 interface InheritedOverriddenAdapter {
|
||||
public class Super {
|
||||
public void foo(Runnable r) {
|
||||
}
|
||||
}
|
||||
|
||||
public class Sub extends Super {
|
||||
public void foo(jet.Function0<jet.Unit> r) {
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package test
|
||||
|
||||
public trait InheritedOverriddenAdapter : java.lang.Object {
|
||||
|
||||
public open class Sub : test.InheritedOverriddenAdapter.Super {
|
||||
public constructor Sub()
|
||||
public open override /*1*/ fun foo(/*0*/ p0: (() -> jet.Unit)?): jet.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun foo(/*0*/ p0: java.lang.Runnable?): jet.Unit
|
||||
}
|
||||
|
||||
public open class Super : java.lang.Object {
|
||||
public constructor Super()
|
||||
public open /*synthesized*/ fun foo(/*0*/ p0: (() -> jet.Unit)?): jet.Unit
|
||||
public open fun foo(/*0*/ p0: java.lang.Runnable?): jet.Unit
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ public abstract class AbstractBlackBoxCodegenTest extends CodegenTestCase {
|
||||
File javaClassesTempDirectory = compileJava(ktFile.replaceFirst("\\.kt$", ".java"));
|
||||
|
||||
myEnvironment = new JetCoreEnvironment(getTestRootDisposable(), JetTestUtils.compilerConfigurationForTests(
|
||||
ConfigurationKind.JDK_AND_ANNOTATIONS, TestJdkKind.MOCK_JDK, JetTestUtils.getAnnotationsJar(), javaClassesTempDirectory));
|
||||
ConfigurationKind.ALL, TestJdkKind.MOCK_JDK, JetTestUtils.getAnnotationsJar(), javaClassesTempDirectory));
|
||||
|
||||
loadFile(ktFile);
|
||||
blackBox();
|
||||
|
||||
+5
@@ -150,6 +150,11 @@ public class BlackBoxWithJavaCodegenTestGenerated extends AbstractBlackBoxCodege
|
||||
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/fileFilter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inheritedOverriddenAdapter.kt")
|
||||
public void testInheritedOverriddenAdapter() throws Exception {
|
||||
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/inheritedOverriddenAdapter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inheritedSimple.kt")
|
||||
public void testInheritedSimple() throws Exception {
|
||||
doTestWithJava("compiler/testData/codegen/boxWithJava/samAdapters/inheritedSimple.kt");
|
||||
|
||||
@@ -1274,6 +1274,11 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest {
|
||||
doTestCompiledJava("compiler/testData/loadJava/compiledJava/singleAbstractMethod/adapter/InheritedOverridden.java");
|
||||
}
|
||||
|
||||
@TestMetadata("InheritedOverriddenAdapter.java")
|
||||
public void testInheritedOverriddenAdapter() throws Exception {
|
||||
doTestCompiledJava("compiler/testData/loadJava/compiledJava/singleAbstractMethod/adapter/InheritedOverriddenAdapter.java");
|
||||
}
|
||||
|
||||
@TestMetadata("InheritedSimple.java")
|
||||
public void testInheritedSimple() throws Exception {
|
||||
doTestCompiledJava("compiler/testData/loadJava/compiledJava/singleAbstractMethod/adapter/InheritedSimple.java");
|
||||
|
||||
Reference in New Issue
Block a user