< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java

Print this page

        

@@ -1926,10 +1926,11 @@
      */
     Symbol findFun(Env<AttrContext> env, Name name,
                    List<Type> argtypes, List<Type> typeargtypes,
                    boolean allowBoxing, boolean useVarargs) {
         Symbol bestSoFar = methodNotFound;
+
         Env<AttrContext> env1 = env;
         boolean staticOnly = false;
         while (env1.outer != null) {
             if (isStatic(env1)) staticOnly = true;
             Assert.check(env1.info.preferredTreeForDiagnostics == null);

@@ -2662,11 +2663,11 @@
     Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env<AttrContext> env,
                                   Symbol location, Type site, Name name, List<Type> argtypes,
                                   List<Type> typeargtypes) {
         return resolveQualifiedMethod(new MethodResolutionContext(), pos, env, location, site, name, argtypes, typeargtypes);
     }
-    private Symbol resolveQualifiedMethod(MethodResolutionContext resolveContext,
+    public Symbol resolveQualifiedMethod(MethodResolutionContext resolveContext,
                                   DiagnosticPosition pos, Env<AttrContext> env,
                                   Symbol location, Type site, Name name, List<Type> argtypes,
                                   List<Type> typeargtypes) {
         return lookupMethod(env, pos, location, resolveContext, new BasicLookupHelper(name, site, argtypes, typeargtypes) {
             @Override

@@ -2676,11 +2677,11 @@
                         phase.isVarargsRequired());
             }
             @Override
             Symbol access(Env<AttrContext> env, DiagnosticPosition pos, Symbol location, Symbol sym) {
                 if (sym.kind.isResolutionError()) {
-                    sym = super.access(env, pos, location, sym);
+                    sym = resolveContext.silentFail ? sym : super.access(env, pos, location, sym);
                 } else {
                     MethodSymbol msym = (MethodSymbol)sym;
                     if ((msym.flags() & SIGNATURE_POLYMORPHIC) != 0) {
                         env.info.pendingResolutionPhase = BASIC;
                         return findPolymorphicSignatureInstance(env, sym, argtypes);

@@ -4791,19 +4792,21 @@
      * overload resolution, such as list of method that are not applicable
      * (used to generate more precise diagnostics) and so on. Resolution contexts
      * can be nested - this means that when each overload resolution routine should
      * work within the resolution context it created.
      */
-    class MethodResolutionContext {
+    public class MethodResolutionContext {
 
         private List<Candidate> candidates = List.nil();
 
         MethodResolutionPhase step = null;
 
         MethodCheck methodCheck = resolveMethodCheck;
 
-        private boolean internalResolution = false;
+        public boolean internalResolution = false;
+        // in case of failure, don't report the error
+        public boolean silentFail = false;
         private DeferredAttr.AttrMode attrMode = DeferredAttr.AttrMode.SPECULATIVE;
 
         void addInapplicableCandidate(Symbol sym, JCDiagnostic details) {
             Candidate c = new Candidate(currentResolutionContext.step, sym, details, null);
             candidates = candidates.append(c);
< prev index next >