Supported non-literal arguments for SAM adapters.

This commit is contained in:
Evgeny Gerashchenko
2013-06-13 20:16:47 +04:00
parent 2e2061d9b6
commit ee9fcff9ca
10 changed files with 90 additions and 8 deletions

View File

@@ -0,0 +1,6 @@
class JavaClass {
public static void run(Runnable r1, Runnable r2) {
r1.run();
r2.run();
}
}

View File

@@ -0,0 +1,6 @@
fun box(): String {
var v = "FAIL"
val f = { v = "O" }
JavaClass.run(f, { v += "K" })
return v
}

View File

@@ -0,0 +1,7 @@
import java.util.*;
class JavaClass {
public static void sortIntList(List<Integer> list, Comparator<Integer> comparator) {
Collections.sort(list, comparator);
}
}

View File

@@ -0,0 +1,10 @@
import java.util.*
fun box(): String {
val list = ArrayList(Arrays.asList(3, 2, 4, 8, 1, 5))
val expected = ArrayList(Arrays.asList(8, 5, 4, 3, 2, 1))
val f = { (a: Int, b: Int) -> b - a }
JavaClass.sortIntList(list, f)
return if (list == expected) "OK" else list.toString()
}

View File

@@ -0,0 +1,11 @@
class JavaClass {
private Runnable r;
public JavaClass(Runnable r) {
this.r = r;
}
public void run() {
r.run();
}
}

View File

@@ -0,0 +1,6 @@
fun box(): String {
var v = "FAIL"
val f = { v = "OK" }
JavaClass(f).run()
return v
}

View File

@@ -0,0 +1,5 @@
class JavaClass {
public static void run(Runnable r) {
r.run();
}
}

View File

@@ -0,0 +1,6 @@
fun box(): String {
var v = "FAIL"
val f = { v = "OK" }
JavaClass.run(f)
return v
}