langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java
changeset 21488 4a69e26aa999
parent 21480 9d08c2d0fafd
child 21498 58c2486db8d0
equal deleted inserted replaced
21487:c00623074ad0 21488:4a69e26aa999
   248     Type check(final JCTree tree, final Type found, final int ownkind, final ResultInfo resultInfo) {
   248     Type check(final JCTree tree, final Type found, final int ownkind, final ResultInfo resultInfo) {
   249         InferenceContext inferenceContext = resultInfo.checkContext.inferenceContext();
   249         InferenceContext inferenceContext = resultInfo.checkContext.inferenceContext();
   250         Type owntype = found;
   250         Type owntype = found;
   251         if (!owntype.hasTag(ERROR) && !resultInfo.pt.hasTag(METHOD) && !resultInfo.pt.hasTag(FORALL)) {
   251         if (!owntype.hasTag(ERROR) && !resultInfo.pt.hasTag(METHOD) && !resultInfo.pt.hasTag(FORALL)) {
   252             if (allowPoly && inferenceContext.free(found)) {
   252             if (allowPoly && inferenceContext.free(found)) {
       
   253                 if ((ownkind & ~resultInfo.pkind) == 0) {
       
   254                     owntype = resultInfo.check(tree, inferenceContext.asFree(owntype));
       
   255                 } else {
       
   256                     log.error(tree.pos(), "unexpected.type",
       
   257                             kindNames(resultInfo.pkind),
       
   258                             kindName(ownkind));
       
   259                     owntype = types.createErrorType(owntype);
       
   260                 }
   253                 inferenceContext.addFreeTypeListener(List.of(found, resultInfo.pt), new FreeTypeListener() {
   261                 inferenceContext.addFreeTypeListener(List.of(found, resultInfo.pt), new FreeTypeListener() {
   254                     @Override
   262                     @Override
   255                     public void typesInferred(InferenceContext inferenceContext) {
   263                     public void typesInferred(InferenceContext inferenceContext) {
   256                         ResultInfo pendingResult =
   264                         ResultInfo pendingResult =
   257                                     resultInfo.dup(inferenceContext.asInstType(resultInfo.pt));
   265                                     resultInfo.dup(inferenceContext.asInstType(resultInfo.pt));
   508             return new ResultInfo(pkind, newPt, checkContext);
   516             return new ResultInfo(pkind, newPt, checkContext);
   509         }
   517         }
   510 
   518 
   511         protected ResultInfo dup(CheckContext newContext) {
   519         protected ResultInfo dup(CheckContext newContext) {
   512             return new ResultInfo(pkind, pt, newContext);
   520             return new ResultInfo(pkind, pt, newContext);
       
   521         }
       
   522 
       
   523         @Override
       
   524         public String toString() {
       
   525             if (pt != null) {
       
   526                 return pt.toString();
       
   527             } else {
       
   528                 return "";
       
   529             }
   513         }
   530         }
   514     }
   531     }
   515 
   532 
   516     class RecoveryInfo extends ResultInfo {
   533     class RecoveryInfo extends ResultInfo {
   517 
   534