1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed Apr 14 12:23:29 2010 +0100 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed Apr 14 12:31:55 2010 +0100 1.3 @@ -788,6 +788,8 @@ 1.4 operator); 1.5 } 1.6 } 1.7 + if (name == names.init) 1.8 + break; 1.9 //- System.out.println(" - " + bestSoFar); 1.10 if (abstractok) { 1.11 Symbol concrete = methodNotFound; 1.12 @@ -1409,6 +1411,48 @@ 1.13 return sym; 1.14 } 1.15 1.16 + /** Resolve constructor using diamond inference. 1.17 + * @param pos The position to use for error reporting. 1.18 + * @param env The environment current at the constructor invocation. 1.19 + * @param site The type of class for which a constructor is searched. 1.20 + * The scope of this class has been touched in attribution. 1.21 + * @param argtypes The types of the constructor invocation's value 1.22 + * arguments. 1.23 + * @param typeargtypes The types of the constructor invocation's type 1.24 + * arguments. 1.25 + */ 1.26 + Symbol resolveDiamond(DiagnosticPosition pos, 1.27 + Env<AttrContext> env, 1.28 + Type site, 1.29 + List<Type> argtypes, 1.30 + List<Type> typeargtypes, boolean reportErrors) { 1.31 + Symbol sym = methodNotFound; 1.32 + JCDiagnostic explanation = null; 1.33 + List<MethodResolutionPhase> steps = methodResolutionSteps; 1.34 + while (steps.nonEmpty() && 1.35 + steps.head.isApplicable(boxingEnabled, varargsEnabled) && 1.36 + sym.kind >= ERRONEOUS) { 1.37 + sym = resolveConstructor(pos, env, site, argtypes, typeargtypes, 1.38 + steps.head.isBoxingRequired(), 1.39 + env.info.varArgs = steps.head.isVarargsRequired()); 1.40 + methodResolutionCache.put(steps.head, sym); 1.41 + if (sym.kind == WRONG_MTH && 1.42 + ((InapplicableSymbolError)sym).explanation != null) { 1.43 + //if the symbol is an inapplicable method symbol, then the 1.44 + //explanation contains the reason for which inference failed 1.45 + explanation = ((InapplicableSymbolError)sym).explanation; 1.46 + } 1.47 + steps = steps.tail; 1.48 + } 1.49 + if (sym.kind >= AMBIGUOUS && reportErrors) { 1.50 + String key = explanation == null ? 1.51 + "cant.apply.diamond" : 1.52 + "cant.apply.diamond.1"; 1.53 + log.error(pos, key, diags.fragment("diamond", site.tsym), explanation); 1.54 + } 1.55 + return sym; 1.56 + } 1.57 + 1.58 /** Resolve constructor. 1.59 * @param pos The position to use for error reporting. 1.60 * @param env The environment current at the constructor invocation.