Package edu.umd.cs.findbugs.detect
Class FindUnsatisfiedObligation
- java.lang.Object
-
- edu.umd.cs.findbugs.bcel.CFGDetector
-
- edu.umd.cs.findbugs.detect.FindUnsatisfiedObligation
-
- All Implemented Interfaces:
Detector2
,Priorities
public class FindUnsatisfiedObligation extends CFGDetector
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 Classes Modifier and Type Class Description private class
FindUnsatisfiedObligation.MethodChecker
A helper class to check a single method for unsatisfied obligations.private static class
FindUnsatisfiedObligation.PossibleObligationTransfer
Helper class to keep track of possible obligation transfers observed along paths where an obligation appears to be leaked.
-
Field Summary
Fields Modifier and Type Field Description private BugReporter
bugReporter
private static boolean
COMPUTE_TRANSFERS
Compute possible obligation transfers as a way of suppressing false positives due to "wrapper" objects.private ObligationPolicyDatabase
database
private static boolean
DEBUG
private static boolean
DEBUG_FP
private static java.lang.String
DEBUG_METHOD
private static boolean
REPORT_OBLIGATION_SET
Report the final obligation set as part of the BugInstance.private static boolean
REPORT_PATH
Report path information from point of resource creation to CFG exit.private static boolean
REPORT_PATH_DEBUG
-
Fields inherited from class edu.umd.cs.findbugs.bcel.CFGDetector
classContext, method
-
Fields inherited from interface edu.umd.cs.findbugs.Priorities
EXP_PRIORITY, HIGH_PRIORITY, IGNORE_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description FindUnsatisfiedObligation(BugReporter bugReporter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
report()
void
visitClass(ClassDescriptor classDescriptor)
Visit a class.protected void
visitMethodCFG(MethodDescriptor methodDescriptor, CFG cfg)
Visit the CFG (control flow graph) of a method to be analyzed.-
Methods inherited from class edu.umd.cs.findbugs.bcel.CFGDetector
finishPass, getDetectorClassName
-
-
-
-
Field Detail
-
DEBUG
private static final boolean DEBUG
-
DEBUG_METHOD
private static final java.lang.String DEBUG_METHOD
-
DEBUG_FP
private static final boolean DEBUG_FP
-
COMPUTE_TRANSFERS
private static final boolean COMPUTE_TRANSFERS
Compute 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_PATH
Report 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_SET
Report the final obligation set as part of the BugInstance.
-
bugReporter
private final BugReporter bugReporter
-
database
private final ObligationPolicyDatabase database
-
-
Constructor Detail
-
FindUnsatisfiedObligation
public FindUnsatisfiedObligation(BugReporter bugReporter)
-
-
Method Detail
-
visitClass
public void visitClass(ClassDescriptor classDescriptor) throws CheckedAnalysisException
Description copied from interface:Detector2
Visit a class.- Specified by:
visitClass
in interfaceDetector2
- Overrides:
visitClass
in 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:CFGDetector
Visit the CFG (control flow graph) of a method to be analyzed. Should be overridded by subclasses.- Specified by:
visitMethodCFG
in classCFGDetector
- Throws:
CheckedAnalysisException
-
report
public void report()
-
-