Details
-
Bug
-
Resolution: Fixed
-
P3
-
8
-
b15
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8042883 | 9 | Vicente Arturo Romero Zaldivar | P3 | Closed | Fixed | b14 |
JDK-8045165 | 8u25 | Vicente Arturo Romero Zaldivar | P3 | Resolved | Fixed | b01 |
JDK-8042976 | 8u20 | Vicente Arturo Romero Zaldivar | P3 | Resolved | Duplicate | |
JDK-8052604 | emb-8u26 | Vicente Arturo Romero Zaldivar | P3 | Resolved | Fixed | b17 |
Description
For this code:
class Test {
static <U> Iterable<U> map(Mapper<String, U> mapper) {
return null;
}
static void test() {
Iterable<Integer> map = map(Test::length);
}
public static <T> int length(String s) {
return 0;
}
}
interface Mapper<T, U> {
U map(T t);
}
javac generates this error message:
Test.java:7: error: incompatible types: inference variable U has incompatible bounds
Iterable<Integer> map = map(Test::length);
^
equality constraints: Integer
lower bounds: Integer,int <--- primitive type in bound
where U is a type-variable:
U extends Object declared in method <U>map(Mapper<String,U>)
1 error
reported by anna.kozlova_at_jetbrains.com in compiler-dev
class Test {
static <U> Iterable<U> map(Mapper<String, U> mapper) {
return null;
}
static void test() {
Iterable<Integer> map = map(Test::length);
}
public static <T> int length(String s) {
return 0;
}
}
interface Mapper<T, U> {
U map(T t);
}
javac generates this error message:
Test.java:7: error: incompatible types: inference variable U has incompatible bounds
Iterable<Integer> map = map(Test::length);
^
equality constraints: Integer
lower bounds: Integer,int <--- primitive type in bound
where U is a type-variable:
U extends Object declared in method <U>map(Mapper<String,U>)
1 error
reported by anna.kozlova_at_jetbrains.com in compiler-dev
Attachments
Issue Links
- backported by
-
JDK-8042976 javac, for method references a primitive type can be added as a bound
- Resolved
-
JDK-8045165 javac, for method references a primitive type can be added as a bound
- Resolved
-
JDK-8052604 javac, for method references a primitive type can be added as a bound
- Resolved
-
JDK-8042883 javac, for method references a primitive type can be added as a bound
- Closed