method refs constraint (IDEA-118437)

This commit is contained in:
Anna Kozlova
2014-01-30 14:24:08 +04:00
parent dab66b502f
commit 704285aae2
4 changed files with 33 additions and 5 deletions

View File

@@ -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;
}
}