Mercurial > hg > openjdk > jdk9 > langtools
changeset 3851:4f348bd05341 jdk-9+151
8169091: Method reference T::methodName for generic type T does not compile any more
Summary: MethodReferenceLookupHelper should use original site to perform unbound subtype check
Reviewed-by: vromero
author | mcimadamore |
---|---|
date | Tue, 03 Jan 2017 11:33:18 +0000 |
parents | 8e69054abeeb |
children | 2c5ee45f64f5 9d2379f8dd41 |
files | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java test/tools/javac/lambda/8169091/T8169091.java |
diffstat | 2 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Wed Dec 21 15:40:08 2016 -0800 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Tue Jan 03 11:33:18 2017 +0000 @@ -3190,7 +3190,7 @@ 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 {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/8169091/T8169091.java Tue Jan 03 11:33:18 2017 +0000 @@ -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; + } +}