src/share/classes/com/sun/tools/javac/comp/Infer.java

changeset 1479
38d3d1027f5a
parent 1415
01c9d4161882
child 1510
7873d37f5b37
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Mon Jan 07 17:51:05 2013 +0000
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Tue Jan 08 10:15:30 2013 +0100
     1.3 @@ -114,7 +114,7 @@
     1.4          }
     1.5      }
     1.6  
     1.7 -    private final InferenceException inferenceException;
     1.8 +    final InferenceException inferenceException;
     1.9  
    1.10  /***************************************************************************
    1.11   * Mini/Maximization of UndetVars
    1.12 @@ -271,15 +271,19 @@
    1.13                                    boolean allowBoxing,
    1.14                                    boolean useVarargs,
    1.15                                    Resolve.MethodResolutionContext resolveContext,
    1.16 +                                  Resolve.MethodCheck methodCheck,
    1.17                                    Warner warn) throws InferenceException {
    1.18          //-System.err.println("instantiateMethod(" + tvars + ", " + mt + ", " + argtypes + ")"); //DEBUG
    1.19          final InferenceContext inferenceContext = new InferenceContext(tvars, this, true);
    1.20          inferenceException.clear();
    1.21  
    1.22 +        DeferredAttr.DeferredAttrContext deferredAttrContext =
    1.23 +                resolveContext.deferredAttrContext(msym, inferenceContext);
    1.24 +
    1.25          try {
    1.26 -            rs.checkRawArgumentsAcceptable(env, msym, resolveContext.attrMode(), inferenceContext,
    1.27 -                    argtypes, mt.getParameterTypes(), allowBoxing, useVarargs, warn,
    1.28 -                    new InferenceCheckHandler(inferenceContext));
    1.29 +            methodCheck.argumentsAcceptable(env, deferredAttrContext, argtypes, mt.getParameterTypes(), warn);
    1.30 +
    1.31 +            deferredAttrContext.complete();
    1.32  
    1.33              // minimize as yet undetermined type variables
    1.34              for (Type t : inferenceContext.undetvars) {
    1.35 @@ -309,32 +313,6 @@
    1.36              inferenceContext.notifyChange(types);
    1.37          }
    1.38      }
    1.39 -    //where
    1.40 -
    1.41 -        /** inference check handler **/
    1.42 -        class InferenceCheckHandler implements Resolve.MethodCheckHandler {
    1.43 -
    1.44 -            InferenceContext inferenceContext;
    1.45 -
    1.46 -            public InferenceCheckHandler(InferenceContext inferenceContext) {
    1.47 -                this.inferenceContext = inferenceContext;
    1.48 -            }
    1.49 -
    1.50 -            public InapplicableMethodException arityMismatch() {
    1.51 -                return inferenceException.setMessage("infer.arg.length.mismatch", inferenceContext.inferenceVars());
    1.52 -            }
    1.53 -            public InapplicableMethodException argumentMismatch(boolean varargs, JCDiagnostic details) {
    1.54 -                String key = varargs ?
    1.55 -                        "infer.varargs.argument.mismatch" :
    1.56 -                        "infer.no.conforming.assignment.exists";
    1.57 -                return inferenceException.setMessage(key,
    1.58 -                        inferenceContext.inferenceVars(), details);
    1.59 -            }
    1.60 -            public InapplicableMethodException inaccessibleVarargs(Symbol location, Type expected) {
    1.61 -                return inferenceException.setMessage("inaccessible.varargs.type",
    1.62 -                        expected, Kinds.kindName(location), location);
    1.63 -            }
    1.64 -        }
    1.65  
    1.66      /** check that type parameters are within their bounds.
    1.67       */

mercurial