Added tests with type parameter of class in SAM adapter.

This commit is contained in:
Evgeny Gerashchenko
2013-04-18 22:02:04 +04:00
parent 8c4e45de9a
commit 7133f20247
6 changed files with 50 additions and 0 deletions
@@ -0,0 +1,13 @@
import java.util.*;
class WeirdComparator<T> {
public Inner createInner() {
return new Inner();
}
public class Inner {
public T max(Comparator<T> comparator, T value1, T value2) {
return comparator.compare(value1, value2) > 0 ? value1 : value2;
}
}
}
@@ -0,0 +1,6 @@
fun box(): String {
val wc = WeirdComparator<String>().createInner()!!
val result = wc.max({ a, b -> a.length - b.length }, "java", "kotlin")
if (result != "kotlin") return "Wrong: $result"
return "OK"
}