<s> package org . eclipse . jdt . internal . compiler . flow ; import org . eclipse . jdt . internal . compiler . ast . ASTNode ; import org . eclipse . jdt . internal . compiler . ast . IfStatement ; import org . eclipse . jdt . internal . compiler . lookup . FieldBinding ; import org . eclipse . jdt . internal . compiler . lookup . LocalVariableBinding ; public abstract class FlowInfo { public int tagBits ; public final static int REACHABLE = 0 ; public final static int UNREACHABLE_OR_DEAD = 1 ; public final static int UNREACHABLE_BY_NULLANALYSIS = 2 ; public final static int UNREACHABLE = UNREACHABLE_OR_DEAD | UNREACHABLE_BY_NULLANALYSIS ; public final static int NULL_FLAG_MASK = 4 ; public final static int UNKNOWN = 1 ; public final static int NULL = 2 ; public final static int NON_NULL = 4 ; public final static int POTENTIALLY_UNKNOWN = 8 ; public final static int POTENTIALLY_NULL = 16 ; public final static int POTENTIALLY_NON_NULL = 32 ; public static final UnconditionalFlowInfo DEAD_END ; static { DEAD_END = new UnconditionalFlowInfo ( ) ; DEAD_END . tagBits = UNREACHABLE ; } abstract public FlowInfo addInitializationsFrom ( FlowInfo otherInits ) ; abstract public FlowInfo addNullInfoFrom ( FlowInfo otherInits ) ; abstract public FlowInfo addPotentialInitializationsFrom ( FlowInfo otherInits ) ; public FlowInfo asNegatedCondition ( ) { return this ; } public static FlowInfo conditional ( FlowInfo initsWhenTrue , FlowInfo initsWhenFalse ) { if ( initsWhenTrue == initsWhenFalse ) return initsWhenTrue ; return new ConditionalFlowInfo ( initsWhenTrue , initsWhenFalse ) ; } public boolean cannotBeDefinitelyNullOrNonNull ( LocalVariableBinding local ) { return isPotentiallyUnknown ( local ) || isPotentiallyNonNull ( local ) && isPotentiallyNull ( local ) ; } public boolean cannotBeNull ( LocalVariableBinding local ) { return isDefinitelyNonNull ( local ) || isProtectedNonNull ( local ) ; } public boolean canOnlyBeNull ( LocalVariableBinding local ) { return isDefinitelyNull ( local ) || isProtectedNull ( local ) ; } abstract public FlowInfo copy ( ) ; public static UnconditionalFlowInfo initial ( int maxFieldCount ) { UnconditionalFlowInfo info = new UnconditionalFlowInfo ( ) ; info . maxFieldCount = maxFieldCount ; return info ; } abstract public FlowInfo initsWhenFalse ( ) ; abstract public FlowInfo initsWhenTrue ( ) ; abstract public boolean isDefinitelyAssigned ( FieldBinding field ) ; public abstract boolean isDefinitelyAssigned ( LocalVariableBinding local ) ; public abstract boolean isDefinitelyNonNull ( LocalVariableBinding local ) ; public abstract boolean isDefinitelyNull ( LocalVariableBinding local ) ; public abstract boolean isDefinitelyUnknown ( LocalVariableBinding local ) ; abstract public boolean isPotentiallyAssigned ( FieldBinding field ) ; abstract public boolean isPotentiallyAssigned ( LocalVariableBinding field ) ; public abstract boolean isPotentiallyNonNull ( LocalVariableBinding local ) ; public abstract boolean isPotentiallyNull ( LocalVariableBinding local ) ; public abstract boolean isPotentiallyUnknown ( LocalVariableBinding local ) ; public abstract boolean isProtectedNonNull ( LocalVariableBinding local ) ; public abstract boolean isProtectedNull ( LocalVariableBinding local ) ; abstract public void markAsComparedEqualToNonNull ( LocalVariableBinding local ) ; abstract public void markAsComparedEqualToNull ( LocalVariableBinding local ) ; abstract public void markAsDefinitelyAssigned ( FieldBinding field ) ; abstract public void markAsDefinitelyNonNull ( LocalVariableBinding local ) ; abstract public void markAsDefinitelyNull ( LocalVariableBinding local ) ; abstract public void resetNullInfo ( LocalVariableBinding local ) ; abstract public void markPotentiallyUnknownBit ( LocalVariableBinding local ) ; abstract public void markPotentiallyNullBit ( LocalVariableBinding local ) ; abstract public void markPotentiallyNonNullBit ( LocalVariableBinding local ) ; abstract public void markAsDefinitelyAssigned ( LocalVariableBinding local ) ; abstract public void markAsDefinitelyUnknown ( LocalVariableBinding local ) ; public void markNullStatus ( LocalVariableBinding local , int nullStatus ) { switch ( nullStatus ) { case FlowInfo . UNKNOWN : markAsDefinitelyUnknown ( local ) ; break ; case FlowInfo . NULL : markAsDefinitelyNull ( local ) ; break ; case FlowInfo . NON_NULL : markAsDefinitelyNonNull ( local ) ; break ; default : resetNullInfo ( local ) ; if ( ( nullStatus & FlowInfo . POTENTIALLY_UNKNOWN ) != 0 ) markPotentiallyUnknownBit ( local ) ; if ( ( nullStatus & FlowInfo . POTENTIALLY_NULL ) != 0 ) markPotentiallyNullBit ( local ) ; if ( ( nullStatus & FlowInfo . POTENTIALLY_NON_NULL ) != 0 ) markPotentiallyNonNullBit ( local ) ; if ( ( nullStatus & ( FlowInfo . POTENTIALLY_NULL | FlowInfo . POTENTIALLY_NON_NULL | FlowInfo . POTENTIALLY_UNKNOWN ) ) == 0 ) markAsDefinitelyUnknown ( local ) ; } } public int nullStatus ( LocalVariableBinding local ) { if ( isDefinitelyUnknown ( local ) ) return FlowInfo . UNKNOWN ; if ( isDefinitelyNull ( local ) ) return FlowInfo . NULL ; if ( isDefinitelyNonNull ( local ) ) return FlowInfo . NON_NULL ; int status = 0 ; if ( isPotentiallyUnknown ( local ) ) status |= FlowInfo . POTENTIALLY_UNKNOWN ; if ( isPotentiallyNull ( local ) ) status |= FlowInfo . POTENTIALLY_NULL ; if ( isPotentiallyNonNull ( local ) ) status |= FlowInfo . POTENTIALLY_NON_NULL ; if ( status > 0 ) return status ; return FlowInfo . UNKNOWN ; } public static UnconditionalFlowInfo mergedOptimizedBranches ( FlowInfo initsWhenTrue , boolean isOptimizedTrue , FlowInfo initsWhenFalse , boolean isOptimizedFalse , boolean allowFakeDeadBranch ) { UnconditionalFlowInfo mergedInfo ; if ( isOptimizedTrue ) { if ( initsWhenTrue == FlowInfo . DEAD_END && allowFakeDeadBranch ) { mergedInfo = initsWhenFalse . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) . unconditionalInits ( ) ; } else { mergedInfo = initsWhenTrue . addPotentialInitializationsFrom ( initsWhenFalse . nullInfoLessUnconditionalCopy ( ) ) . unconditionalInits ( ) ; } } else if ( isOptimizedFalse ) { if ( initsWhenFalse == FlowInfo . DEAD_END && allowFakeDeadBranch ) { mergedInfo = initsWhenTrue . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) . unconditionalInits ( ) ; } else { mergedInfo = initsWhenFalse . addPotentialInitializationsFrom ( initsWhenTrue . nullInfoLessUnconditionalCopy ( ) ) . unconditionalInits ( ) ; } } else { mergedInfo = initsWhenTrue . mergedWith ( initsWhenFalse . unconditionalInits ( ) ) ; } return mergedInfo ; } public static UnconditionalFlowInfo mergedOptimizedBranchesIfElse ( FlowInfo initsWhenTrue , boolean isOptimizedTrue , FlowInfo initsWhenFalse , boolean isOptimizedFalse , boolean allowFakeDeadBranch , FlowInfo flowInfo , IfStatement ifStatement ) { UnconditionalFlowInfo mergedInfo ; if ( isOptimizedTrue ) { if ( initsWhenTrue == FlowInfo . DEAD_END && allowFakeDeadBranch ) { mergedInfo = initsWhenFalse . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) . unconditionalInits ( ) ; } else { mergedInfo = initsWhenTrue . addPotentialInitializationsFrom ( initsWhenFalse . nullInfoLessUnconditionalCopy ( ) ) . unconditionalInits ( ) ; } } else if ( isOptimizedFalse ) { if ( initsWhenFalse == FlowInfo . DEAD_END && allowFakeDeadBranch ) { mergedInfo = initsWhenTrue . setReachMode ( FlowInfo . UNREACHABLE_OR_DEAD ) . unconditionalInits ( ) ; } else { mergedInfo = initsWhenFalse . addPotentialInitializationsFrom ( initsWhenTrue . nullInfoLessUnconditionalCopy ( ) ) . unconditionalInits ( ) ; } } else if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE ) == 0 && ( ifStatement . bits & ASTNode . IsElseStatementUnreachable ) != 0 && initsWhenTrue != FlowInfo . DEAD_END && initsWhenFalse != FlowInfo . DEAD_END ) { mergedInfo = initsWhenTrue . addPotentialInitializationsFrom ( initsWhenFalse . nullInfoLessUnconditionalCopy ( ) ) . unconditionalInits ( ) ; mergedInfo . definiteInits &= initsWhenFalse . unconditionalCopy ( ) . definiteInits ; } else if ( ( flowInfo . tagBits & FlowInfo . UNREACHABLE ) == 0 && ( ifStatement . bits & ASTNode . IsThenStatementUnreachable ) != 0 && initsWhenTrue != FlowInfo . DEAD_END && initsWhenFalse != FlowInfo . DEAD_END ) { mergedInfo = initsWhenFalse . addPotentialInitializationsFrom ( initsWhenTrue . nullInfoLessUnconditionalCopy ( ) ) . unconditionalInits ( ) ; mergedInfo . definiteInits &= initsWhenTrue . unconditionalCopy ( ) . definiteInits ; } else { mergedInfo = initsWhenTrue . mergedWith ( initsWhenFalse . unconditionalInits ( ) ) ; } return mergedInfo ; } public int reachMode ( ) { return this . tagBits & UNREACHABLE ; } abstract public FlowInfo safeInitsWhenTrue ( ) ; abstract public FlowInfo setReachMode ( int reachMode ) ; abstract public UnconditionalFlowInfo mergedWith ( UnconditionalFlowInfo otherInits ) ; abstract public UnconditionalFlowInfo nullInfoLessUnconditionalCopy ( ) ; public String toString ( ) { if ( this == DEAD_END ) { return "" ; } return super . toString ( ) ; } abstract public UnconditionalFlowInfo unconditionalCopy ( ) ; abstract public UnconditionalFlowInfo unconditionalFieldLessCopy ( ) ; abstract public UnconditionalFlowInfo unconditionalInits ( ) ; abstract public UnconditionalFlowInfo unconditionalInitsWithoutSideEffect ( ) ; abstract public void markedAsNullOrNonNullInAssertExpression ( LocalVariableBinding local ) ; abstract public boolean isMarkedAsNullOrNonNullInAssertExpression ( LocalVariableBinding local ) ; abstract public void resetAssignmentInfo ( LocalVariableBinding local ) ; } </s>