< prev index next >

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

Print this page
rev 54093 : 8177068: incomplete classpath causes NPE in Flow
Summary: Undo completions that failed during speculative attribution, so that the appropriate CompletionFailures are thrown again and properly reported.
Reviewed-by: vromero


2609             that.type = currentTarget; //avoids recovery at this stage
2610             checkLambdaCompatible(that, lambdaType, resultInfo.checkContext);
2611 
2612             if (!isSpeculativeRound) {
2613                 //add thrown types as bounds to the thrown types free variables if needed:
2614                 if (resultInfo.checkContext.inferenceContext().free(lambdaType.getThrownTypes())) {
2615                     List<Type> inferredThrownTypes = flow.analyzeLambdaThrownTypes(env, that, make);
2616                     if(!checkExConstraints(inferredThrownTypes, lambdaType.getThrownTypes(), resultInfo.checkContext.inferenceContext())) {
2617                         log.error(that, Errors.IncompatibleThrownTypesInMref(lambdaType.getThrownTypes()));
2618                     }
2619                 }
2620 
2621                 checkAccessibleTypes(that, localEnv, resultInfo.checkContext.inferenceContext(), lambdaType, currentTarget);
2622             }
2623             result = check(that, currentTarget, KindSelector.VAL, resultInfo);
2624         } catch (Types.FunctionDescriptorLookupError ex) {
2625             JCDiagnostic cause = ex.getDiagnostic();
2626             resultInfo.checkContext.report(that, cause);
2627             result = that.type = types.createErrorType(pt());
2628             return;


2629         } catch (Throwable t) {
2630             //when an unexpected exception happens, avoid attempts to attribute the same tree again
2631             //as that would likely cause the same exception again.
2632             needsRecovery = false;
2633             throw t;
2634         } finally {
2635             localEnv.info.scope.leave();
2636             if (needsRecovery) {
2637                 attribTree(that, env, recoveryInfo);
2638             }
2639         }
2640     }
2641     //where
2642         class TargetInfo {
2643             Type target;
2644             Type descriptor;
2645 
2646             public TargetInfo(Type target, Type descriptor) {
2647                 this.target = target;
2648                 this.descriptor = descriptor;




2609             that.type = currentTarget; //avoids recovery at this stage
2610             checkLambdaCompatible(that, lambdaType, resultInfo.checkContext);
2611 
2612             if (!isSpeculativeRound) {
2613                 //add thrown types as bounds to the thrown types free variables if needed:
2614                 if (resultInfo.checkContext.inferenceContext().free(lambdaType.getThrownTypes())) {
2615                     List<Type> inferredThrownTypes = flow.analyzeLambdaThrownTypes(env, that, make);
2616                     if(!checkExConstraints(inferredThrownTypes, lambdaType.getThrownTypes(), resultInfo.checkContext.inferenceContext())) {
2617                         log.error(that, Errors.IncompatibleThrownTypesInMref(lambdaType.getThrownTypes()));
2618                     }
2619                 }
2620 
2621                 checkAccessibleTypes(that, localEnv, resultInfo.checkContext.inferenceContext(), lambdaType, currentTarget);
2622             }
2623             result = check(that, currentTarget, KindSelector.VAL, resultInfo);
2624         } catch (Types.FunctionDescriptorLookupError ex) {
2625             JCDiagnostic cause = ex.getDiagnostic();
2626             resultInfo.checkContext.report(that, cause);
2627             result = that.type = types.createErrorType(pt());
2628             return;
2629         } catch (CompletionFailure cf) {
2630             chk.completionError(that.pos(), cf);
2631         } catch (Throwable t) {
2632             //when an unexpected exception happens, avoid attempts to attribute the same tree again
2633             //as that would likely cause the same exception again.
2634             needsRecovery = false;
2635             throw t;
2636         } finally {
2637             localEnv.info.scope.leave();
2638             if (needsRecovery) {
2639                 attribTree(that, env, recoveryInfo);
2640             }
2641         }
2642     }
2643     //where
2644         class TargetInfo {
2645             Type target;
2646             Type descriptor;
2647 
2648             public TargetInfo(Type target, Type descriptor) {
2649                 this.target = target;
2650                 this.descriptor = descriptor;


< prev index next >