edu.umd.cs.findbugs.ba.npe

Interface NullDerefAndRedundantComparisonCollector

public interface NullDerefAndRedundantComparisonCollector

Callback interface for collecting null pointer derefs and redundant null comparisons.

Author: David Hovemeyer

See Also: NullDerefAndRedundantComparisonFinder

Method Summary
voidfoundGuaranteedNullDeref(Set<Location> assignedNullLocationSet, Set<Location> derefLocationSet, SortedSet<Location> doomedLocations, ValueNumberDataflow vna, ValueNumber refValue, BugAnnotation variableAnnotation, NullValueUnconditionalDeref deref, boolean npeIfStatementCovered)
Subclasses should override this method to capture values assigned null (or that become null through a comparison and branch) that are guaranteed to reach a dereference (ignoring implicit exception paths).
voidfoundNullDeref(ClassContext classContext, Location location, ValueNumber valueNumber, IsNullValue refValue, ValueNumberFrame vnaFrame)
Subclasses should override this method to capture locations where a null pointer is dereferenced.
voidfoundRedundantNullCheck(Location location, RedundantBranch redundantBranch)
Subclasses should override this method to capture locations where a redundant null comparision is performed.

Method Detail

foundGuaranteedNullDeref

public void foundGuaranteedNullDeref(Set<Location> assignedNullLocationSet, Set<Location> derefLocationSet, SortedSet<Location> doomedLocations, ValueNumberDataflow vna, ValueNumber refValue, BugAnnotation variableAnnotation, NullValueUnconditionalDeref deref, boolean npeIfStatementCovered)
Subclasses should override this method to capture values assigned null (or that become null through a comparison and branch) that are guaranteed to reach a dereference (ignoring implicit exception paths).

Parameters: assignedNullLocationSet set of locations where the value becomes null derefLocationSet set of locations where dereferences occur doomedLocations locations at which the value is doomed vna ValueNumberDataflow refValue the null value variableAnnotation TODO deref TODO npeIfStatementCovered true if doom location is a statement

foundNullDeref

public void foundNullDeref(ClassContext classContext, Location location, ValueNumber valueNumber, IsNullValue refValue, ValueNumberFrame vnaFrame)
Subclasses should override this method to capture locations where a null pointer is dereferenced.

Parameters: classContext TODO location the Location of the null dereference valueNumber the ValueNumber of the possibly-null value refValue the kind of possibly-null value dereferenced vnaFrame The ValueNumber Frame at the point where the dereference occurred

foundRedundantNullCheck

public void foundRedundantNullCheck(Location location, RedundantBranch redundantBranch)
Subclasses should override this method to capture locations where a redundant null comparision is performed.

Parameters: location the Location of the redundant null check redundantBranch the RedundantBranch

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