Package edu.umd.cs.findbugs.ba.npe
Class NullDerefAndRedundantComparisonFinder
- java.lang.Object
-
- edu.umd.cs.findbugs.ba.npe.NullDerefAndRedundantComparisonFinder
-
public class NullDerefAndRedundantComparisonFinder extends java.lang.Object
A user-friendly front end for finding null pointer dereferences and redundant null comparisons.- Author:
- David Hovemeyer
- See Also:
IsNullValueAnalysis
-
-
Constructor Summary
Constructors Constructor Description NullDerefAndRedundantComparisonFinder(ClassContext classContext, org.apache.bcel.classfile.Method method, NullDerefAndRedundantComparisonCollector collector)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
checkEdges(CFG cfg, java.util.Map<ValueNumber,NullValueUnconditionalDeref> nullValueGuaranteedDerefMap, java.util.Map<ValueNumber,java.util.SortedSet<Location>> bugEdgeLocationMap)
void
execute()
static BugAnnotation
findAnnotationFromValueNumber(org.apache.bcel.classfile.Method method, Location location, ValueNumber valueNumber, ValueNumberFrame vnaFrame)
static FieldAnnotation
findFieldAnnotationFromValueNumber(org.apache.bcel.classfile.Method method, Location location, ValueNumber valueNumber, ValueNumberFrame vnaFrame)
static LocalVariableAnnotation
findLocalAnnotationFromValueNumber(org.apache.bcel.classfile.Method method, Location location, ValueNumber valueNumber, ValueNumberFrame vnaFrame)
java.util.Map<ValueNumber,java.util.Set<Location>>
findNullAssignments(java.util.Set<LocationWhereValueBecomesNull> locationWhereValueBecomesNullSet)
static XField
findXFieldFromValueNumber(org.apache.bcel.classfile.Method method, Location location, ValueNumber valueNumber, ValueNumberFrame vnaFrame)
Deprecated.void
reportBugs(java.util.Map<ValueNumber,NullValueUnconditionalDeref> nullValueGuaranteedDerefMap, java.util.HashSet<ValueNumber> npeIfStatementCovered, java.util.Map<ValueNumber,java.util.SortedSet<Location>> bugLocationMap, java.util.Map<ValueNumber,java.util.Set<Location>> nullValueAssignmentMap)
-
-
-
Constructor Detail
-
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 Detail
-
execute
public void execute()
-
findNullAssignments
public java.util.Map<ValueNumber,java.util.Set<Location>> findNullAssignments(java.util.Set<LocationWhereValueBecomesNull> locationWhereValueBecomesNullSet)
-
reportBugs
public void reportBugs(java.util.Map<ValueNumber,NullValueUnconditionalDeref> nullValueGuaranteedDerefMap, java.util.HashSet<ValueNumber> npeIfStatementCovered, java.util.Map<ValueNumber,java.util.SortedSet<Location>> bugLocationMap, java.util.Map<ValueNumber,java.util.Set<Location>> nullValueAssignmentMap) throws CFGBuilderException, DataflowAnalysisException
-
checkEdges
public void checkEdges(CFG cfg, java.util.Map<ValueNumber,NullValueUnconditionalDeref> nullValueGuaranteedDerefMap, java.util.Map<ValueNumber,java.util.SortedSet<Location>> bugEdgeLocationMap) throws DataflowAnalysisException
- 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)
-
-