-
Bug
-
Resolution: Fixed
-
P3
-
8u20
-
b31
-
x86_64
-
linux
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8085392 | emb-9 | Jan Lahoda | P3 | Resolved | Fixed | team |
JDK-8064053 | 8u45 | Jan Lahoda | P3 | Resolved | Fixed | b01 |
JDK-8057027 | 8u40 | Jan Lahoda | P3 | Resolved | Fixed | b08 |
JDK-8070273 | emb-8u47 | Jan Lahoda | P3 | Resolved | Fixed | team |
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Kubuntu 14.04 x64
A DESCRIPTION OF THE PROBLEM :
This works in jdk1.8.0_11 and in Eclipse but not anymore in jdk1.8.0_20:
public class Testbed {
public static void main(String[] args) {
java.util.List<Dog> l = null;
Dog d = l.get(0).copy(); // ok
foo(l.get(0).copy()); // error
}
private static void foo(Dog d) { }
}
class Animal {
public <T> T copy() {
return null;
}
}
class Dog extends Animal {
}
jdk1.8.0_20 message:
Testbed.java:5: error: method foo in class Testbed cannot be applied to given types;
foo(l.get(0).copy()); // error
^
required: Dog
found: Object
reason: argument mismatch; Object cannot be converted to Dog
1 error
REGRESSION. Last worked in version 8u11
ADDITIONAL REGRESSION INFORMATION:
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try to compile the given snippet.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It compiles.
ACTUAL -
Syntax error message.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Testbed.java:5: error: method foo in class Testbed cannot be applied to given types;
foo(l.get(0).copy()); // error
^
required: Dog
found: Object
reason: argument mismatch; Object cannot be converted to Dog
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Testbed {
public static void main(String[] args) {
java.util.List<Dog> l = null;
Dog d = l.get(0).copy(); // ok
foo(l.get(0).copy()); // error
}
private static void foo(Dog d) { }
}
class Animal {
public <T> T copy() {
return null;
}
}
class Dog extends Animal {
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use jdk1.8.0_11 and be sad.
- backported by
-
JDK-8057027 Type inference may be skipped for a complex receiver generic method in a parameter position
-
- Resolved
-
-
JDK-8064053 Type inference may be skipped for a complex receiver generic method in a parameter position
-
- Resolved
-
-
JDK-8070273 Type inference may be skipped for a complex receiver generic method in a parameter position
-
- Resolved
-
-
JDK-8085392 Type inference may be skipped for a complex receiver generic method in a parameter position
-
- Resolved
-
- duplicates
-
JDK-8062900 generic method return type inference regression
-
- Closed
-
- relates to
-
JDK-8031967 For some sources compiler compiles for ever
-
- Closed
-