/** * Mark that this resource is passed to some outside code * (as argument to a method/ctor call or as a return value from the current method), * and thus should be considered as potentially closed. * @param owned should the resource be considered owned by some outside? */ public static FlowInfo markPassedToOutside(BlockScope scope, Expression expression, FlowInfo flowInfo, FlowContext flowContext, boolean owned) { FakedTrackingVariable trackVar = getCloseTrackingVariable(expression, flowInfo, flowContext); if (trackVar != null) { // insert info that the tracked resource *may* be closed (by the target method, i.e.) FlowInfo infoResourceIsClosed = owned ? flowInfo : flowInfo.copy(); int flag = owned ? OWNED_BY_OUTSIDE : SHARED_WITH_OUTSIDE; do { trackVar.globalClosingState |= flag; if (scope.methodScope() != trackVar.methodScope) trackVar.globalClosingState |= CLOSED_IN_NESTED_METHOD; infoResourceIsClosed.markAsDefinitelyNonNull(trackVar.binding); } while ((trackVar = trackVar.innerTracker) != null); if (owned) { return infoResourceIsClosed; // don't let downstream signal any problems on this flow } else { return FlowInfo.conditional(flowInfo, infoResourceIsClosed); // only report potential problems on this flow } } return flowInfo; }
/** * Mark that this resource is passed to some outside code * (as argument to a method/ctor call or as a return value from the current method), * and thus should be considered as potentially closed. * @param owned should the resource be considered owned by some outside? */ public static FlowInfo markPassedToOutside(BlockScope scope, Expression expression, FlowInfo flowInfo, FlowContext flowContext, boolean owned) { FakedTrackingVariable trackVar = getCloseTrackingVariable(expression, flowInfo, flowContext); if (trackVar != null) { // insert info that the tracked resource *may* be closed (by the target method, i.e.) FlowInfo infoResourceIsClosed = owned ? flowInfo : flowInfo.copy(); int flag = owned ? OWNED_BY_OUTSIDE : SHARED_WITH_OUTSIDE; do { trackVar.globalClosingState |= flag; if (scope.methodScope() != trackVar.methodScope) trackVar.globalClosingState |= CLOSED_IN_NESTED_METHOD; infoResourceIsClosed.markAsDefinitelyNonNull(trackVar.binding); } while ((trackVar = trackVar.innerTracker) != null); if (owned) { return infoResourceIsClosed; // don't let downstream signal any problems on this flow } else { return FlowInfo.conditional(flowInfo, infoResourceIsClosed); // only report potential problems on this flow } } return flowInfo; }
/** * Mark that this resource is passed to some outside code * (as argument to a method/ctor call or as a return value from the current method), * and thus should be considered as potentially closed. * @param owned should the resource be considered owned by some outside? */ public static FlowInfo markPassedToOutside(BlockScope scope, Expression expression, FlowInfo flowInfo, FlowContext flowContext, boolean owned) { FakedTrackingVariable trackVar = getCloseTrackingVariable(expression, flowInfo, flowContext); if (trackVar != null) { // insert info that the tracked resource *may* be closed (by the target method, i.e.) FlowInfo infoResourceIsClosed = owned ? flowInfo : flowInfo.copy(); int flag = owned ? OWNED_BY_OUTSIDE : SHARED_WITH_OUTSIDE; do { trackVar.globalClosingState |= flag; if (scope.methodScope() != trackVar.methodScope) trackVar.globalClosingState |= CLOSED_IN_NESTED_METHOD; infoResourceIsClosed.markAsDefinitelyNonNull(trackVar.binding); } while ((trackVar = trackVar.innerTracker) != null); if (owned) { return infoResourceIsClosed; // don't let downstream signal any problems on this flow } else { return FlowInfo.conditional(flowInfo, infoResourceIsClosed); // only report potential problems on this flow } } return flowInfo; }
/** * Mark that this resource is passed to some outside code * (as argument to a method/ctor call or as a return value from the current method), * and thus should be considered as potentially closed. * @param owned should the resource be considered owned by some outside? */ public static FlowInfo markPassedToOutside(BlockScope scope, Expression expression, FlowInfo flowInfo, FlowContext flowContext, boolean owned) { FakedTrackingVariable trackVar = getCloseTrackingVariable(expression, flowInfo, flowContext); if (trackVar != null) { // insert info that the tracked resource *may* be closed (by the target method, i.e.) FlowInfo infoResourceIsClosed = owned ? flowInfo : flowInfo.copy(); int flag = owned ? OWNED_BY_OUTSIDE : SHARED_WITH_OUTSIDE; do { trackVar.globalClosingState |= flag; if (scope.methodScope() != trackVar.methodScope) trackVar.globalClosingState |= CLOSED_IN_NESTED_METHOD; infoResourceIsClosed.markAsDefinitelyNonNull(trackVar.binding); } while ((trackVar = trackVar.innerTracker) != null); if (owned) { return infoResourceIsClosed; // don't let downstream signal any problems on this flow } else { return FlowInfo.conditional(flowInfo, infoResourceIsClosed); // only report potential problems on this flow } } return flowInfo; }
/** * Mark that this resource is passed to some outside code * (as argument to a method/ctor call or as a return value from the current method), * and thus should be considered as potentially closed. * @param owned should the resource be considered owned by some outside? */ public static FlowInfo markPassedToOutside(BlockScope scope, Expression expression, FlowInfo flowInfo, FlowContext flowContext, boolean owned) { FakedTrackingVariable trackVar = getCloseTrackingVariable(expression, flowInfo, flowContext); if (trackVar != null) { // insert info that the tracked resource *may* be closed (by the target method, i.e.) FlowInfo infoResourceIsClosed = owned ? flowInfo : flowInfo.copy(); int flag = owned ? OWNED_BY_OUTSIDE : SHARED_WITH_OUTSIDE; do { trackVar.globalClosingState |= flag; if (scope.methodScope() != trackVar.methodScope) trackVar.globalClosingState |= CLOSED_IN_NESTED_METHOD; infoResourceIsClosed.markAsDefinitelyNonNull(trackVar.binding); } while ((trackVar = trackVar.innerTracker) != null); if (owned) { return infoResourceIsClosed; // don't let downstream signal any problems on this flow } else { return FlowInfo.conditional(flowInfo, infoResourceIsClosed); // only report potential problems on this flow } } return flowInfo; }
/** * Mark that this resource is passed to some outside code * (as argument to a method/ctor call or as a return value from the current method), * and thus should be considered as potentially closed. * @param owned should the resource be considered owned by some outside? */ public static FlowInfo markPassedToOutside(BlockScope scope, Expression expression, FlowInfo flowInfo, FlowContext flowContext, boolean owned) { FakedTrackingVariable trackVar = getCloseTrackingVariable(expression, flowInfo, flowContext); if (trackVar != null) { // insert info that the tracked resource *may* be closed (by the target method, i.e.) FlowInfo infoResourceIsClosed = owned ? flowInfo : flowInfo.copy(); int flag = owned ? OWNED_BY_OUTSIDE : SHARED_WITH_OUTSIDE; do { trackVar.globalClosingState |= flag; if (scope.methodScope() != trackVar.methodScope) trackVar.globalClosingState |= CLOSED_IN_NESTED_METHOD; infoResourceIsClosed.markAsDefinitelyNonNull(trackVar.binding); } while ((trackVar = trackVar.innerTracker) != null); if (owned) { return infoResourceIsClosed; // don't let downstream signal any problems on this flow } else { return FlowInfo.conditional(flowInfo, infoResourceIsClosed); // only report potential problems on this flow } } return flowInfo; }
/** * Mark that this resource is passed to some outside code * (as argument to a method/ctor call or as a return value from the current method), * and thus should be considered as potentially closed. * @param owned should the resource be considered owned by some outside? */ public static FlowInfo markPassedToOutside(BlockScope scope, Expression expression, FlowInfo flowInfo, boolean owned) { FakedTrackingVariable trackVar = getCloseTrackingVariable(expression); if (trackVar != null) { // insert info that the tracked resource *may* be closed (by the target method, i.e.) FlowInfo infoResourceIsClosed = owned ? flowInfo : flowInfo.copy(); int flag = owned ? OWNED_BY_OUTSIDE : SHARED_WITH_OUTSIDE; do { trackVar.globalClosingState |= flag; if (scope.methodScope() != trackVar.methodScope) trackVar.globalClosingState |= CLOSED_IN_NESTED_METHOD; infoResourceIsClosed.markAsDefinitelyNonNull(trackVar.binding); } while ((trackVar = trackVar.innerTracker) != null); if (owned) { return infoResourceIsClosed; // don't let downstream signal any problems on this flow } else { return FlowInfo.conditional(flowInfo, infoResourceIsClosed); // only report potential problems on this flow } } return flowInfo; }
/** * Mark that this resource is passed to some outside code * (as argument to a method/ctor call or as a return value from the current method), * and thus should be considered as potentially closed. * @param owned should the resource be considered owned by some outside? */ public static FlowInfo markPassedToOutside(BlockScope scope, Expression expression, FlowInfo flowInfo, FlowContext flowContext, boolean owned) { FakedTrackingVariable trackVar = getCloseTrackingVariable(expression, flowInfo, flowContext); if (trackVar != null) { // insert info that the tracked resource *may* be closed (by the target method, i.e.) FlowInfo infoResourceIsClosed = owned ? flowInfo : flowInfo.copy(); int flag = owned ? OWNED_BY_OUTSIDE : SHARED_WITH_OUTSIDE; do { trackVar.globalClosingState |= flag; if (scope.methodScope() != trackVar.methodScope) trackVar.globalClosingState |= CLOSED_IN_NESTED_METHOD; infoResourceIsClosed.markAsDefinitelyNonNull(trackVar.binding); } while ((trackVar = trackVar.innerTracker) != null); if (owned) { return infoResourceIsClosed; // don't let downstream signal any problems on this flow } else { return FlowInfo.conditional(flowInfo, infoResourceIsClosed); // only report potential problems on this flow } } return flowInfo; }
/** * Mark that this resource is passed to some outside code * (as argument to a method/ctor call or as a return value from the current method), * and thus should be considered as potentially closed. * @param owned should the resource be considered owned by some outside? */ public static FlowInfo markPassedToOutside(BlockScope scope, Expression expression, FlowInfo flowInfo, FlowContext flowContext, boolean owned) { FakedTrackingVariable trackVar = getCloseTrackingVariable(expression, flowInfo, flowContext); if (trackVar != null) { // insert info that the tracked resource *may* be closed (by the target method, i.e.) FlowInfo infoResourceIsClosed = owned ? flowInfo : flowInfo.copy(); int flag = owned ? OWNED_BY_OUTSIDE : SHARED_WITH_OUTSIDE; do { trackVar.globalClosingState |= flag; if (scope.methodScope() != trackVar.methodScope) trackVar.globalClosingState |= CLOSED_IN_NESTED_METHOD; infoResourceIsClosed.markAsDefinitelyNonNull(trackVar.binding); } while ((trackVar = trackVar.innerTracker) != null); if (owned) { return infoResourceIsClosed; // don't let downstream signal any problems on this flow } else { return FlowInfo.conditional(flowInfo, infoResourceIsClosed); // only report potential problems on this flow } } return flowInfo; }
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { LocalVariableBinding local = this.expression.localVariableBinding(); if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { flowContext.recordUsingNullReference(currentScope, local, this.expression, FlowContext.CAN_ONLY_NULL | FlowContext.IN_INSTANCEOF, flowInfo); flowInfo = this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); FlowInfo initsWhenTrue = flowInfo.copy(); initsWhenTrue.markAsComparedEqualToNonNull(local); // no impact upon enclosing try context return FlowInfo.conditional(initsWhenTrue, flowInfo.copy()); } return this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); }
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { LocalVariableBinding local = this.expression.localVariableBinding(); if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { flowInfo = this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); FlowInfo initsWhenTrue = flowInfo.copy(); initsWhenTrue.markAsComparedEqualToNonNull(local); flowContext.recordUsingNullReference(currentScope, local, this.expression, FlowContext.CAN_ONLY_NULL | FlowContext.IN_INSTANCEOF, flowInfo); // no impact upon enclosing try context return FlowInfo.conditional(initsWhenTrue, flowInfo.copy()); } return this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); }
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { LocalVariableBinding local = this.expression.localVariableBinding(); if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { flowInfo = this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); FlowInfo initsWhenTrue = flowInfo.copy(); initsWhenTrue.markAsComparedEqualToNonNull(local); if ((flowContext.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) != 0) { initsWhenTrue.markedAsNullOrNonNullInAssertExpression(local); } flowContext.recordUsingNullReference(currentScope, local, this.expression, FlowContext.CAN_ONLY_NULL | FlowContext.IN_INSTANCEOF, flowInfo); // no impact upon enclosing try context return FlowInfo.conditional(initsWhenTrue, flowInfo.copy()); } return this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); }
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { LocalVariableBinding local = this.expression.localVariableBinding(); if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { flowInfo = this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); FlowInfo initsWhenTrue = flowInfo.copy(); initsWhenTrue.markAsComparedEqualToNonNull(local); flowContext.recordUsingNullReference(currentScope, local, this.expression, FlowContext.CAN_ONLY_NULL | FlowContext.IN_INSTANCEOF, flowInfo); // no impact upon enclosing try context return FlowInfo.conditional(initsWhenTrue, flowInfo.copy()); } if (this.expression instanceof Reference && currentScope.compilerOptions().enableSyntacticNullAnalysisForFields) { FieldBinding field = ((Reference)this.expression).lastFieldBinding(); if (field != null && (field.type.tagBits & TagBits.IsBaseType) == 0) { flowContext.recordNullCheckedFieldReference((Reference) this.expression, 1); } } return this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); }
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { LocalVariableBinding local = this.expression.localVariableBinding(); if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { flowInfo = this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); FlowInfo initsWhenTrue = flowInfo.copy(); initsWhenTrue.markAsComparedEqualToNonNull(local); flowContext.recordUsingNullReference(currentScope, local, this.expression, FlowContext.CAN_ONLY_NULL | FlowContext.IN_INSTANCEOF, flowInfo); // no impact upon enclosing try context return FlowInfo.conditional(initsWhenTrue, flowInfo.copy()); } if (this.expression instanceof Reference && currentScope.compilerOptions().enableSyntacticNullAnalysisForFields) { FieldBinding field = ((Reference)this.expression).lastFieldBinding(); if (field != null && (field.type.tagBits & TagBits.IsBaseType) == 0) { flowContext.recordNullCheckedFieldReference((Reference) this.expression, 1); } } return this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); }
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { LocalVariableBinding local = this.expression.localVariableBinding(); if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { flowInfo = this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); FlowInfo initsWhenTrue = flowInfo.copy(); initsWhenTrue.markAsComparedEqualToNonNull(local); flowContext.recordUsingNullReference(currentScope, local, this.expression, FlowContext.CAN_ONLY_NULL | FlowContext.IN_INSTANCEOF, flowInfo); // no impact upon enclosing try context return FlowInfo.conditional(initsWhenTrue, flowInfo.copy()); } if (this.expression instanceof Reference && currentScope.compilerOptions().enableSyntacticNullAnalysisForFields) { FieldBinding field = ((Reference)this.expression).lastFieldBinding(); if (field != null && (field.type.tagBits & TagBits.IsBaseType) == 0) { flowContext.recordNullCheckedFieldReference((Reference) this.expression, 1); } } return this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); }
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { LocalVariableBinding local = this.expression.localVariableBinding(); if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { flowInfo = this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); FlowInfo initsWhenTrue = flowInfo.copy(); initsWhenTrue.markAsComparedEqualToNonNull(local); flowContext.recordUsingNullReference(currentScope, local, this.expression, FlowContext.CAN_ONLY_NULL | FlowContext.IN_INSTANCEOF, flowInfo); // no impact upon enclosing try context return FlowInfo.conditional(initsWhenTrue, flowInfo.copy()); } if (this.expression instanceof Reference && currentScope.compilerOptions().enableSyntacticNullAnalysisForFields) { FieldBinding field = ((Reference)this.expression).lastFieldBinding(); if (field != null && (field.type.tagBits & TagBits.IsBaseType) == 0) { flowContext.recordNullCheckedFieldReference((Reference) this.expression, 1); } } return this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); }
@Override public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { LocalVariableBinding local = this.expression.localVariableBinding(); if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { flowInfo = this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); FlowInfo initsWhenTrue = flowInfo.copy(); initsWhenTrue.markAsComparedEqualToNonNull(local); flowContext.recordUsingNullReference(currentScope, local, this.expression, FlowContext.CAN_ONLY_NULL | FlowContext.IN_INSTANCEOF, flowInfo); // no impact upon enclosing try context return FlowInfo.conditional(initsWhenTrue, flowInfo.copy()); } if (this.expression instanceof Reference && currentScope.compilerOptions().enableSyntacticNullAnalysisForFields) { FieldBinding field = ((Reference)this.expression).lastFieldBinding(); if (field != null && (field.type.tagBits & TagBits.IsBaseType) == 0) { flowContext.recordNullCheckedFieldReference((Reference) this.expression, 1); } } return this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); }
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { LocalVariableBinding local = this.expression.localVariableBinding(); if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { flowInfo = this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); FlowInfo initsWhenTrue = flowInfo.copy(); initsWhenTrue.markAsComparedEqualToNonNull(local); flowContext.recordUsingNullReference(currentScope, local, this.expression, FlowContext.CAN_ONLY_NULL | FlowContext.IN_INSTANCEOF, flowInfo); // no impact upon enclosing try context return FlowInfo.conditional(initsWhenTrue, flowInfo.copy()); } if (this.expression instanceof Reference && currentScope.compilerOptions().enableSyntacticNullAnalysisForFields) { FieldBinding field = ((Reference)this.expression).lastFieldBinding(); if (field != null && (field.type.tagBits & TagBits.IsBaseType) == 0) { flowContext.recordNullCheckedFieldReference((Reference) this.expression, 1); } } return this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); }
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { LocalVariableBinding local = this.expression.localVariableBinding(); if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { flowInfo = this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); FlowInfo initsWhenTrue = flowInfo.copy(); initsWhenTrue.markAsComparedEqualToNonNull(local); flowContext.recordUsingNullReference(currentScope, local, this.expression, FlowContext.CAN_ONLY_NULL | FlowContext.IN_INSTANCEOF, flowInfo); // no impact upon enclosing try context return FlowInfo.conditional(initsWhenTrue, flowInfo.copy()); } if (this.expression instanceof Reference && currentScope.compilerOptions().enableSyntacticNullAnalysisForFields) { FieldBinding field = ((Reference)this.expression).lastFieldBinding(); if (field != null && (field.type.tagBits & TagBits.IsBaseType) == 0) { flowContext.recordNullCheckedFieldReference((Reference) this.expression, 1); } } return this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); }
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) { LocalVariableBinding local = this.expression.localVariableBinding(); if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { flowInfo = this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); FlowInfo initsWhenTrue = flowInfo.copy(); initsWhenTrue.markAsComparedEqualToNonNull(local); flowContext.recordUsingNullReference(currentScope, local, this.expression, FlowContext.CAN_ONLY_NULL | FlowContext.IN_INSTANCEOF, flowInfo); // no impact upon enclosing try context return FlowInfo.conditional(initsWhenTrue, flowInfo.copy()); } if (this.expression instanceof Reference && currentScope.compilerOptions().enableSyntacticNullAnalysisForFields) { FieldBinding field = ((Reference)this.expression).lastFieldBinding(); if (field != null && (field.type.tagBits & TagBits.IsBaseType) == 0) { flowContext.recordNullCheckedFieldReference((Reference) this.expression, 1); } } return this.expression.analyseCode(currentScope, flowContext, flowInfo). unconditionalInits(); }