8185451: Misleading 'cannot be accessed from outside package' diagnostic for inconsistent varargs override
Reviewed-by: mcimadamore
This commit is contained in:
parent
966746dba3
commit
030e675ed3
@ -1548,7 +1548,8 @@ public class Resolve {
|
||||
boolean allowBoxing,
|
||||
boolean useVarargs) {
|
||||
if (sym.kind == ERR ||
|
||||
!sym.isInheritedIn(site.tsym, types)) {
|
||||
(site.tsym != sym.owner && !sym.isInheritedIn(site.tsym, types)) ||
|
||||
!notOverriddenIn(site, sym)) {
|
||||
return bestSoFar;
|
||||
} else if (useVarargs && (sym.flags() & VARARGS) == 0) {
|
||||
return bestSoFar.kind.isResolutionError() ?
|
||||
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8185451
|
||||
* @summary Misleading 'cannot be accessed from outside package' diagnostic for inconsistent varargs override
|
||||
* @compile/fail/ref=MisleadingVarArgsErrorMsgTest.out -XDrawDiagnostics MisleadingVarArgsErrorMsgTest.java
|
||||
*/
|
||||
|
||||
class MisleadingVarArgsErrorMsgTest {
|
||||
class A {
|
||||
void f(int... x) {}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
@Override
|
||||
void f(int[] x) {}
|
||||
}
|
||||
|
||||
{
|
||||
new B().f(1);
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
MisleadingVarArgsErrorMsgTest.java:19:16: compiler.err.cant.apply.symbol: kindname.method, f, int[], int, kindname.class, MisleadingVarArgsErrorMsgTest.B, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, int[]))
|
||||
1 error
|
Loading…
Reference in New Issue
Block a user