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

changeset 2368
0524f786d7e8
parent 2361
d75c4adbc698
child 2370
acd64168cf8b
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Apr 16 18:15:48 2014 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Apr 18 23:50:41 2014 +0100
     1.3 @@ -249,7 +249,7 @@
     1.4          if (!owntype.hasTag(ERROR) && !resultInfo.pt.hasTag(METHOD) && !resultInfo.pt.hasTag(FORALL)) {
     1.5              if (allowPoly && inferenceContext.free(found)) {
     1.6                  if ((ownkind & ~resultInfo.pkind) == 0) {
     1.7 -                    owntype = resultInfo.check(tree, inferenceContext.asFree(owntype));
     1.8 +                    owntype = resultInfo.check(tree, inferenceContext.asUndetVar(owntype));
     1.9                  } else {
    1.10                      log.error(tree.pos(), "unexpected.type",
    1.11                              kindNames(resultInfo.pkind),
    1.12 @@ -2402,7 +2402,7 @@
    1.13                  //add thrown types as bounds to the thrown types free variables if needed:
    1.14                  if (resultInfo.checkContext.inferenceContext().free(lambdaType.getThrownTypes())) {
    1.15                      List<Type> inferredThrownTypes = flow.analyzeLambdaThrownTypes(env, that, make);
    1.16 -                    List<Type> thrownTypes = resultInfo.checkContext.inferenceContext().asFree(lambdaType.getThrownTypes());
    1.17 +                    List<Type> thrownTypes = resultInfo.checkContext.inferenceContext().asUndetVars(lambdaType.getThrownTypes());
    1.18  
    1.19                      chk.unhandled(inferredThrownTypes, thrownTypes);
    1.20                  }
    1.21 @@ -2543,7 +2543,7 @@
    1.22              @Override
    1.23              public boolean compatible(Type found, Type req, Warner warn) {
    1.24                  //return type must be compatible in both current context and assignment context
    1.25 -                return chk.basicHandler.compatible(found, inferenceContext().asFree(req), warn);
    1.26 +                return chk.basicHandler.compatible(found, inferenceContext().asUndetVar(req), warn);
    1.27              }
    1.28  
    1.29              @Override
    1.30 @@ -2576,7 +2576,7 @@
    1.31          * types must be compatible with the return type of the expected descriptor.
    1.32          */
    1.33          private void checkLambdaCompatible(JCLambda tree, Type descriptor, CheckContext checkContext) {
    1.34 -            Type returnType = checkContext.inferenceContext().asFree(descriptor.getReturnType());
    1.35 +            Type returnType = checkContext.inferenceContext().asUndetVar(descriptor.getReturnType());
    1.36  
    1.37              //return values have already been checked - but if lambda has no return
    1.38              //values, we must ensure that void/value compatibility is correct;
    1.39 @@ -2588,7 +2588,7 @@
    1.40                          diags.fragment("missing.ret.val", returnType)));
    1.41              }
    1.42  
    1.43 -            List<Type> argTypes = checkContext.inferenceContext().asFree(descriptor.getParameterTypes());
    1.44 +            List<Type> argTypes = checkContext.inferenceContext().asUndetVars(descriptor.getParameterTypes());
    1.45              if (!types.isSameTypes(argTypes, TreeInfo.types(tree.params))) {
    1.46                  checkContext.report(tree, diags.fragment("incompatible.arg.types.in.lambda"));
    1.47              }
    1.48 @@ -2832,7 +2832,7 @@
    1.49              if (that.kind.isUnbound() &&
    1.50                      resultInfo.checkContext.inferenceContext().free(argtypes.head)) {
    1.51                  //re-generate inference constraints for unbound receiver
    1.52 -                if (!types.isSubtype(resultInfo.checkContext.inferenceContext().asFree(argtypes.head), exprType)) {
    1.53 +                if (!types.isSubtype(resultInfo.checkContext.inferenceContext().asUndetVar(argtypes.head), exprType)) {
    1.54                      //cannot happen as this has already been checked - we just need
    1.55                      //to regenerate the inference constraints, as that has been lost
    1.56                      //as a result of the call to inferenceContext.save()
    1.57 @@ -2870,7 +2870,7 @@
    1.58  
    1.59      @SuppressWarnings("fallthrough")
    1.60      void checkReferenceCompatible(JCMemberReference tree, Type descriptor, Type refType, CheckContext checkContext, boolean speculativeAttr) {
    1.61 -        Type returnType = checkContext.inferenceContext().asFree(descriptor.getReturnType());
    1.62 +        Type returnType = checkContext.inferenceContext().asUndetVar(descriptor.getReturnType());
    1.63  
    1.64          Type resType;
    1.65          switch (tree.getMode()) {
    1.66 @@ -2902,7 +2902,7 @@
    1.67          }
    1.68  
    1.69          if (!speculativeAttr) {
    1.70 -            List<Type> thrownTypes = checkContext.inferenceContext().asFree(descriptor.getThrownTypes());
    1.71 +            List<Type> thrownTypes = checkContext.inferenceContext().asUndetVars(descriptor.getThrownTypes());
    1.72              if (chk.unhandled(refType.getThrownTypes(), thrownTypes).nonEmpty()) {
    1.73                  log.error(tree, "incompatible.thrown.types.in.mref", refType.getThrownTypes());
    1.74              }

mercurial