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 classFindUnsatisfiedObligation.MethodCheckerA helper class to check a single method for unsatisfied obligations.private static classFindUnsatisfiedObligation.PossibleObligationTransferHelper 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 BugReporterbugReporterprivate static booleanCOMPUTE_TRANSFERSCompute possible obligation transfers as a way of suppressing false positives due to "wrapper" objects.private ObligationPolicyDatabasedatabaseprivate static booleanDEBUGprivate static booleanDEBUG_FPprivate static java.lang.StringDEBUG_METHODprivate static booleanREPORT_OBLIGATION_SETReport the final obligation set as part of the BugInstance.private static booleanREPORT_PATHReport path information from point of resource creation to CFG exit.private static booleanREPORT_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 voidreport()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 edu.umd.cs.findbugs.bcel.CFGDetector
finishPass
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface edu.umd.cs.findbugs.Detector2
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: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- Throws:
CheckedAnalysisException
-
report
public void report()
-
-