Package edu.umd.cs.findbugs.ba.npe
Class NullDerefAndRedundantComparisonFinder
java.lang.Object
edu.umd.cs.findbugs.ba.npe.NullDerefAndRedundantComparisonFinder
A user-friendly front end for finding null pointer dereferences and redundant
null comparisions.
- Author:
- David Hovemeyer
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionNullDerefAndRedundantComparisonFinder(ClassContext classContext, org.apache.bcel.classfile.Method method, NullDerefAndRedundantComparisonCollector collector) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckEdges(CFG cfg, Map<ValueNumber, NullValueUnconditionalDeref> nullValueGuaranteedDerefMap, Map<ValueNumber, SortedSet<Location>> bugEdgeLocationMap) voidexecute()static BugAnnotationfindAnnotationFromValueNumber(org.apache.bcel.classfile.Method method, Location location, ValueNumber valueNumber, ValueNumberFrame vnaFrame) Deprecated.static FieldAnnotationfindFieldAnnotationFromValueNumber(org.apache.bcel.classfile.Method method, Location location, ValueNumber valueNumber, ValueNumberFrame vnaFrame) static LocalVariableAnnotationfindLocalAnnotationFromValueNumber(org.apache.bcel.classfile.Method method, Location location, ValueNumber valueNumber, ValueNumberFrame vnaFrame) findNullAssignments(Set<LocationWhereValueBecomesNull> locationWhereValueBecomesNullSet) static XFieldfindXFieldFromValueNumber(org.apache.bcel.classfile.Method method, Location location, ValueNumber valueNumber, ValueNumberFrame vnaFrame) Deprecated.voidreportBugs(Map<ValueNumber, NullValueUnconditionalDeref> nullValueGuaranteedDerefMap, HashSet<ValueNumber> npeIfStatementCovered, Map<ValueNumber, SortedSet<Location>> bugLocationMap, Map<ValueNumber, Set<Location>> nullValueAssignmentMap)
-
Constructor Details
-
NullDerefAndRedundantComparisonFinder
public NullDerefAndRedundantComparisonFinder(ClassContext classContext, org.apache.bcel.classfile.Method method, NullDerefAndRedundantComparisonCollector collector) Constructor.- Parameters:
classContext- the ClassContextmethod- the method to analyzecollector- the NullDerefAndRedundantComparisonCollector used to report null derefs and redundant null comparisons
-
-
Method Details
-
execute
public void execute() -
findNullAssignments
public Map<ValueNumber,Set<Location>> findNullAssignments(Set<LocationWhereValueBecomesNull> locationWhereValueBecomesNullSet) -
reportBugs
public void reportBugs(Map<ValueNumber, NullValueUnconditionalDeref> nullValueGuaranteedDerefMap, HashSet<ValueNumber> npeIfStatementCovered, Map<ValueNumber, throws CFGBuilderException, DataflowAnalysisExceptionSortedSet<Location>> bugLocationMap, Map<ValueNumber, Set<Location>> nullValueAssignmentMap) -
checkEdges
public void checkEdges(CFG cfg, Map<ValueNumber, NullValueUnconditionalDeref> nullValueGuaranteedDerefMap, Map<ValueNumber, throws DataflowAnalysisExceptionSortedSet<Location>> bugEdgeLocationMap) - Throws:
DataflowAnalysisException
-
findXFieldFromValueNumber
@Deprecated public static XField findXFieldFromValueNumber(org.apache.bcel.classfile.Method method, Location location, ValueNumber valueNumber, ValueNumberFrame vnaFrame) Deprecated. -
findFieldAnnotationFromValueNumber
@Deprecated public static FieldAnnotation findFieldAnnotationFromValueNumber(org.apache.bcel.classfile.Method method, Location location, ValueNumber valueNumber, ValueNumberFrame vnaFrame) -
findLocalAnnotationFromValueNumber
@Deprecated public static LocalVariableAnnotation findLocalAnnotationFromValueNumber(org.apache.bcel.classfile.Method method, Location location, ValueNumber valueNumber, ValueNumberFrame vnaFrame) -
findAnnotationFromValueNumber
@Deprecated public static BugAnnotation findAnnotationFromValueNumber(org.apache.bcel.classfile.Method method, Location location, ValueNumber valueNumber, ValueNumberFrame vnaFrame)
-
ValueNumberSourceInfo.findRequiredAnnotationFromValueNumber(Method,Location,ValueNumber,ValueNumberFrame, String)instead