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);
|
||||
}
|
||||
Reference in New Issue
Block a user