Merge boxWithJava testData into box, delete BoxWithJava test
This commit is contained in:
committed by
Alexander Udalov
parent
16a0ddd2fb
commit
f8dfaf4599
@@ -0,0 +1,19 @@
|
||||
// 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 {
|
||||
fun foo() = "OK"
|
||||
}
|
||||
|
||||
abstract class KC: T {}
|
||||
|
||||
fun box() = ExtendsKCWithT.bar()
|
||||
@@ -0,0 +1,20 @@
|
||||
// FILE: MyInt.java
|
||||
|
||||
public interface MyInt {
|
||||
|
||||
String test();
|
||||
}
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
interface A : MyInt {
|
||||
override public fun test(): String? {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
|
||||
class B: A
|
||||
|
||||
fun box() : String {
|
||||
return B().test()!!
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// FILE: B.java
|
||||
|
||||
class B {
|
||||
static String test(A x) {
|
||||
return A.DefaultImpls.foo(x);
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
interface A {
|
||||
fun foo() = "OK"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val result = B.test(object : A {})
|
||||
if (result != "OK") return "fail: $result"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user