langtools/src/share/classes/com/sun/tools/javac/comp/Resolve.java
changeset 5321 c8efe769cb3b
parent 3372 544ec1ab333c
child 5489 e7af65bf7577
child 5736 ee0850472ca1
equal deleted inserted replaced
5320:e2aaa958b02d 5321:c8efe769cb3b
   786                                            allowBoxing,
   786                                            allowBoxing,
   787                                            useVarargs,
   787                                            useVarargs,
   788                                            operator);
   788                                            operator);
   789                 }
   789                 }
   790             }
   790             }
       
   791             if (name == names.init)
       
   792                 break;
   791             //- System.out.println(" - " + bestSoFar);
   793             //- System.out.println(" - " + bestSoFar);
   792             if (abstractok) {
   794             if (abstractok) {
   793                 Symbol concrete = methodNotFound;
   795                 Symbol concrete = methodNotFound;
   794                 if ((bestSoFar.flags() & ABSTRACT) == 0)
   796                 if ((bestSoFar.flags() & ABSTRACT) == 0)
   795                     concrete = bestSoFar;
   797                     concrete = bestSoFar;
  1407             env.info.varArgs = errPhase.isVarargsRequired();
  1409             env.info.varArgs = errPhase.isVarargsRequired();
  1408         }
  1410         }
  1409         return sym;
  1411         return sym;
  1410     }
  1412     }
  1411 
  1413 
       
  1414     /** Resolve constructor using diamond inference.
       
  1415      *  @param pos       The position to use for error reporting.
       
  1416      *  @param env       The environment current at the constructor invocation.
       
  1417      *  @param site      The type of class for which a constructor is searched.
       
  1418      *                   The scope of this class has been touched in attribution.
       
  1419      *  @param argtypes  The types of the constructor invocation's value
       
  1420      *                   arguments.
       
  1421      *  @param typeargtypes  The types of the constructor invocation's type
       
  1422      *                   arguments.
       
  1423      */
       
  1424     Symbol resolveDiamond(DiagnosticPosition pos,
       
  1425                               Env<AttrContext> env,
       
  1426                               Type site,
       
  1427                               List<Type> argtypes,
       
  1428                               List<Type> typeargtypes, boolean reportErrors) {
       
  1429         Symbol sym = methodNotFound;
       
  1430         JCDiagnostic explanation = null;
       
  1431         List<MethodResolutionPhase> steps = methodResolutionSteps;
       
  1432         while (steps.nonEmpty() &&
       
  1433                steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
       
  1434                sym.kind >= ERRONEOUS) {
       
  1435             sym = resolveConstructor(pos, env, site, argtypes, typeargtypes,
       
  1436                     steps.head.isBoxingRequired(),
       
  1437                     env.info.varArgs = steps.head.isVarargsRequired());
       
  1438             methodResolutionCache.put(steps.head, sym);
       
  1439             if (sym.kind == WRONG_MTH &&
       
  1440                     ((InapplicableSymbolError)sym).explanation != null) {
       
  1441                 //if the symbol is an inapplicable method symbol, then the
       
  1442                 //explanation contains the reason for which inference failed
       
  1443                 explanation = ((InapplicableSymbolError)sym).explanation;
       
  1444             }
       
  1445             steps = steps.tail;
       
  1446         }
       
  1447         if (sym.kind >= AMBIGUOUS && reportErrors) {
       
  1448             String key = explanation == null ?
       
  1449                 "cant.apply.diamond" :
       
  1450                 "cant.apply.diamond.1";
       
  1451             log.error(pos, key, diags.fragment("diamond", site.tsym), explanation);
       
  1452         }
       
  1453         return sym;
       
  1454     }
       
  1455 
  1412     /** Resolve constructor.
  1456     /** Resolve constructor.
  1413      *  @param pos       The position to use for error reporting.
  1457      *  @param pos       The position to use for error reporting.
  1414      *  @param env       The environment current at the constructor invocation.
  1458      *  @param env       The environment current at the constructor invocation.
  1415      *  @param site      The type of class for which a constructor is searched.
  1459      *  @param site      The type of class for which a constructor is searched.
  1416      *  @param argtypes  The types of the constructor invocation's value
  1460      *  @param argtypes  The types of the constructor invocation's value