New J2K: add better support of implicit functional interfaces
#KT-32702 fixed #KT-19327 fixed
This commit is contained in:
+10
@@ -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
@@ -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
@@ -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
@@ -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) })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user