Class FindUnsatisfiedObligation
java.lang.Object
edu.umd.cs.findbugs.bcel.CFGDetector
edu.umd.cs.findbugs.detect.FindUnsatisfiedObligation
- All Implemented Interfaces:
Detector2, Priorities
Find unsatisfied obligations in Java methods. Examples: open streams, open
database connections, etc.
See Weimer and Necula, Finding and preventing run-time error handling mistakes, OOPSLA 2004.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classA helper class to check a single method for unsatisfied obligations.private static classHelper class to keep track of possible obligation transfers observed along paths where an obligation appears to be leaked. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BugReporterprivate static final booleanCompute possible obligation transfers as a way of suppressing false positives due to "wrapper" objects.private final ObligationPolicyDatabaseprivate static final booleanprivate static final booleanprivate static final Stringprivate static final booleanReport the final obligation set as part of the BugInstance.private static final booleanReport path information from point of resource creation to CFG exit.private static final booleanFields inherited from class CFGDetector
classContext, methodFields inherited from interface Priorities
EXP_PRIORITY, HIGH_PRIORITY, IGNORE_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidreport()voidvisitClass(ClassDescriptor classDescriptor) Visit a class.protected voidvisitMethodCFG(MethodDescriptor methodDescriptor, CFG cfg) Visit the CFG (control flow graph) of a method to be analyzed.Methods inherited from class CFGDetector
finishPassMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Detector2
getDetectorClassName
-
Field Details
-
DEBUG
private static final boolean DEBUG -
DEBUG_METHOD
-
DEBUG_FP
private static final boolean DEBUG_FP -
COMPUTE_TRANSFERS
private static final boolean COMPUTE_TRANSFERSCompute possible obligation transfers as a way of suppressing false positives due to "wrapper" objects. Not quite ready for prime time. -
REPORT_PATH
private static final boolean REPORT_PATHReport path information from point of resource creation to CFG exit. This makes the reported warning a lot easier to understand. -
REPORT_PATH_DEBUG
private static final boolean REPORT_PATH_DEBUG -
REPORT_OBLIGATION_SET
private static final boolean REPORT_OBLIGATION_SETReport the final obligation set as part of the BugInstance. -
bugReporter
-
database
-
-
Constructor Details
-
FindUnsatisfiedObligation
-
-
Method Details
-
visitClass
Description copied from interface:Detector2Visit a class.- Specified by:
visitClassin interfaceDetector2- Overrides:
visitClassin classCFGDetector- Parameters:
classDescriptor- descriptor naming the class to visit- Throws:
CheckedAnalysisException- if an exception occurs during analysis
-
visitMethodCFG
protected void visitMethodCFG(MethodDescriptor methodDescriptor, CFG cfg) throws CheckedAnalysisException Description copied from class:CFGDetectorVisit the CFG (control flow graph) of a method to be analyzed. Should be overridden by subclasses.- Specified by:
visitMethodCFGin classCFGDetector- Parameters:
methodDescriptor-cfg-- Throws:
CheckedAnalysisException
-
report
public void report()
-