8169091: Method reference T::methodName for generic type T does not compile any more
MethodReferenceLookupHelper should use original site to perform unbound subtype check Reviewed-by: vromero
This commit is contained in:
parent
a84bef19f0
commit
4ff56b008f
langtools
src/jdk.compiler/share/classes/com/sun/tools/javac/comp
test/tools/javac/lambda/8169091
@ -3190,7 +3190,7 @@ public class Resolve {
|
||||
if (TreeInfo.isStaticSelector(referenceTree.expr, names)) {
|
||||
if (argtypes.nonEmpty() &&
|
||||
(argtypes.head.hasTag(NONE) ||
|
||||
types.isSubtypeUnchecked(inferenceContext.asUndetVar(argtypes.head), site))) {
|
||||
types.isSubtypeUnchecked(inferenceContext.asUndetVar(argtypes.head), originalSite))) {
|
||||
return new UnboundMethodReferenceLookupHelper(referenceTree, name,
|
||||
originalSite, argtypes, typeargtypes, maxPhase);
|
||||
} else {
|
||||
|
15
langtools/test/tools/javac/lambda/8169091/T8169091.java
Normal file
15
langtools/test/tools/javac/lambda/8169091/T8169091.java
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 8169091
|
||||
* @summary Method reference T::methodName for generic type T does not compile any more
|
||||
* @compile T8169091.java
|
||||
*/
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
|
||||
interface T8169091 {
|
||||
static <T extends Comparable<? super T>> Comparator<T> comparator() {
|
||||
return (Comparator<T> & Serializable)T::compareTo;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user