-
Bug
-
Resolution: Fixed
-
P4
-
8u31
-
b54
-
x86_64
-
linux
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8085353 | emb-9 | Maurizio Cimadamore | P4 | Resolved | Fixed | team |
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux jacek 3.2.0-4-amd64 #1 SMP Debian 3.2.63-2+deb7u2 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
Invalid method reference thrown by javac when making a reference to a method on an upper bounded wildcard generic type.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a file named Sample.java containing the attached source code for class Sample
2. Compile: javac Sample.java
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
File compiles OK.
ACTUAL -
Compilation error occurs
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Sample.java:8: error: invalid method reference
Stream<Runnable> r = s.map(o -> o::work);
^
cannot find symbol
symbol: method work()
location: bound of type variable CAP#1
where CAP#1 is a fresh type-variable:
CAP#1 extends Sample from capture of ? extends Sample
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.stream.Stream;
public class Sample {
void work() { }
void process(Stream<? extends Sample> s) {
Stream<Runnable> r = s.map(o -> o::work);
}
}
---------- END SOURCE ----------
- backported by
-
JDK-8085353 Invalid method reference when referencing a method on a wildcard type
- Resolved
- duplicates
-
JDK-8133123 javac: AssertionError: isSubClass T
- Closed
-
JDK-8199123 AssertionError when compiling reference to abstract class' method, defined in interface, when other non-abstract same-named method exists
- Closed
-
JDK-8133239 Method reference can't see package-access tvar method
- Closed
-
JDK-8157845 javac: AssertionError: isSubClass T
- Closed
-
JDK-8158497 JDK-8133123 and JDK-8157845 not fixed on java 8
- Closed
- relates to
-
JDK-8318160 javac does not reject private method reference with type-variable receiver
- Resolved