28 import com.sun.tools.javac.util.*; |
28 import com.sun.tools.javac.util.*; |
29 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; |
29 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; |
30 import com.sun.tools.javac.code.*; |
30 import com.sun.tools.javac.code.*; |
31 import com.sun.tools.javac.jvm.*; |
31 import com.sun.tools.javac.jvm.*; |
32 import com.sun.tools.javac.tree.*; |
32 import com.sun.tools.javac.tree.*; |
|
33 import com.sun.tools.javac.api.Formattable.LocalizedString; |
33 import static com.sun.tools.javac.comp.Resolve.MethodResolutionPhase.*; |
34 import static com.sun.tools.javac.comp.Resolve.MethodResolutionPhase.*; |
34 |
35 |
35 import com.sun.tools.javac.code.Type.*; |
36 import com.sun.tools.javac.code.Type.*; |
36 import com.sun.tools.javac.code.Symbol.*; |
37 import com.sun.tools.javac.code.Symbol.*; |
37 import com.sun.tools.javac.tree.JCTree.*; |
38 import com.sun.tools.javac.tree.JCTree.*; |
1476 public void logAccessError(Env<AttrContext> env, JCTree tree, Type type) { |
1477 public void logAccessError(Env<AttrContext> env, JCTree tree, Type type) { |
1477 AccessError error = new AccessError(env, type.getEnclosingType(), type.tsym); |
1478 AccessError error = new AccessError(env, type.getEnclosingType(), type.tsym); |
1478 error.report(log, tree.pos(), type.getEnclosingType(), null, null, null); |
1479 error.report(log, tree.pos(), type.getEnclosingType(), null, null, null); |
1479 } |
1480 } |
1480 |
1481 |
|
1482 private final LocalizedString noArgs = new LocalizedString("compiler.misc.no.args"); |
|
1483 |
|
1484 public Object methodArguments(List<Type> argtypes) { |
|
1485 return argtypes.isEmpty() ? noArgs : argtypes; |
|
1486 } |
|
1487 |
1481 /** Root class for resolve errors. |
1488 /** Root class for resolve errors. |
1482 * Instances of this class indicate "Symbol not found". |
1489 * Instances of this class indicate "Symbol not found". |
1483 * Instances of subclass indicate other errors. |
1490 * Instances of subclass indicate other errors. |
1484 */ |
1491 */ |
1485 private class ResolveError extends Symbol { |
1492 private class ResolveError extends Symbol { |
1582 Symbol ws = wrongSym.asMemberOf(site, types); |
1589 Symbol ws = wrongSym.asMemberOf(site, types); |
1583 log.error(pos, |
1590 log.error(pos, |
1584 "cant.apply.symbol" + (explanation != null ? ".1" : ""), |
1591 "cant.apply.symbol" + (explanation != null ? ".1" : ""), |
1585 kindname, |
1592 kindname, |
1586 ws.name == names.init ? ws.owner.name : ws.name, |
1593 ws.name == names.init ? ws.owner.name : ws.name, |
1587 ws.type.getParameterTypes(), |
1594 methodArguments(ws.type.getParameterTypes()), |
1588 argtypes, |
1595 methodArguments(argtypes), |
1589 kindName(ws.owner), |
1596 kindName(ws.owner), |
1590 ws.owner.type, |
1597 ws.owner.type, |
1591 explanation); |
1598 explanation); |
1592 } else if (!site.tsym.name.isEmpty()) { |
1599 } else if (!site.tsym.name.isEmpty()) { |
1593 if (site.tsym.kind == PCK && !site.tsym.exists()) |
1600 if (site.tsym.kind == PCK && !site.tsym.exists()) |