Class IsNullValue
java.lang.Object
edu.umd.cs.findbugs.ba.npe.IsNullValue
- All Implemented Interfaces:
Debug, IsNullValueAnalysisFeatures
A class to abstractly represent values in stack slots, indicating whether
those values can be null, non-null, null on some incoming path, or unknown.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intValue is (potentially) null because it was returned from aCheckForNullmethod .private static final intDefinitely not null because of a comparison to a known null value.private static final intDefinitely null because of a comparison to a known null value.private static final booleanprivate static final booleanprivate static final intValue was propagated along an exception path.private static final intprivate static final intprivate static final intprivate static final IsNullValue[][]private final intprivate final Locationprivate static final int[][]private static final intNull on some complex path (at least two branches) to current location.private static final intNull on some complex path (at least three branches) to current location.private static final intDefinitely not null.private static final intUnknown value (method param, value read from heap, etc.), assumed not null.private static final intDefinitely not null an NPE would have occurred and we would not be here if it were null.private static final intNull on some simple path (at most one branch) to current location.private static final intDefinitely null.private static final intValue is (potentially) null because of a parameter passed to the method.private static final intValue is (potentially) null because of a value returned from readline.private static final intValue is (potentially) null because of a value returned from a called method.Fields inherited from interface Debug
VERIFY_INTEGRITYFields inherited from interface IsNullValueAnalysisFeatures
NCP_EXTRA_BRANCH, NO_SPLIT_DOWNGRADE_NSP, NO_SWITCH_DEFAULT_AS_EXCEPTION, UNKNOWN_VALUES_ARE_NSP, USE_TYPE_QUALIFIERS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateIsNullValue(int kind) privateIsNullValue(int kind, Location ins) -
Method Summary
Modifier and TypeMethodDescriptionstatic IsNullValueGet the instance representing a value known to be non-null because it was compared against null value, or because we saw the object creation.static IsNullValueGet the instance representing a value known to be null because it was compared against null value, or because we saw that it was assigned the null constant.private voidprivate static IsNullValue[][]Control split: move given value down in the lattice if it is a conditionally-null value.booleanprivate intprivate intgetFlags()private booleanhasFlag(int flag) inthashCode()booleanIs this value known because of an explicit null check?booleanbooleanIs this value definitely not null?booleanIs this value definitely null?booleanWas this value propagated on an exception path?booleanbooleanIs this value null on a complicated path?booleanIs this value null on a complicated path?booleanIs this value null on a complicated path?booleanIs this value null on some path?booleanWas this value marked as a possibly null parameter?booleanbooleanWas this value marked as a possibly null return value?Convert to a value known because it was returned from a method in a method property database.markInformationAsComingFromReturnValueOfMethod(XMethod methodInvoked, NullnessAnnotation methodNullnessAnnotation) Convert to a value known because it was returned from a method in a method property database.static IsNullValuemerge(IsNullValue a, IsNullValue b) Merge two values.booleanReturn true if this value is either definitely null, or might be null on a simple path.static IsNullValueGet the instance representing a value known to be non-null because a NPE would have occurred if it were null.static IsNullValueGet the instance representing values that are definitely not null.static IsNullValueGet non-reporting non-null value.static IsNullValueGet null on complex path value.static IsNullValueLike "null on complex path" except that there are at least three branches between the explicit null value and the current location.static IsNullValueGet the instance representing values that are definitely null on some simple (no branches) incoming path.static IsNullValueGet the instance representing values that are definitely null.static IsNullValueGet instance representing a parameter marked as MightBeNullstatic IsNullValueGet instance representing a parameter marked as Nonnullstatic IsNullValueGet non-null value resulting from comparison to explicit null.static IsNullValueGet null value resulting from comparison to explicit null.Convert to an exception path value.toString()booleanIs this value known to be non null because a NPE would have occurred otherwise?
-
Field Details
-
DEBUG_EXCEPTION
private static final boolean DEBUG_EXCEPTION -
DEBUG_KABOOM
private static final boolean DEBUG_KABOOM -
NULL
private static final int NULLDefinitely null.- See Also:
-
CHECKED_NULL
private static final int CHECKED_NULLDefinitely null because of a comparison to a known null value.- See Also:
-
NN
private static final int NNDefinitely not null.- See Also:
-
CHECKED_NN
private static final int CHECKED_NNDefinitely not null because of a comparison to a known null value.- See Also:
-
NO_KABOOM_NN
private static final int NO_KABOOM_NNDefinitely not null an NPE would have occurred and we would not be here if it were null.- See Also:
-
NSP
private static final int NSPNull on some simple path (at most one branch) to current location.- See Also:
-
NN_UNKNOWN
private static final int NN_UNKNOWNUnknown value (method param, value read from heap, etc.), assumed not null.- See Also:
-
NCP2
private static final int NCP2Null on some complex path (at least two branches) to current location.- See Also:
-
NCP3
private static final int NCP3Null on some complex path (at least three branches) to current location.- See Also:
-
FLAG_SHIFT
private static final int FLAG_SHIFT- See Also:
-
EXCEPTION
private static final int EXCEPTIONValue was propagated along an exception path.- See Also:
-
PARAM
private static final int PARAMValue is (potentially) null because of a parameter passed to the method.- See Also:
-
RETURN_VAL
private static final int RETURN_VALValue is (potentially) null because of a value returned from a called method.- See Also:
-
FIELD_VAL
private static final int FIELD_VAL- See Also:
-
READLINE_VAL
private static final int READLINE_VALValue is (potentially) null because of a value returned from readline.- See Also:
-
CHECK_FOR_NULL_VAL
private static final int CHECK_FOR_NULL_VALValue is (potentially) null because it was returned from aCheckForNullmethod .- See Also:
-
FLAG_MASK
private static final int FLAG_MASK- See Also:
-
mergeMatrix
private static final int[][] mergeMatrix -
instanceByFlagsList
-
kind
private final int kind -
locationOfKaBoom
-
-
Constructor Details
-
IsNullValue
private IsNullValue(int kind) -
IsNullValue
-
-
Method Details
-
createInstanceByFlagList
-
checkNoKaboomNNLocation
private void checkNoKaboomNNLocation() -
equals
-
hashCode
-
getBaseKind
private int getBaseKind() -
getFlags
private int getFlags() -
hasFlag
private boolean hasFlag(int flag) -
isException
public boolean isException()Was this value propagated on an exception path? -
isReturnValue
public boolean isReturnValue()Was this value marked as a possibly null return value? -
isReadlineValue
public boolean isReadlineValue() -
isCheckForNull
public boolean isCheckForNull()- Returns:
trueif that was returned from aCheckForNullmethod
-
isFieldValue
public boolean isFieldValue() -
isParamValue
public boolean isParamValue()Was this value marked as a possibly null parameter? -
isChecked
public boolean isChecked()Is this value known because of an explicit null check? -
wouldHaveBeenAKaboom
public boolean wouldHaveBeenAKaboom()Is this value known to be non null because a NPE would have occurred otherwise? -
toExceptionValue
Convert to an exception path value. -
markInformationAsComingFromReturnValueOfMethod
public IsNullValue markInformationAsComingFromReturnValueOfMethod(XMethod methodInvoked, NullnessAnnotation methodNullnessAnnotation) Convert to a value known because it was returned from a method in a method property database.- Parameters:
methodInvoked- The invoked methodmethodNullnessAnnotation- TheNullnessAnnotationof the invoked method
-
markInformationAsComingFromFieldValue
Convert to a value known because it was returned from a method in a method property database.- Parameters:
field- TODO
-
nullValue
Get the instance representing values that are definitely null. -
checkedNullValue
Get the instance representing a value known to be null because it was compared against null value, or because we saw that it was assigned the null constant. -
nonNullValue
Get the instance representing values that are definitely not null. -
checkedNonNullValue
Get the instance representing a value known to be non-null because it was compared against null value, or because we saw the object creation. -
noKaboomNonNullValue
Get the instance representing a value known to be non-null because a NPE would have occurred if it were null. -
nullOnSimplePathValue
Get the instance representing values that are definitely null on some simple (no branches) incoming path. -
parameterMarkedAsMightBeNull
Get instance representing a parameter marked as MightBeNull -
parameterMarkedAsNonnull
Get instance representing a parameter marked as Nonnull -
nonReportingNotNullValue
Get non-reporting non-null value. This is what we use for unknown values. -
nullOnComplexPathValue
Get null on complex path value. This is like null on simple path value, but there are at least two branches between the explicit null value and the current location. If the conditions are correlated, then the path on which the value is null may be infeasible. -
nullOnComplexPathValue3
Like "null on complex path" except that there are at least three branches between the explicit null value and the current location. -
pathSensitiveNullValue
Get null value resulting from comparison to explicit null. -
pathSensitiveNonNullValue
Get non-null value resulting from comparison to explicit null. -
merge
Merge two values. -
isDefinitelyNull
public boolean isDefinitelyNull()Is this value definitely null? -
isNullOnSomePath
public boolean isNullOnSomePath()Is this value null on some path? -
isNullOnComplicatedPath
public boolean isNullOnComplicatedPath()Is this value null on a complicated path? -
isNullOnComplicatedPath23
public boolean isNullOnComplicatedPath23()Is this value null on a complicated path? -
isNullOnComplicatedPath2
public boolean isNullOnComplicatedPath2()Is this value null on a complicated path? -
mightBeNull
public boolean mightBeNull()Return true if this value is either definitely null, or might be null on a simple path.- Returns:
- true if this value is either definitely null, or might be null on a simple path, false otherwise
-
isDefinitelyNotNull
public boolean isDefinitelyNotNull()Is this value definitely not null? -
toString
-
getLocationOfKaBoom
-
downgradeOnControlSplit
Control split: move given value down in the lattice if it is a conditionally-null value.- Returns:
- another value (equal or further down in the lattice)
-