private boolean doesNotCompleteNormally() { try { return this.body.analyseCode(this.scope, new ExceptionHandlingFlowContext(null, this, Binding.NO_EXCEPTIONS, null, this.scope, FlowInfo.DEAD_END), UnconditionalFlowInfo.fakeInitializedFlowInfo(this.scope.outerMostMethodScope().analysisIndex, this.scope.referenceType().maxFieldCount)) == FlowInfo.DEAD_END; } catch (RuntimeException e) { this.scope.problemReporter().lambdaShapeComputationError(this); return this.valueCompatible; } } public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, final FlowInfo flowInfo) {
exceptionContext.recordHandlingException( caughtException, flowInfo.unconditionalInits(), break; case Scope.MORE_GENERIC : exceptionContext.recordHandlingException( caughtException, flowInfo.unconditionalInits(), if (method.isConstructor() && method.binding.declaringClass.isAnonymousType()){ exceptionContext.mergeUnhandledException(raisedException); return; // no need to complain, will fix up constructor exceptions
public void complainIfUnusedExceptionHandlers(BlockScope scope,TryStatement tryStatement) { // report errors for unreachable exception handlers for (int index = 0, count = this.handledExceptions.length; index < count; index++) { int cacheIndex = index / ExceptionHandlingFlowContext.BitCacheSize; int bitMask = 1 << (index % ExceptionHandlingFlowContext.BitCacheSize); if ((this.isReached[cacheIndex] & bitMask) == 0) { scope.problemReporter().unreachableCatchBlock( this.handledExceptions[index], getExceptionType(index)); } else { if ((this.isNeeded[cacheIndex] & bitMask) == 0) { scope.problemReporter().hiddenCatchBlock( this.handledExceptions[index], getExceptionType(index)); } } } }
new ExceptionHandlingFlowContext( flowContext, this, methodContext.expireNullCheckedFieldInfo(); methodContext.complainIfUnusedExceptionHandlers(this);
new ExceptionHandlingFlowContext( flowContext, this, ReferenceBinding[] thrownExceptions = closeMethod.thrownExceptions; for (int j = 0, length = thrownExceptions.length; j < length; j++) { handlingContext.checkExceptionHandlers(thrownExceptions[j], this.resources[i], tryInfo, currentScope, true); handlingContext.complainIfUnusedExceptionHandlers(this.scope, this); new ExceptionHandlingFlowContext( insideSubContext, this, ReferenceBinding[] thrownExceptions = closeMethod.thrownExceptions; for (int j = 0, length = thrownExceptions.length; j < length; j++) { handlingContext.checkExceptionHandlers(thrownExceptions[j], this.resources[i], tryInfo, currentScope, true); handlingContext.complainIfUnusedExceptionHandlers(this.scope, this);
new ExceptionHandlingFlowContext( flowContext, this, ReferenceBinding[] thrownExceptions = closeMethod.thrownExceptions; for (int j = 0, length = thrownExceptions.length; j < length; j++) { handlingContext.checkExceptionHandlers(thrownExceptions[j], this.resources[i], tryInfo, currentScope, true); handlingContext.complainIfUnusedExceptionHandlers(this.scope, this); flowInfo.unconditionalCopy(). addPotentialInitializationsFrom( handlingContext.initsOnException(i)). addPotentialInitializationsFrom(tryInfo). addPotentialInitializationsFrom( handlingContext.initsOnReturn)); } else { FlowInfo initsOnException = handlingContext.initsOnException(i); catchInfo = flowInfo.nullInfoLessUnconditionalCopy() new ExceptionHandlingFlowContext( insideSubContext, this, ReferenceBinding[] thrownExceptions = closeMethod.thrownExceptions; for (int j = 0, length = thrownExceptions.length; j < length; j++) { handlingContext.checkExceptionHandlers(thrownExceptions[j], this.resources[i], tryInfo, currentScope, true);
new ExceptionHandlingFlowContext( initializationContext, this, methodContext.complainIfUnusedExceptionHandlers(this);
new ExceptionHandlingFlowContext( flowContext, this, handlingContext.complainIfUnusedExceptionHandlers(this.scope, this); flowInfo.unconditionalCopy(). addPotentialInitializationsFrom( handlingContext.initsOnException( this.caughtExceptionTypes[i])). addPotentialInitializationsFrom(tryInfo). flowInfo.unconditionalCopy(). addPotentialInitializationsFrom( handlingContext.initsOnException( this.caughtExceptionTypes[i])) .addPotentialInitializationsFrom( new ExceptionHandlingFlowContext( insideSubContext, this, handlingContext.complainIfUnusedExceptionHandlers(this.scope, this); flowInfo.unconditionalCopy(). addPotentialInitializationsFrom( handlingContext.initsOnException( this.caughtExceptionTypes[i])). addPotentialInitializationsFrom(tryInfo).
void simulateThrowAfterLoopBack(FlowInfo flowInfo) { this.catchingContext.recordHandlingException(this.caughtException, flowInfo.unconditionalInits(), null, // raised exception, irrelevant here, null, null, /* invocation site, irrelevant here */ true // we have no business altering the needed status. ); } }
flowInfo.unconditionalCopy(). addPotentialInitializationsFrom( handlingContext.initsOnException(i)). addPotentialInitializationsFrom(tryInfo). addPotentialInitializationsFrom( addNullInfoFrom(handlingContext.initsOnFinally); } else { FlowInfo initsOnException = handlingContext.initsOnException(i); catchInfo = flowInfo.nullInfoLessUnconditionalCopy()
public FlowInfo getInitsForFinalBlankInitializationCheck(TypeBinding declaringType, FlowInfo flowInfo) { FlowContext current = this; FlowInfo inits = flowInfo; do { if (current instanceof InitializationFlowContext) { InitializationFlowContext initializationContext = (InitializationFlowContext) current; if (((TypeDeclaration)initializationContext.associatedNode).binding == declaringType) { return inits; } inits = initializationContext.initsBeforeContext; current = initializationContext.initializationParent; } else if (current instanceof ExceptionHandlingFlowContext) { ExceptionHandlingFlowContext exceptionContext = (ExceptionHandlingFlowContext) current; current = exceptionContext.initializationParent == null ? exceptionContext.getLocalParent() : exceptionContext.initializationParent; } else { current = current.getLocalParent(); } } while (current != null); // not found return null; }
new ExceptionHandlingFlowContext( flowContext, this, methodContext.expireNullCheckedFieldInfo(); methodContext.complainIfUnusedExceptionHandlers(this);
new ExceptionHandlingFlowContext( flowContext, this, ReferenceBinding[] thrownExceptions = closeMethod.thrownExceptions; for (int j = 0, length = thrownExceptions.length; j < length; j++) { handlingContext.checkExceptionHandlers(thrownExceptions[j], this.resources[i], tryInfo, currentScope, true); handlingContext.complainIfUnusedExceptionHandlers(this.scope, this); new ExceptionHandlingFlowContext( insideSubContext, this, ReferenceBinding[] thrownExceptions = closeMethod.thrownExceptions; for (int j = 0, length = thrownExceptions.length; j < length; j++) { handlingContext.checkExceptionHandlers(thrownExceptions[j], this.resources[i], tryInfo, currentScope, true); handlingContext.complainIfUnusedExceptionHandlers(this.scope, this);
new ExceptionHandlingFlowContext( initializerFlowContext.parent, this, constructorContext.complainIfUnusedExceptionHandlers(this);
new ExceptionHandlingFlowContext( flowContext, this, handlingContext.complainIfUnusedExceptionHandlers(this.scope, this); flowInfo.unconditionalCopy(). addPotentialInitializationsFrom( handlingContext.initsOnException( this.caughtExceptionTypes[i])). addPotentialInitializationsFrom(tryInfo). handlingContext.initsOnReturn)); } else { FlowInfo initsOnException = handlingContext.initsOnException(this.caughtExceptionTypes[i]); catchInfo = flowInfo.nullInfoLessUnconditionalCopy() new ExceptionHandlingFlowContext( insideSubContext, this, handlingContext.complainIfUnusedExceptionHandlers(this.scope, this); flowInfo.unconditionalCopy(). addPotentialInitializationsFrom( handlingContext.initsOnException( this.caughtExceptionTypes[i])). addPotentialInitializationsFrom(tryInfo).
void simulateThrowAfterLoopBack(FlowInfo flowInfo) { this.catchingContext.recordHandlingException(this.caughtException, flowInfo.unconditionalInits(), null, // raised exception, irrelevant here, null, null, /* invocation site, irrelevant here */ true // we have no business altering the needed status. ); } }
flowInfo.unconditionalCopy(). addPotentialInitializationsFrom( handlingContext.initsOnException(i)). addPotentialInitializationsFrom(tryInfo). addPotentialInitializationsFrom( addNullInfoFrom(handlingContext.initsOnFinally); } else { FlowInfo initsOnException = handlingContext.initsOnException(i); catchInfo = flowInfo.nullInfoLessUnconditionalCopy()
public FlowInfo getInitsForFinalBlankInitializationCheck(TypeBinding declaringType, FlowInfo flowInfo) { FlowContext current = this; FlowInfo inits = flowInfo; do { if (current instanceof InitializationFlowContext) { InitializationFlowContext initializationContext = (InitializationFlowContext) current; if (TypeBinding.equalsEquals(((TypeDeclaration)initializationContext.associatedNode).binding, declaringType)) { return inits; } inits = initializationContext.initsBeforeContext; current = initializationContext.initializationParent; } else if (current instanceof ExceptionHandlingFlowContext) { ExceptionHandlingFlowContext exceptionContext = (ExceptionHandlingFlowContext) current; current = exceptionContext.initializationParent == null ? exceptionContext.getLocalParent() : exceptionContext.initializationParent; } else { current = current.getLocalParent(); } } while (current != null); // not found return null; }
new ExceptionHandlingFlowContext( flowContext, this, methodContext.expireNullCheckedFieldInfo(); methodContext.complainIfUnusedExceptionHandlers(this);
exceptionContext.recordHandlingException( caughtException, flowInfo.unconditionalInits(), exceptionContext.recordHandlingException( caughtException, flowInfo.unconditionalInits(), TypeBinding raisedException; if ((raisedException = raisedExceptions[i]) != null) { exceptionContext.mergeUnhandledException(raisedException);