提交 c7457704 编写于 作者: V vromero

8037379: fix for JDK-8029569 doesn't cover all possible cases

Reviewed-by: jjg
上级 f27ff593
......@@ -2769,7 +2769,7 @@ public class Attr extends JCTree.Visitor {
targetError = false;
}
JCDiagnostic detailsDiag = ((Resolve.ResolveError)refSym).getDiagnostic(JCDiagnostic.DiagnosticType.FRAGMENT,
JCDiagnostic detailsDiag = ((Resolve.ResolveError)refSym.baseSymbol()).getDiagnostic(JCDiagnostic.DiagnosticType.FRAGMENT,
that, exprType.tsym, exprType, that.name, argtypes, typeargtypes);
JCDiagnostic.DiagnosticType diagKind = targetError ?
......
......@@ -1432,7 +1432,7 @@ public class Resolve {
return bestSoFar;
} else if (useVarargs && (sym.flags() & VARARGS) == 0) {
return bestSoFar.kind >= ERRONEOUS ?
new BadVarargsMethod((ResolveError)bestSoFar) :
new BadVarargsMethod((ResolveError)bestSoFar.baseSymbol()) :
bestSoFar;
}
Assert.check(sym.kind < AMBIGUOUS);
......@@ -2200,7 +2200,7 @@ public class Resolve {
List<Type> typeargtypes,
LogResolveHelper logResolveHelper) {
if (sym.kind >= AMBIGUOUS) {
ResolveError errSym = (ResolveError)sym;
ResolveError errSym = (ResolveError)sym.baseSymbol();
sym = errSym.access(name, qualified ? site.tsym : syms.noSymbol);
argtypes = logResolveHelper.getArgumentTypes(errSym, sym, name, argtypes);
if (logResolveHelper.resolveDiagnosticNeeded(site, argtypes, typeargtypes)) {
......@@ -2589,7 +2589,7 @@ public class Resolve {
sym = super.access(env, pos, location, sym);
} else {
final JCDiagnostic details = sym.kind == WRONG_MTH ?
((InapplicableSymbolError)sym).errCandidate().snd :
((InapplicableSymbolError)sym.baseSymbol()).errCandidate().snd :
null;
sym = new InapplicableSymbolError(sym.kind, "diamondError", currentResolutionContext) {
@Override
......@@ -2997,12 +2997,12 @@ public class Resolve {
return true;
case WRONG_MTH:
InapplicableSymbolError errSym =
(InapplicableSymbolError)s;
(InapplicableSymbolError)s.baseSymbol();
return new Template(MethodCheckDiag.ARITY_MISMATCH.regex())
.matches(errSym.errCandidate().snd);
case WRONG_MTHS:
InapplicableSymbolsError errSyms =
(InapplicableSymbolsError)s;
(InapplicableSymbolsError)s.baseSymbol();
return errSyms.filterCandidates(errSyms.mapCandidates()).isEmpty();
case WRONG_STATICNESS:
return false;
......
/*
* 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.
*/
/*
* @test
* @bug 8029569
* @test /nodynamiccopyright/
* @bug 8029569 8037379
* @summary internal javac cast exception when resolving varargs ambiguity
* fix for JDK-8029569 doesn't cover all possible cases
* @compile/fail/ref=VarargsAmbiguityCrashTest.out -XDrawDiagnostics VarargsAmbiguityCrashTest.java
*/
......
VarargsAmbiguityCrashTest.java:33:9: compiler.err.ref.ambiguous: m2, kindname.method, m2(java.lang.Exception...), VarargsAmbiguityCrashTest, kindname.method, m2(java.lang.Long,java.lang.Exception...), VarargsAmbiguityCrashTest
VarargsAmbiguityCrashTest.java:11:9: compiler.err.ref.ambiguous: m2, kindname.method, m2(java.lang.Exception...), VarargsAmbiguityCrashTest, kindname.method, m2(java.lang.Long,java.lang.Exception...), VarargsAmbiguityCrashTest
1 error
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册