mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-25 14:25:04 +07:00
method refs constraint (IDEA-118437)
This commit is contained in:
+2
-2
@@ -5,14 +5,14 @@ class Test {
|
||||
|
||||
static void test() {
|
||||
Integer next = map(String::length).iterator().next();
|
||||
<error descr="Incompatible types. Found: 'java.lang.Object', required: 'java.lang.Integer'">Integer next1 = map(Test::length).iterator().next();</error>
|
||||
Integer next1 = map(Test::length).iterator().next();//error with int!!!
|
||||
}
|
||||
|
||||
public static <T> T length(T s) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <T> int length(String s) {
|
||||
public static <T> /*int*/Integer length(String s) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class Test {
|
||||
public <T2> void validate(Stream<ConstraintViolation<T2>> stream) {
|
||||
// ...
|
||||
Set<Violation> violations = stream.map(this::convertToResult).collect(Collectors.toSet());
|
||||
// ...
|
||||
}
|
||||
|
||||
private <T1> Violation convertToResult(ConstraintViolation<T1> violation) {
|
||||
// ...
|
||||
return new Violation();
|
||||
}
|
||||
|
||||
class Violation {}
|
||||
|
||||
class ConstraintViolation<T> {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user