public void checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo, boolean checkString) { // cannot override localVariableBinding because this would project o.m onto o when // analyzing assignments if ((this.bits & ASTNode.RestrictiveFlagMASK) == Binding.LOCAL) { LocalVariableBinding local = (LocalVariableBinding) this.binding; if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0 && (checkString || local.type.id != TypeIds.T_JavaLangString)) { if ((this.bits & ASTNode.IsNonNull) == 0) { flowContext.recordUsingNullReference(scope, local, this, FlowContext.MAY_NULL, flowInfo); } flowInfo.markAsComparedEqualToNonNull(local); // from thereon it is set if (flowContext.initsOnFinally != null) { flowContext.initsOnFinally.markAsComparedEqualToNonNull(local); } } } }
public void checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo, boolean checkString) { // cannot override localVariableBinding because this would project o.m onto o when // analysing assignments if ((this.bits & ASTNode.RestrictiveFlagMASK) == Binding.LOCAL) { LocalVariableBinding local = (LocalVariableBinding) this.binding; if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0 && (checkString || local.type.id != TypeIds.T_JavaLangString)) { if ((this.bits & ASTNode.IsNonNull) == 0) { flowContext.recordUsingNullReference(scope, local, this, FlowContext.MAY_NULL, flowInfo); } flowInfo.markAsComparedEqualToNonNull(local); // from thereon it is set if (flowContext.initsOnFinally != null) { flowContext.initsOnFinally.markAsComparedEqualToNonNull(local); } } } }
/** * Check the local variable of this expression, if any, against potential NPEs * given a flow context and an upstream flow info. If so, report the risk to * the context. Marks the local as checked, which affects the flow info. * @param scope the scope of the analysis * @param flowContext the current flow context * @param flowInfo the upstream flow info; caveat: may get modified */ public void checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo) { LocalVariableBinding local = localVariableBinding(); if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { if ((this.bits & ASTNode.IsNonNull) == 0) { flowContext.recordUsingNullReference(scope, local, this, FlowContext.MAY_NULL, flowInfo); } flowInfo.markAsComparedEqualToNonNull(local); // from thereon it is set if (flowContext.initsOnFinally != null) { flowContext.initsOnFinally.markAsComparedEqualToNonNull(local); } } }
/** * Check the local variable of this expression, if any, against potential NPEs * given a flow context and an upstream flow info. If so, report the risk to * the context. Marks the local as checked, which affects the flow info. * @param scope the scope of the analysis * @param flowContext the current flow context * @param flowInfo the upstream flow info; caveat: may get modified */ public void checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo) { LocalVariableBinding local = localVariableBinding(); if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { if ((this.bits & ASTNode.IsNonNull) == 0) { flowContext.recordUsingNullReference(scope, local, this, FlowContext.MAY_NULL, flowInfo); } flowInfo.markAsComparedEqualToNonNull(local); // from thereon it is set if (flowContext.initsOnFinally != null) { flowContext.initsOnFinally.markAsComparedEqualToNonNull(local); } } }
public void checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo, boolean checkString) { // cannot override localVariableBinding because this would project o.m onto o when // analyzing assignments if ((this.bits & ASTNode.RestrictiveFlagMASK) == Binding.LOCAL) { LocalVariableBinding local = (LocalVariableBinding) this.binding; if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0 && (checkString || local.type.id != TypeIds.T_JavaLangString)) { if ((this.bits & ASTNode.IsNonNull) == 0) { flowContext.recordUsingNullReference(scope, local, this, FlowContext.MAY_NULL, flowInfo); } flowInfo.markAsComparedEqualToNonNull(local); // from thereon it is set if ((flowContext.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) != 0) { flowInfo.markedAsNullOrNonNullInAssertExpression(local); } if (flowContext.initsOnFinally != null) { flowContext.initsOnFinally.markAsComparedEqualToNonNull(local); if ((flowContext.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) != 0) { flowContext.initsOnFinally.markedAsNullOrNonNullInAssertExpression(local); } } } } }
/** * Check the local variable of this expression, if any, against potential NPEs * given a flow context and an upstream flow info. If so, report the risk to * the context. Marks the local as checked, which affects the flow info. * @param scope the scope of the analysis * @param flowContext the current flow context * @param flowInfo the upstream flow info; caveat: may get modified */ public void checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo) { LocalVariableBinding local = localVariableBinding(); if (local != null && (local.type.tagBits & TagBits.IsBaseType) == 0) { if ((this.bits & ASTNode.IsNonNull) == 0) { flowContext.recordUsingNullReference(scope, local, this, FlowContext.MAY_NULL, flowInfo); } flowInfo.markAsComparedEqualToNonNull(local); // from thereon it is set if ((flowContext.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) != 0) { flowInfo.markedAsNullOrNonNullInAssertExpression(local); } if (flowContext.initsOnFinally != null) { flowContext.initsOnFinally.markAsComparedEqualToNonNull(local); if ((flowContext.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) != 0) { flowContext.initsOnFinally.markedAsNullOrNonNullInAssertExpression(local); } } } }