Class BuildObligationPolicyDatabase
java.lang.Object
edu.umd.cs.findbugs.detect.BuildObligationPolicyDatabase
- All Implemented Interfaces:
Detector2, FirstPassDetector, NonReportingDetector, Priorities
public class BuildObligationPolicyDatabase
extends Object
implements Detector2, NonReportingDetector
Build the ObligationPolicyDatabase used by ObligationAnalysis. We preload the
database with some known resources types needing to be released, and augment
the database with additional entries discovered through scanning referenced
classes for annotations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ClassDescriptorprivate final ClassDescriptorprivate final ObligationPolicyDatabaseprivate static final booleanprivate final ClassDescriptorprivate static final booleanstatic final booleanprivate final BugReporterprivate booleanDid we see any WillClose, WillNotClose, or WillCloseWhenClosed annotations in application code?private final ClassDescriptorprivate final ClassDescriptorprivate final ClassDescriptorFields inherited from interface Priorities
EXP_PRIORITY, HIGH_PRIORITY, IGNORE_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidaddFileStreamEntries(String kind) General method for adding entries for File InputStream/OutputStream/Reader/Writer classes.voidaddObligations(XMethod xmethod) private voidaddParameterDeletesObligationDatabaseEntry(XMethod xmethod, Obligation obligation, ObligationPolicyDatabaseEntryType entryType) Add an appropriate policy database entry for parameters marked with the WillClose annotation.voidThis method is called at the end of the analysis pass.private voidhandleWillCloseWhenClosed(XMethod xmethod, Obligation deletedObligation) Handle a method with a WillCloseWhenClosed parameter annotation.voidloadDatabase(URL u) private voidvoidvisitClass(ClassDescriptor classDescriptor) Visit a class.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Detector2
getDetectorClassName
-
Field Details
-
INFER_CLOSE_METHODS
public static final boolean INFER_CLOSE_METHODS -
DEBUG_ANNOTATIONS
private static final boolean DEBUG_ANNOTATIONS -
DUMP_DB
private static final boolean DUMP_DB -
reporter
-
database
-
willClose
-
willNotClose
-
willCloseWhenClosed
-
cleanupObligation
-
createsObligation
-
dischargesObligation
-
sawAnnotationsInApplicationCode
private boolean sawAnnotationsInApplicationCodeDid we see any WillClose, WillNotClose, or WillCloseWhenClosed annotations in application code?
-
-
Constructor Details
-
BuildObligationPolicyDatabase
-
-
Method Details
-
loadDatabase
-
visitClass
Description copied from interface:Detector2Visit a class.- Specified by:
visitClassin interfaceDetector2- Parameters:
classDescriptor- descriptor naming the class to visit- Throws:
CheckedAnalysisException- if an exception occurs during analysis
-
addObligations
- Parameters:
xmethod-
-
finishPass
public void finishPass()Description copied from interface:Detector2This method is called at the end of the analysis pass.- Specified by:
finishPassin interfaceDetector2
-
addBuiltInPolicies
private void addBuiltInPolicies() -
addFileStreamEntries
General method for adding entries for File InputStream/OutputStream/Reader/Writer classes. -
addParameterDeletesObligationDatabaseEntry
private void addParameterDeletesObligationDatabaseEntry(XMethod xmethod, Obligation obligation, ObligationPolicyDatabaseEntryType entryType) Add an appropriate policy database entry for parameters marked with the WillClose annotation.- Parameters:
xmethod- a methodobligation- the Obligation deleted by the methodentryType- type of entry (STRONG or WEAK)
-
handleWillCloseWhenClosed
Handle a method with a WillCloseWhenClosed parameter annotation. -
scanForResourceTypes
private void scanForResourceTypes()
-