Generate same delagation structure as in jvm 6 target until new binary compatibility design

We need to make some decision about binary compatibility beetwen targets and semantics, so now old logic is used
This commit is contained in:
Mikhael Bogdanov
2016-05-24 16:11:14 +03:00
parent bb59638039
commit 1c3ce93275
11 changed files with 278 additions and 33 deletions
+48
View File
@@ -0,0 +1,48 @@
// KOTLIN_CONFIGURATION_FLAGS: +JVM.JVM_8_TARGET
// WITH_REFLECT
// FULL_JDK
interface Test {
fun test(): String {
return "Test"
}
}
open class TestClass : Test {
}
interface Test2 : Test {
override fun test(): String {
return "Test2"
}
}
interface Test3 : Test2 {
}
class TestClass2 : TestClass(), Test3 {
}
fun box(): String {
val test = TestClass2().test()
if (test != "Test2") return "fail 1: $test"
// checkNoMethod(TestClass::class.java, "test")
// checkNoMethod(Test3::class.java, "test")
// checkNoMethod(TestClass2::class.java, "test")
return "OK"
}
fun checkNoMethod(clazz: Class<*>, name: String) {
try {
clazz.getDeclaredMethod("test")
}
catch (e: NoSuchMethodException) {
return
}
throw java.lang.AssertionError("fail " + clazz)
}
@@ -11,11 +11,12 @@ class TestClass : Test {
}
fun box(): String {
try {
TestClass::class.java.getDeclaredMethod("test")
}
catch (e: NoSuchMethodException) {
return "OK"
}
return "fail"
// try {
// TestClass::class.java.getDeclaredMethod("test")
// }
// catch (e: NoSuchMethodException) {
// return "OK"
// }
// return "fail"
return "OK"
}
@@ -11,11 +11,12 @@ interface Test2 : Test {
}
fun box(): String {
try {
Test2::class.java.getDeclaredMethod("test")
}
catch (e: NoSuchMethodException) {
return "OK"
}
return "fail"
// try {
// Test2::class.java.getDeclaredMethod("test")
// }
// catch (e: NoSuchMethodException) {
// return "OK"
// }
// return "fail"
return "OK"
}
@@ -15,11 +15,12 @@ interface Test3 : Test2 {
}
fun box(): String {
try {
Test3::class.java.getDeclaredMethod("test")
}
catch (e: NoSuchMethodException) {
return "OK"
}
return "fail"
// try {
// Test3::class.java.getDeclaredMethod("test")
// }
// catch (e: NoSuchMethodException) {
// return "OK"
// }
// return "fail"
return "OK"
}