edu.umd.cs.findbugs.ba.npe

Class ParameterNullnessProperty

public class ParameterNullnessProperty extends Object

Method 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
static intMAX_PARAMS
Maximum number of parameters that can be represented by a ParameterNullnessProperty.
Constructor Summary
ParameterNullnessProperty()
Constructor.
Method Summary
voidcopyFrom(ParameterNullnessProperty other)
Make this object the same as the given one.
BitSetgetAsBitSet()
BitSetgetViolatedParamSet(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.
voidsetNonNull(int param, boolean nonNull)
Set whether or not a parameter might be non-null.
voidsetNonNullParamSet(BitSet nonNullSet)
Set the non-null param set from given BitSet.

Field Detail

MAX_PARAMS

public static final int MAX_PARAMS
Maximum number of parameters that can be represented by a ParameterNullnessProperty.

Constructor Detail

ParameterNullnessProperty

public ParameterNullnessProperty()
Constructor. Parameters are all assumed not to be non-null.

Method Detail

copyFrom

public void copyFrom(ParameterNullnessProperty other)
Make this object the same as the given one.

Parameters: other another ParameterNullnessProperty

getAsBitSet

public BitSet getAsBitSet()

getViolatedParamSet

public BitSet getViolatedParamSet(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

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

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

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

setNonNull

public void setNonNull(int param, boolean nonNull)
Set whether or not a parameter might be non-null.

Parameters: param the parameter index nonNull true if the parameter might be non-null, false otherwise

setNonNullParamSet

public void setNonNullParamSet(BitSet nonNullSet)
Set the non-null param set from given BitSet.

Parameters: nonNullSet BitSet indicating which parameters are non-null

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.