Search in sources :

Example 6 with FlowInfo

use of org.eclipse.jdt.internal.compiler.flow.FlowInfo in project bazel-jdt-java-toolchain by salesforce.

the class MessageSend method analyseBooleanAssertion.

private FlowInfo analyseBooleanAssertion(BlockScope currentScope, Expression argument, FlowContext flowContext, FlowInfo flowInfo, boolean wasInsideAssert, boolean passOnTrue) {
    Constant cst = argument.optimizedBooleanConstant();
    boolean isOptimizedTrueAssertion = cst != Constant.NotAConstant && cst.booleanValue() == true;
    boolean isOptimizedFalseAssertion = cst != Constant.NotAConstant && cst.booleanValue() == false;
    int tagBitsSave = flowContext.tagBits;
    flowContext.tagBits |= FlowContext.HIDE_NULL_COMPARISON_WARNING;
    if (!passOnTrue)
        // this affects syntactic analysis for fields in EqualExpression
        flowContext.tagBits |= FlowContext.INSIDE_NEGATION;
    FlowInfo conditionFlowInfo = argument.analyseCode(currentScope, flowContext, flowInfo.copy());
    // survive this assert as a MessageSend and as a Statement
    flowContext.extendTimeToLiveForNullCheckedField(2);
    flowContext.tagBits = tagBitsSave;
    UnconditionalFlowInfo assertWhenPassInfo;
    FlowInfo assertWhenFailInfo;
    boolean isOptimizedPassing;
    boolean isOptimizedFailing;
    if (passOnTrue) {
        assertWhenPassInfo = conditionFlowInfo.initsWhenTrue().unconditionalInits();
        assertWhenFailInfo = conditionFlowInfo.initsWhenFalse();
        isOptimizedPassing = isOptimizedTrueAssertion;
        isOptimizedFailing = isOptimizedFalseAssertion;
    } else {
        assertWhenPassInfo = conditionFlowInfo.initsWhenFalse().unconditionalInits();
        assertWhenFailInfo = conditionFlowInfo.initsWhenTrue();
        isOptimizedPassing = isOptimizedFalseAssertion;
        isOptimizedFailing = isOptimizedTrueAssertion;
    }
    if (isOptimizedPassing) {
        assertWhenFailInfo.setReachMode(FlowInfo.UNREACHABLE_OR_DEAD);
    }
    if (!isOptimizedFailing) {
        // if assertion is not failing for sure, only then it makes sense to carry the flow info ahead.
        // if the code does reach ahead, it means the assert didn't cause an exit, and so
        // the expression inside it shouldn't change the prior flowinfo
        // viz. org.eclipse.core.runtime.Assert.isLegal(false && o != null)
        // keep the merge from the initial code for the definite assignment
        // analysis, tweak the null part to influence nulls downstream
        flowInfo = flowInfo.mergedWith(assertWhenFailInfo.nullInfoLessUnconditionalCopy()).addInitializationsFrom(assertWhenPassInfo.discardInitializationInfo());
    }
    return flowInfo;
}
Also used : FlowInfo(org.eclipse.jdt.internal.compiler.flow.FlowInfo) UnconditionalFlowInfo(org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo) Constant(org.eclipse.jdt.internal.compiler.impl.Constant) UnconditionalFlowInfo(org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo)

Example 7 with FlowInfo

use of org.eclipse.jdt.internal.compiler.flow.FlowInfo in project bazel-jdt-java-toolchain by salesforce.

the class LambdaExpression method analyseCode.

@Override
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, final FlowInfo flowInfo) {
    if (this.ignoreFurtherInvestigation)
        return flowInfo;
    // what happens in vegas, stays in vegas ...
    FlowInfo lambdaInfo = flowInfo.copy();
    ExceptionHandlingFlowContext methodContext = new ExceptionHandlingFlowContext(flowContext, this, this.binding.thrownExceptions, flowContext.getInitializationContext(), this.scope, FlowInfo.DEAD_END);
    // nullity and mark as assigned
    MethodBinding methodWithParameterDeclaration = argumentsTypeElided() ? this.descriptor : this.binding;
    AbstractMethodDeclaration.analyseArguments(currentScope.environment(), lambdaInfo, this.arguments, methodWithParameterDeclaration);
    if (this.arguments != null) {
        for (int i = 0, count = this.arguments.length; i < count; i++) {
            this.bits |= (this.arguments[i].bits & ASTNode.HasTypeAnnotations);
        }
    }
    lambdaInfo = this.body.analyseCode(this.scope, methodContext, lambdaInfo);
    // check for missing returning path for block body's ...
    if (this.body instanceof Block) {
        TypeBinding returnTypeBinding = expectedResultType();
        if ((returnTypeBinding == TypeBinding.VOID)) {
            if ((lambdaInfo.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) == 0 || ((Block) this.body).statements == null) {
                this.bits |= ASTNode.NeedFreeReturn;
            }
        } else {
            if (lambdaInfo != FlowInfo.DEAD_END) {
                this.scope.problemReporter().shouldReturn(returnTypeBinding, this);
            }
        }
    } else {
        // Expression
        if (currentScope.compilerOptions().isAnnotationBasedNullAnalysisEnabled && lambdaInfo.reachMode() == FlowInfo.REACHABLE) {
            Expression expression = (Expression) this.body;
            checkAgainstNullAnnotation(flowContext, expression, flowInfo, expression.nullStatus(lambdaInfo, flowContext));
        }
    }
    return flowInfo;
}
Also used : FlowInfo(org.eclipse.jdt.internal.compiler.flow.FlowInfo) UnconditionalFlowInfo(org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo) ParameterizedTypeBinding(org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding) TypeBinding(org.eclipse.jdt.internal.compiler.lookup.TypeBinding) SourceTypeBinding(org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding) PolyTypeBinding(org.eclipse.jdt.internal.compiler.lookup.PolyTypeBinding) LocalTypeBinding(org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding) MethodBinding(org.eclipse.jdt.internal.compiler.lookup.MethodBinding) SyntheticMethodBinding(org.eclipse.jdt.internal.compiler.lookup.SyntheticMethodBinding) ProblemMethodBinding(org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding) ParameterizedGenericMethodBinding(org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding) ExceptionHandlingFlowContext(org.eclipse.jdt.internal.compiler.flow.ExceptionHandlingFlowContext)

Example 8 with FlowInfo

use of org.eclipse.jdt.internal.compiler.flow.FlowInfo in project bazel-jdt-java-toolchain by salesforce.

the class FieldReference method analyseAssignment.

@Override
public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean isCompound) {
    // compound assignment extra work
    if (isCompound) {
        // check the variable part is initialized if blank final
        if (this.binding.isBlankFinal() && this.receiver.isThis() && currentScope.needBlankFinalFieldInitializationCheck(this.binding)) {
            FlowInfo fieldInits = flowContext.getInitsForFinalBlankInitializationCheck(this.binding.declaringClass.original(), flowInfo);
            if (!fieldInits.isDefinitelyAssigned(this.binding)) {
                currentScope.problemReporter().uninitializedBlankFinalField(this.binding, this);
            // we could improve error msg here telling "cannot use compound assignment on final blank field"
            }
        }
        manageSyntheticAccessIfNecessary(currentScope, flowInfo, true);
    }
    flowInfo = this.receiver.analyseCode(currentScope, flowContext, flowInfo, !this.binding.isStatic()).unconditionalInits();
    this.receiver.checkNPE(currentScope, flowContext, flowInfo);
    if (assignment.expression != null) {
        flowInfo = assignment.expression.analyseCode(currentScope, flowContext, flowInfo).unconditionalInits();
    }
    manageSyntheticAccessIfNecessary(currentScope, flowInfo, false);
    // check if assigning a final field
    if (this.binding.isFinal()) {
        // in a context where it can be assigned?
        if (this.binding.isBlankFinal() && !isCompound && this.receiver.isThis() && !(this.receiver instanceof QualifiedThisReference) && // (this).x is forbidden
        ((this.receiver.bits & ASTNode.ParenthesizedMASK) == 0) && currentScope.allowBlankFinalFieldAssignment(this.binding) && !currentScope.methodScope().isCompactConstructorScope) {
            if (flowInfo.isPotentiallyAssigned(this.binding)) {
                currentScope.problemReporter().duplicateInitializationOfBlankFinalField(this.binding, this);
            } else {
                flowContext.recordSettingFinal(this.binding, this, flowInfo);
            }
            flowInfo.markAsDefinitelyAssigned(this.binding);
        } else {
            if (currentScope.methodScope().isCompactConstructorScope)
                currentScope.problemReporter().recordIllegalExplicitFinalFieldAssignInCompactConstructor(this.binding, this);
            else
                // assigning a final field outside an initializer or constructor or wrong reference
                currentScope.problemReporter().cannotAssignToFinalField(this.binding, this);
        }
    } else if (this.binding.isNonNull() || this.binding.type.isTypeVariable()) {
        // in a context where it can be assigned?
        if (!isCompound && this.receiver.isThis() && !(this.receiver instanceof QualifiedThisReference) && // inherited fields are not tracked here
        TypeBinding.equalsEquals(this.receiver.resolvedType, this.binding.declaringClass) && ((this.receiver.bits & ASTNode.ParenthesizedMASK) == 0)) {
            // (this).x is forbidden
            flowInfo.markAsDefinitelyAssigned(this.binding);
        }
    }
    return flowInfo;
}
Also used : FlowInfo(org.eclipse.jdt.internal.compiler.flow.FlowInfo)

Example 9 with FlowInfo

use of org.eclipse.jdt.internal.compiler.flow.FlowInfo in project bazel-jdt-java-toolchain by salesforce.

the class ForStatement method analyseCode.

@Override
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
    this.breakLabel = new BranchLabel();
    this.continueLabel = new BranchLabel();
    int initialComplaintLevel = (flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0 ? Statement.COMPLAINED_FAKE_REACHABLE : Statement.NOT_COMPLAINED;
    // process the initializations
    if (this.initializations != null) {
        for (int i = 0, count = this.initializations.length; i < count; i++) {
            flowInfo = this.initializations[i].analyseCode(this.scope, flowContext, flowInfo);
        }
    }
    this.preCondInitStateIndex = currentScope.methodScope().recordInitializationStates(flowInfo);
    Constant cst = this.condition == null ? null : this.condition.constant;
    boolean isConditionTrue = cst == null || (cst != Constant.NotAConstant && cst.booleanValue() == true);
    boolean isConditionFalse = cst != null && (cst != Constant.NotAConstant && cst.booleanValue() == false);
    cst = this.condition == null ? null : this.condition.optimizedBooleanConstant();
    boolean isConditionOptimizedTrue = cst == null || (cst != Constant.NotAConstant && cst.booleanValue() == true);
    boolean isConditionOptimizedFalse = cst != null && (cst != Constant.NotAConstant && cst.booleanValue() == false);
    // process the condition
    LoopingFlowContext condLoopContext = null;
    FlowInfo condInfo = flowInfo.nullInfoLessUnconditionalCopy();
    if (this.condition != null) {
        if (!isConditionTrue) {
            condInfo = this.condition.analyseCode(this.scope, (condLoopContext = new LoopingFlowContext(flowContext, flowInfo, this, null, null, this.scope, true)), condInfo);
            this.condition.checkNPEbyUnboxing(currentScope, flowContext, flowInfo);
        }
    }
    // process the action
    LoopingFlowContext loopingContext;
    UnconditionalFlowInfo actionInfo;
    if (this.action == null || (this.action.isEmptyBlock() && currentScope.compilerOptions().complianceLevel <= ClassFileConstants.JDK1_3)) {
        if (condLoopContext != null)
            condLoopContext.complainOnDeferredFinalChecks(this.scope, condInfo);
        if (isConditionTrue) {
            if (condLoopContext != null) {
                condLoopContext.complainOnDeferredNullChecks(currentScope, condInfo);
            }
            return FlowInfo.DEAD_END;
        } else {
            if (isConditionFalse) {
                // for(;false;p());
                this.continueLabel = null;
            }
            actionInfo = condInfo.initsWhenTrue().unconditionalCopy();
            loopingContext = new LoopingFlowContext(flowContext, flowInfo, this, this.breakLabel, this.continueLabel, this.scope, false);
        // there is no action guarded by a preTest, so we use preTest=false
        // to avoid pointless burdens of updating FlowContext.conditionalLevel
        }
    } else {
        loopingContext = new LoopingFlowContext(flowContext, flowInfo, this, this.breakLabel, this.continueLabel, this.scope, true);
        FlowInfo initsWhenTrue = condInfo.initsWhenTrue();
        this.condIfTrueInitStateIndex = currentScope.methodScope().recordInitializationStates(initsWhenTrue);
        if (isConditionFalse) {
            actionInfo = FlowInfo.DEAD_END;
        } else {
            actionInfo = initsWhenTrue.unconditionalCopy();
            if (isConditionOptimizedFalse) {
                actionInfo.setReachMode(FlowInfo.UNREACHABLE_OR_DEAD);
            }
        }
        if (this.action.complainIfUnreachable(actionInfo, this.scope, initialComplaintLevel, true) < Statement.COMPLAINED_UNREACHABLE) {
            if (this.condition != null)
                this.condition.updateFlowOnBooleanResult(actionInfo, true);
            actionInfo = this.action.analyseCode(this.scope, loopingContext, actionInfo).unconditionalInits();
        }
        // code generation can be optimized when no need to continue in the loop
        if ((actionInfo.tagBits & loopingContext.initsOnContinue.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) {
            this.continueLabel = null;
        } else {
            if (condLoopContext != null) {
                condLoopContext.complainOnDeferredFinalChecks(this.scope, condInfo);
            }
            actionInfo = actionInfo.mergedWith(loopingContext.initsOnContinue);
            loopingContext.complainOnDeferredFinalChecks(this.scope, actionInfo);
        }
    }
    // for increments
    FlowInfo exitBranch = flowInfo.copy();
    // recover null inits from before condition analysis
    LoopingFlowContext incrementContext = null;
    if (this.continueLabel != null) {
        if (this.increments != null) {
            incrementContext = new LoopingFlowContext(flowContext, flowInfo, this, null, null, this.scope, true);
            FlowInfo incrementInfo = actionInfo;
            this.preIncrementsInitStateIndex = currentScope.methodScope().recordInitializationStates(incrementInfo);
            for (int i = 0, count = this.increments.length; i < count; i++) {
                incrementInfo = this.increments[i].analyseCode(this.scope, incrementContext, incrementInfo);
            }
            incrementContext.complainOnDeferredFinalChecks(this.scope, actionInfo = incrementInfo.unconditionalInits());
        }
        exitBranch.addPotentialInitializationsFrom(actionInfo).addInitializationsFrom(condInfo.initsWhenFalse());
    } else {
        exitBranch.addInitializationsFrom(condInfo.initsWhenFalse());
        if (this.increments != null) {
            if (initialComplaintLevel == Statement.NOT_COMPLAINED) {
                currentScope.problemReporter().fakeReachable(this.increments[0]);
            }
        }
    }
    // nulls checks
    if (condLoopContext != null) {
        condLoopContext.complainOnDeferredNullChecks(currentScope, actionInfo);
    }
    loopingContext.complainOnDeferredNullChecks(currentScope, actionInfo);
    if (incrementContext != null) {
        incrementContext.complainOnDeferredNullChecks(currentScope, actionInfo);
    }
    if (loopingContext.hasEscapingExceptions()) {
        // https://bugs.eclipse.org/bugs/show_bug.cgi?id=321926
        FlowInfo loopbackFlowInfo = flowInfo.copy();
        if (this.continueLabel != null) {
            // we do get to the bottom
            // loopback | (loopback + action):
            loopbackFlowInfo = loopbackFlowInfo.mergedWith(loopbackFlowInfo.unconditionalCopy().addNullInfoFrom(actionInfo).unconditionalInits());
        }
        loopingContext.simulateThrowAfterLoopBack(loopbackFlowInfo);
    }
    // end of loop
    FlowInfo mergedInfo = FlowInfo.mergedOptimizedBranches((loopingContext.initsOnBreak.tagBits & FlowInfo.UNREACHABLE) != 0 ? loopingContext.initsOnBreak : // recover upstream null info
    flowInfo.addInitializationsFrom(loopingContext.initsOnBreak), isConditionOptimizedTrue, exitBranch, isConditionOptimizedFalse, !isConditionTrue);
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=359495
    if (this.initializations != null) {
        for (int i = 0; i < this.initializations.length; i++) {
            Statement init = this.initializations[i];
            if (init instanceof LocalDeclaration) {
                LocalVariableBinding binding = ((LocalDeclaration) init).binding;
                mergedInfo.resetAssignmentInfo(binding);
            }
        }
    }
    this.mergedInitStateIndex = currentScope.methodScope().recordInitializationStates(mergedInfo);
    this.scope.checkUnclosedCloseables(mergedInfo, loopingContext, null, null);
    if (this.condition != null)
        this.condition.updateFlowOnBooleanResult(mergedInfo, false);
    return mergedInfo;
}
Also used : UnconditionalFlowInfo(org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo) FlowInfo(org.eclipse.jdt.internal.compiler.flow.FlowInfo) BranchLabel(org.eclipse.jdt.internal.compiler.codegen.BranchLabel) Constant(org.eclipse.jdt.internal.compiler.impl.Constant) LoopingFlowContext(org.eclipse.jdt.internal.compiler.flow.LoopingFlowContext) UnconditionalFlowInfo(org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo) LocalVariableBinding(org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding)

Example 10 with FlowInfo

use of org.eclipse.jdt.internal.compiler.flow.FlowInfo in project bazel-jdt-java-toolchain by salesforce.

the class ForeachStatement method analyseCode.

@Override
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
    // initialize break and continue labels
    this.breakLabel = new BranchLabel();
    this.continueLabel = new BranchLabel();
    int initialComplaintLevel = (flowInfo.reachMode() & FlowInfo.UNREACHABLE) != 0 ? Statement.COMPLAINED_FAKE_REACHABLE : Statement.NOT_COMPLAINED;
    // process the element variable and collection
    flowInfo = this.elementVariable.analyseCode(this.scope, flowContext, flowInfo);
    FlowInfo condInfo = this.collection.analyseCode(this.scope, flowContext, flowInfo.copy());
    this.collection.checkNPE(currentScope, flowContext, condInfo.copy(), 1);
    LocalVariableBinding elementVarBinding = this.elementVariable.binding;
    // element variable will be assigned when iterating
    condInfo.markAsDefinitelyAssigned(elementVarBinding);
    this.postCollectionInitStateIndex = currentScope.methodScope().recordInitializationStates(condInfo);
    // process the action
    LoopingFlowContext loopingContext = new LoopingFlowContext(flowContext, flowInfo, this, this.breakLabel, this.continueLabel, this.scope, true);
    UnconditionalFlowInfo actionInfo = condInfo.nullInfoLessUnconditionalCopy();
    actionInfo.markAsDefinitelyUnknown(elementVarBinding);
    if (currentScope.compilerOptions().isAnnotationBasedNullAnalysisEnabled) {
        int elementNullStatus = NullAnnotationMatching.nullStatusFromExpressionType(this.collectionElementType);
        int nullStatus = // have no useful flowinfo for element var
        NullAnnotationMatching.checkAssignment(// have no useful flowinfo for element var
        currentScope, // have no useful flowinfo for element var
        flowContext, // have no useful flowinfo for element var
        elementVarBinding, // have no useful flowinfo for element var
        null, elementNullStatus, this.collection, this.collectionElementType);
        if ((this.kind == GENERIC_ITERABLE || this.kind == RAW_ITERABLE) && !currentScope.compilerOptions().usesNullTypeAnnotations()) {
            // respect declaration annotation on Iterator.next():
            ReferenceBinding iterator = currentScope.getJavaUtilIterator();
            if (iterator != null) {
                MethodBinding next = iterator.getExactMethod(TypeConstants.NEXT, Binding.NO_TYPES, currentScope.compilationUnitScope);
                if (next != null && ((next.tagBits & TagBits.AnnotationNullMASK) != 0)) {
                    nullStatus = FlowInfo.tagBitsToNullStatus(next.tagBits);
                }
            }
        }
        if ((elementVarBinding.type.tagBits & TagBits.IsBaseType) == 0) {
            actionInfo.markNullStatus(elementVarBinding, nullStatus);
        }
    }
    FlowInfo exitBranch;
    if (!(this.action == null || (this.action.isEmptyBlock() && currentScope.compilerOptions().complianceLevel <= ClassFileConstants.JDK1_3))) {
        if (this.action.complainIfUnreachable(actionInfo, this.scope, initialComplaintLevel, true) < Statement.COMPLAINED_UNREACHABLE) {
            actionInfo = this.action.analyseCode(this.scope, loopingContext, actionInfo).unconditionalCopy();
            FakedTrackingVariable.markForeachElementVar(this.elementVariable);
            // action.analyseCode() missed the following check due to identical scopes of ForeachStatement and action:
            // previously action did not see nullinfo from condInfo
            FlowInfo actionNullInfo = condInfo.copy().addNullInfoFrom(actionInfo);
            this.scope.checkUnclosedCloseables(actionNullInfo, loopingContext, null, null);
        }
        // code generation can be optimized when no need to continue in the loop
        exitBranch = flowInfo.unconditionalCopy().addInitializationsFrom(condInfo.initsWhenFalse());
        // TODO (maxime) no need to test when false: can optimize (same for action being unreachable above)
        if ((actionInfo.tagBits & loopingContext.initsOnContinue.tagBits & FlowInfo.UNREACHABLE_OR_DEAD) != 0) {
            this.continueLabel = null;
        } else {
            actionInfo = actionInfo.mergedWith(loopingContext.initsOnContinue);
            loopingContext.complainOnDeferredFinalChecks(this.scope, actionInfo);
            exitBranch.addPotentialInitializationsFrom(actionInfo);
        }
    } else {
        exitBranch = condInfo.initsWhenFalse();
        if (this.action instanceof Block && !this.action.isEmptyBlock()) {
            this.scope.checkUnclosedCloseables(actionInfo, loopingContext, null, null);
        }
    }
    // we need the variable to iterate the collection even if the
    // element variable is not used
    final boolean hasEmptyAction = this.action == null || this.action.isEmptyBlock() || ((this.action.bits & IsUsefulEmptyStatement) != 0);
    switch(this.kind) {
        case ARRAY:
            if (!hasEmptyAction || elementVarBinding.resolvedPosition != -1) {
                this.collectionVariable.useFlag = LocalVariableBinding.USED;
                if (this.continueLabel != null) {
                    this.indexVariable.useFlag = LocalVariableBinding.USED;
                    this.maxVariable.useFlag = LocalVariableBinding.USED;
                }
            }
            break;
        case RAW_ITERABLE:
        case GENERIC_ITERABLE:
            this.indexVariable.useFlag = LocalVariableBinding.USED;
            break;
    }
    // end of loop
    loopingContext.complainOnDeferredNullChecks(currentScope, actionInfo);
    if (loopingContext.hasEscapingExceptions()) {
        // https://bugs.eclipse.org/bugs/show_bug.cgi?id=321926
        FlowInfo loopbackFlowInfo = flowInfo.copy();
        if (this.continueLabel != null) {
            // we do get to the bottom
            // loopback | (loopback + action):
            loopbackFlowInfo = loopbackFlowInfo.mergedWith(loopbackFlowInfo.unconditionalCopy().addNullInfoFrom(actionInfo).unconditionalInits());
        }
        loopingContext.simulateThrowAfterLoopBack(loopbackFlowInfo);
    }
    FlowInfo mergedInfo = FlowInfo.mergedOptimizedBranches((loopingContext.initsOnBreak.tagBits & FlowInfo.UNREACHABLE) != 0 ? loopingContext.initsOnBreak : // recover upstream null info
    flowInfo.addInitializationsFrom(loopingContext.initsOnBreak), false, exitBranch, false, true);
    mergedInfo.resetAssignmentInfo(this.elementVariable.binding);
    this.mergedInitStateIndex = currentScope.methodScope().recordInitializationStates(mergedInfo);
    return mergedInfo;
}
Also used : FlowInfo(org.eclipse.jdt.internal.compiler.flow.FlowInfo) UnconditionalFlowInfo(org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo) BranchLabel(org.eclipse.jdt.internal.compiler.codegen.BranchLabel) MethodBinding(org.eclipse.jdt.internal.compiler.lookup.MethodBinding) ReferenceBinding(org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding) ProblemReferenceBinding(org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding) LoopingFlowContext(org.eclipse.jdt.internal.compiler.flow.LoopingFlowContext) UnconditionalFlowInfo(org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo) LocalVariableBinding(org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding)

Aggregations

FlowInfo (org.eclipse.jdt.internal.compiler.flow.FlowInfo)13 LocalVariableBinding (org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding)5 UnconditionalFlowInfo (org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo)4 FieldBinding (org.eclipse.jdt.internal.compiler.lookup.FieldBinding)4 ProblemFieldBinding (org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding)4 BranchLabel (org.eclipse.jdt.internal.compiler.codegen.BranchLabel)3 ReferenceBinding (org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding)3 LoopingFlowContext (org.eclipse.jdt.internal.compiler.flow.LoopingFlowContext)2 Constant (org.eclipse.jdt.internal.compiler.impl.Constant)2 MethodBinding (org.eclipse.jdt.internal.compiler.lookup.MethodBinding)2 SourceTypeBinding (org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding)2 TypeBinding (org.eclipse.jdt.internal.compiler.lookup.TypeBinding)2 ExceptionHandlingFlowContext (org.eclipse.jdt.internal.compiler.flow.ExceptionHandlingFlowContext)1 SwitchFlowContext (org.eclipse.jdt.internal.compiler.flow.SwitchFlowContext)1 LocalTypeBinding (org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding)1 ParameterizedGenericMethodBinding (org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding)1 ParameterizedTypeBinding (org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding)1 PolyTypeBinding (org.eclipse.jdt.internal.compiler.lookup.PolyTypeBinding)1 ProblemMethodBinding (org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding)1 ProblemReferenceBinding (org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding)1