Expanded and simplified test for generating bridges in sam conversions.

This commit is contained in:
Evgeny Gerashchenko
2014-10-06 23:50:59 +04:00
parent 72f96cd55c
commit b062548392
6 changed files with 53 additions and 13 deletions

View File

@@ -0,0 +1,19 @@
class JavaClass {
public interface Super1<T> {
Thread call(T t);
}
public interface Super2<T> {
T call(String s);
}
public interface Sub extends Super1<String>, Super2<Thread> {
Thread call(String s);
}
static void samAdapter(Sub sub) {
((Super1) sub).call("");
((Super2) sub).call("");
sub.call("");
}
}

View File

@@ -0,0 +1,13 @@
fun box(): String? {
var s: String?
s = "FAIL for function literal"
JavaClass.samAdapter { s = "OK"; null }
if (s != "OK") return s
s = "FAIL for wrapper"
val function: (String?) -> Thread? = { s = "OK"; null }
JavaClass.samAdapter(function)
if (s != "OK") return s
return "OK"
}

View File

@@ -1,4 +1,5 @@
public class kt5912<T> {
// KT-5912
class JavaClass<T> {
public static interface Action<T> {
void call(T t);
}
@@ -13,4 +14,4 @@ public class kt5912<T> {
void perform(T t, OnSubscribe<T> subscribe) {
subscribe.call(new Some(t));
}
}
}

View File

@@ -0,0 +1,6 @@
// KT-5912
fun box(): String {
var s = "Failt"
JavaClass<String>().perform("") { s = "OK" }
return s
}

View File

@@ -1,5 +0,0 @@
fun box(): String {
var s = "Failt"
kt5912<String>().perform("") { s = "OK" }
return s
}