New J2K: add better support of implicit functional interfaces

#KT-32702 fixed
#KT-19327 fixed
This commit is contained in:
Ilya Kirillov
2019-07-17 17:13:33 +03:00
parent 96ca4712a0
commit f79b282c60
34 changed files with 425 additions and 208 deletions
+10
View File
@@ -0,0 +1,10 @@
// RUNTIME_WITH_FULL_JDK
import java.util.Collection;
import java.util.stream.Collectors;
class JavaCode {
public String toJSON(Collection<Integer> collection) {
return "[" + collection.stream().map(Object::toString).collect(Collectors.joining(", ")) + "]";
}
}
+10
View File
@@ -0,0 +1,10 @@
// ERROR: Unresolved reference: stream
// ERROR: Unresolved reference: stream
// ERROR: Unresolved reference: Collectors
import java.util.stream.Collectors
internal class JavaCode {
fun toJSON(collection: Collection<Int?>): String {
return "[" + collection.stream().map({ obj: Object -> obj.toString() }).collect(Collectors.joining(", ")).toString() + "]"
}
}
+11
View File
@@ -0,0 +1,11 @@
// RUNTIME_WITH_FULL_JDK
import java.util.*;
class Test {
public void context() {
List<Double> items = new ArrayList<>();
items.add(1.0);
items.forEach(System.out::println);
}
}
+10
View File
@@ -0,0 +1,10 @@
import java.util.ArrayList
import java.util.function.Consumer
internal class Test {
fun context() {
val items: MutableList<Double> = ArrayList()
items.add(1.0)
items.forEach(Consumer { o: Double -> println(o) })
}
}