1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Fri May 25 16:32:56 2012 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Thu May 31 17:42:14 2012 +0100 1.3 @@ -424,10 +424,6 @@ 1.4 */ 1.5 boolean compatible(Type found, Type req, Warner warn); 1.6 /** 1.7 - * Instantiate a ForAll type against a given target type 'req' in given context 1.8 - */ 1.9 - Type rawInstantiatePoly(ForAll found, Type req, Warner warn); 1.10 - /** 1.11 * Report a check error 1.12 */ 1.13 void report(DiagnosticPosition pos, Type found, Type req, JCDiagnostic details); 1.14 @@ -454,10 +450,6 @@ 1.15 return enclosingContext.compatible(found, req, warn); 1.16 } 1.17 1.18 - public Type rawInstantiatePoly(ForAll found, Type req, Warner warn) { 1.19 - return enclosingContext.rawInstantiatePoly(found, req, warn); 1.20 - } 1.21 - 1.22 public void report(DiagnosticPosition pos, Type found, Type req, JCDiagnostic details) { 1.23 enclosingContext.report(pos, found, req, details); 1.24 } 1.25 @@ -482,12 +474,6 @@ 1.26 return types.isAssignable(found, req, warn); 1.27 } 1.28 1.29 - public Type rawInstantiatePoly(ForAll found, Type req, Warner warn) { 1.30 - if (req.tag == NONE) 1.31 - req = found.qtype.tag <= VOID ? found.qtype : syms.objectType; 1.32 - return infer.instantiateExpr(found, req, warn); 1.33 - } 1.34 - 1.35 public Warner checkWarner(DiagnosticPosition pos, Type found, Type req) { 1.36 return convertWarner(pos, found, req); 1.37 } 1.38 @@ -506,11 +492,6 @@ 1.39 Type checkType(final DiagnosticPosition pos, Type found, Type req, CheckContext checkContext) { 1.40 if (req.tag == ERROR) 1.41 return req; 1.42 - if (found.tag == FORALL) { 1.43 - ForAll fa = (ForAll)found; 1.44 - Type owntype = instantiatePoly(pos, checkContext, fa, req, checkContext.checkWarner(pos, found, req)); 1.45 - return checkType(pos, owntype, req, checkContext); 1.46 - } 1.47 if (req.tag == NONE) 1.48 return found; 1.49 if (checkContext.compatible(found, req, checkContext.checkWarner(pos, found, req))) { 1.50 @@ -525,32 +506,6 @@ 1.51 } 1.52 } 1.53 1.54 - /** Instantiate polymorphic type to some prototype, unless 1.55 - * prototype is `anyPoly' in which case polymorphic type 1.56 - * is returned unchanged. 1.57 - */ 1.58 - Type instantiatePoly(DiagnosticPosition pos, CheckContext checkContext, ForAll t, Type pt, Warner warn) throws Infer.NoInstanceException { 1.59 - try { 1.60 - return checkContext.rawInstantiatePoly(t, pt, warn); 1.61 - } catch (final Infer.NoInstanceException ex) { 1.62 - JCDiagnostic d = ex.getDiagnostic(); 1.63 - if (d != null) { 1.64 - if (ex.isAmbiguous) { 1.65 - d = diags.fragment("undetermined.type", t, d); 1.66 - } 1.67 - } 1.68 - checkContext.report(pos, t, pt, d); 1.69 - return types.createErrorType(pt); 1.70 - } catch (Infer.InvalidInstanceException ex) { 1.71 - JCDiagnostic d = ex.getDiagnostic(); 1.72 - if (d != null) { 1.73 - d = diags.fragment("invalid.inferred.types", t.tvars, d); 1.74 - } 1.75 - checkContext.report(pos, t, pt, d); 1.76 - return types.createErrorType(pt); 1.77 - } 1.78 - } 1.79 - 1.80 /** Check that a given type can be cast to a given target type. 1.81 * Return the result of the cast. 1.82 * @param pos Position to be used for error reporting. 1.83 @@ -561,10 +516,7 @@ 1.84 return checkCastable(pos, found, req, basicHandler); 1.85 } 1.86 Type checkCastable(DiagnosticPosition pos, Type found, Type req, CheckContext checkContext) { 1.87 - if (found.tag == FORALL) { 1.88 - instantiatePoly(pos, basicHandler, (ForAll) found, req, castWarner(pos, found, req)); 1.89 - return req; 1.90 - } else if (types.isCastable(found, req, castWarner(pos, found, req))) { 1.91 + if (types.isCastable(found, req, castWarner(pos, found, req))) { 1.92 return req; 1.93 } else { 1.94 checkContext.report(pos, found, req, diags.fragment("inconvertible.types", found, req));