Package edu.umd.cs.findbugs.ba.npe
Class ParameterNullnessProperty
- java.lang.Object
-
- edu.umd.cs.findbugs.ba.npe.ParameterNullnessProperty
-
public class ParameterNullnessProperty extends java.lang.ObjectMethod property recording which parameters are (or should be) non-null, meaning that null values should not be passed as their arguments.- Author:
- David Hovemeyer
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_PARAMSMaximum number of parameters that can be represented by a ParameterNullnessProperty.
-
Constructor Summary
Constructors Constructor Description ParameterNullnessProperty()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcopyFrom(ParameterNullnessProperty other)Make this object the same as the given one.java.util.BitSetgetAsBitSet()java.util.BitSetgetViolatedParamSet(java.util.BitSet nullArgSet)Given a bitset of null arguments passed to the method represented by this property, return a bitset indicating which null arguments correspond to an non-null param.voidintersectWith(ParameterNullnessProperty targetDerefParamSet)Intersect this set with the given set.booleanisEmpty()Return whether or not the set of non-null parameters is empty.booleanisNonNull(int param)Return whether or not a parameter might be non-null.java.lang.Iterable<java.lang.Integer>iterable()voidsetNonNull(int param, boolean nonNull)Set whether or not a parameter might be non-null.voidsetNonNullParamSet(java.util.BitSet nonNullSet)Set the non-null param set from given BitSet.java.lang.StringtoString()
-
-
-
Field Detail
-
MAX_PARAMS
public static final int MAX_PARAMS
Maximum number of parameters that can be represented by a ParameterNullnessProperty.- See Also:
- Constant Field Values
-
-
Method Detail
-
iterable
public java.lang.Iterable<java.lang.Integer> iterable()
-
setNonNullParamSet
public void setNonNullParamSet(java.util.BitSet nonNullSet)
Set the non-null param set from given BitSet.- Parameters:
nonNullSet- BitSet indicating which parameters are non-null
-
setNonNull
public void setNonNull(int param, boolean nonNull)Set whether or not a parameter might be non-null.- Parameters:
param- the parameter indexnonNull- true if the parameter might be non-null, false otherwise
-
isNonNull
public boolean isNonNull(int param)
Return whether or not a parameter might be non-null.- Parameters:
param- the parameter index- Returns:
- true if the parameter might be non-null, false otherwise
-
getViolatedParamSet
public java.util.BitSet getViolatedParamSet(java.util.BitSet nullArgSet)
Given a bitset of null arguments passed to the method represented by this property, return a bitset indicating which null arguments correspond to an non-null param.- Parameters:
nullArgSet- bitset of null arguments- Returns:
- bitset intersecting null arguments and non-null params
-
getAsBitSet
public java.util.BitSet getAsBitSet()
-
isEmpty
public boolean isEmpty()
Return whether or not the set of non-null parameters is empty.- Returns:
- true if the set is empty, false if it contains at least one parameter
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
intersectWith
public void intersectWith(ParameterNullnessProperty targetDerefParamSet)
Intersect this set with the given set. Useful for summarizing the properties of multiple methods.- Parameters:
targetDerefParamSet- another set
-
copyFrom
public void copyFrom(ParameterNullnessProperty other)
Make this object the same as the given one.- Parameters:
other- another ParameterNullnessProperty
-
-