Mercurial > hg > openjdk > lambda > langtools
changeset 2241:7f4fc4264f61
8020843: javac crashes on accessibility check with method reference with typevar receiver
author | mcimadamore |
---|---|
date | Fri, 19 Jul 2013 12:36:19 +0100 |
parents | 6052d5d0de46 |
children | a81cf02dfe46 |
files | src/share/classes/com/sun/tools/javac/comp/Resolve.java src/share/classes/com/sun/tools/javac/resources/compiler.properties test/tools/javac/diags/examples/ReportAccessFragment.java test/tools/javac/lambda/8020843/T8020843.java test/tools/javac/lambda/8020843/T8020843.out |
diffstat | 5 files changed, 62 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Jul 18 12:53:40 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Fri Jul 19 12:36:19 2013 +0100 @@ -2655,6 +2655,13 @@ MethodCheck methodCheck, InferenceContext inferenceContext) { MethodResolutionPhase maxPhase = boxingAllowed ? VARARITY : BASIC; + + if (site.hasTag(TYPEVAR)) { + return resolveMemberReference(pos, env, referenceTree, site.getUpperBound(), + name, argtypes, typeargtypes, boxingAllowed, methodCheck, inferenceContext); + } + + site = types.capture(site); ReferenceLookupHelper boundLookupHelper; if (!name.equals(names.init)) { @@ -2697,7 +2704,7 @@ } //private boolean lookupSuccess(Symbol s) { - return s.kind == MTH || s.kind == AMBIGUOUS; + return s.kind == MTH || s.kind == AMBIGUOUS || s.kind == HIDDEN; } /**
--- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Jul 18 12:53:40 2013 +0100 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Fri Jul 19 12:36:19 2013 +0100 @@ -905,6 +905,10 @@ compiler.err.report.access=\ {0} has {1} access in {2} +# 0: symbol, 1: set of modifier, 2: symbol +compiler.misc.report.access=\ + {0} has {1} access in {2} + compiler.err.ret.outside.meth=\ return outside method
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/diags/examples/ReportAccessFragment.java Fri Jul 19 12:36:19 2013 +0100 @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +// key: compiler.err.prob.found.req +// key: compiler.misc.invalid.mref +// key: compiler.misc.report.access + +class ReportAccessFragment { + void test(Object o) { + Runnable r = o::clone; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/8020843/T8020843.java Fri Jul 19 12:36:19 2013 +0100 @@ -0,0 +1,16 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8020843 + * @summary javac crashes on accessibility check with method reference with typevar receiver + * @compile/fail/ref=T8020843.out -XDrawDiagnostics T8020843.java + */ + +class T8020843 { + interface Function<X, Y> { + Y m(X x); + } + + <T> void test(T t) { + Function<T, Object> ss = T::clone; + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javac/lambda/8020843/T8020843.out Fri Jul 19 12:36:19 2013 +0100 @@ -0,0 +1,2 @@ +T8020843.java:14:34: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.report.access: clone(), protected, java.lang.Object)) +1 error