Package edu.umd.cs.findbugs.ba
Class AnalysisCacheToAnalysisContextAdapter
- java.lang.Object
-
- edu.umd.cs.findbugs.ba.AnalysisContext
-
- edu.umd.cs.findbugs.ba.AnalysisCacheToAnalysisContextAdapter
-
public class AnalysisCacheToAnalysisContextAdapter extends AnalysisContext
An AnalysisContext implementation that uses the IAnalysisCache. This class must only be used by FindBugs2, not the original FindBugs driver.- Author:
- David Hovemeyer
-
-
Field Summary
-
Fields inherited from class edu.umd.cs.findbugs.ba.AnalysisContext
DEBUG, DEFAULT_CHECK_FOR_NULL_PARAM_DATABASE_FILENAME, DEFAULT_NONNULL_PARAM_DATABASE_FILENAME, DEFAULT_NULL_RETURN_VALUE_ANNOTATION_DATABASE, DEFAULT_NULL_RETURN_VALUE_DB_FILENAME, IGNORE_BUILTIN_MODELS, NONNULL_RETURN_DB_FILENAME, NONNULL_RETURN_DB_RESOURCE, project, UNCONDITIONAL_DEREF_DB_FILENAME, UNCONDITIONAL_DEREF_DB_RESOURCE
-
-
Constructor Summary
Constructors Constructor Description AnalysisCacheToAnalysisContextAdapter()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addClasspathEntry(java.lang.String url)
Add an entry to the Repository's classpath.void
clearClassContextCache()
Clear the ClassContext cache.void
clearRepository()
Clear the BCEL Repository in preparation for analysis.AnnotationRetentionDatabase
getAnnotationRetentionDatabase()
CheckReturnAnnotationDatabase
getCheckReturnAnnotationDatabase()
ClassContext
getClassContext(org.apache.bcel.classfile.JavaClass javaClass)
Get the ClassContext for a class.java.lang.String
getClassContextStats()
Get stats about hit rate for ClassContext cache.DirectlyRelevantTypeQualifiersDatabase
getDirectlyRelevantTypeQualifiersDatabase()
FieldStoreTypeDatabase
getFieldStoreTypeDatabase()
Get the property database recording the types of values stored into fields.InnerClassAccessMap
getInnerClassAccessMap()
JCIPAnnotationDatabase
getJCIPAnnotationDatabase()
RepositoryLookupFailureCallback
getLookupFailureCallback()
Get the lookup failure callback.INullnessAnnotationDatabase
getNullnessAnnotationDatabase()
ReturnValueNullnessPropertyDatabase
getReturnValueNullnessPropertyDatabase()
Get the property database recording which methods always return nonnull valuesSourceFinder
getSourceFinder()
Get the SourceFinder, for finding source files.SourceInfoMap
getSourceInfoMap()
Get the SourceInfoMap.Subtypes2
getSubtypes2()
Get the Subtypes2 inheritance hierarchy database.ParameterNullnessPropertyDatabase
getUnconditionalDerefParamDatabase()
Get the property database recording which methods unconditionally dereference parameters.void
initDatabases()
Instantiate the CheckReturnAnnotationDatabase.org.apache.bcel.classfile.JavaClass
lookupClass(java.lang.String className)
Lookup a class.void
setAppClassList(java.util.List<ClassDescriptor> appClassCollection)
Set the collection of class descriptors identifying all application classes.void
updateDatabases(int pass)
After a pass has been completed, allow the analysis context to update information.-
Methods inherited from class edu.umd.cs.findbugs.ba.AnalysisContext
currentAnalysisContext, currentXFactory, getBoolProperty, getClassSummary, getDatabaseInputDir, getDatabaseOutputDir, getEqualsKindSummary, getFieldSummary, getUnreadFields, getXClassCollection, isApplicationClass, isApplicationClass, isApplicationClass, isTooBig, loadDefaultInterproceduralDatabases, loadInterproceduralDatabases, loadPropertyDatabase, loadPropertyDatabaseFromResource, logError, logError, lookupClass, lookupSourceFile, lookupSystemClass, removeCurrentAnalysisContext, reportMissingClass, setBoolProperty, setClassSummary, setCurrentAnalysisContext, setDatabaseInputDir, setDatabaseOutputDir, setFieldSummary, setMissingClassWarningsSuppressed, setProject, setUnreadFields, storePropertyDatabase, unreadFieldsAvailable
-
-
-
-
Method Detail
-
addClasspathEntry
public void addClasspathEntry(java.lang.String url) throws java.io.IOException
Description copied from class:AnalysisContext
Add an entry to the Repository's classpath.- Specified by:
addClasspathEntry
in classAnalysisContext
- Parameters:
url
- the classpath entry URL- Throws:
java.io.IOException
-
clearClassContextCache
public void clearClassContextCache()
Description copied from class:AnalysisContext
Clear the ClassContext cache. This should be done between analysis passes.- Specified by:
clearClassContextCache
in classAnalysisContext
-
clearRepository
public void clearRepository()
Description copied from class:AnalysisContext
Clear the BCEL Repository in preparation for analysis.- Specified by:
clearRepository
in classAnalysisContext
-
getAnnotationRetentionDatabase
public AnnotationRetentionDatabase getAnnotationRetentionDatabase()
- Specified by:
getAnnotationRetentionDatabase
in classAnalysisContext
-
getCheckReturnAnnotationDatabase
public CheckReturnAnnotationDatabase getCheckReturnAnnotationDatabase()
- Specified by:
getCheckReturnAnnotationDatabase
in classAnalysisContext
-
getClassContext
public ClassContext getClassContext(org.apache.bcel.classfile.JavaClass javaClass)
Description copied from class:AnalysisContext
Get the ClassContext for a class.- Specified by:
getClassContext
in classAnalysisContext
- Parameters:
javaClass
- the class- Returns:
- the ClassContext for that class
-
getClassContextStats
public java.lang.String getClassContextStats()
Description copied from class:AnalysisContext
Get stats about hit rate for ClassContext cache.- Specified by:
getClassContextStats
in classAnalysisContext
- Returns:
- stats about hit rate for ClassContext cache
-
getFieldStoreTypeDatabase
public FieldStoreTypeDatabase getFieldStoreTypeDatabase()
Description copied from class:AnalysisContext
Get the property database recording the types of values stored into fields.- Specified by:
getFieldStoreTypeDatabase
in classAnalysisContext
- Returns:
- the database, or null if there is no database available
-
getJCIPAnnotationDatabase
public JCIPAnnotationDatabase getJCIPAnnotationDatabase()
- Specified by:
getJCIPAnnotationDatabase
in classAnalysisContext
-
getLookupFailureCallback
public RepositoryLookupFailureCallback getLookupFailureCallback()
Description copied from class:AnalysisContext
Get the lookup failure callback.- Specified by:
getLookupFailureCallback
in classAnalysisContext
-
getNullnessAnnotationDatabase
public INullnessAnnotationDatabase getNullnessAnnotationDatabase()
- Specified by:
getNullnessAnnotationDatabase
in classAnalysisContext
-
getSourceFinder
public SourceFinder getSourceFinder()
Description copied from class:AnalysisContext
Get the SourceFinder, for finding source files.- Specified by:
getSourceFinder
in classAnalysisContext
-
getSourceInfoMap
public SourceInfoMap getSourceInfoMap()
Description copied from class:AnalysisContext
Get the SourceInfoMap.- Specified by:
getSourceInfoMap
in classAnalysisContext
-
getUnconditionalDerefParamDatabase
public ParameterNullnessPropertyDatabase getUnconditionalDerefParamDatabase()
Description copied from class:AnalysisContext
Get the property database recording which methods unconditionally dereference parameters.- Specified by:
getUnconditionalDerefParamDatabase
in classAnalysisContext
- Returns:
- the database, or null if there is no database available
-
initDatabases
public void initDatabases()
Description copied from class:AnalysisContext
Instantiate the CheckReturnAnnotationDatabase. Do this after the repository has been set up.- Specified by:
initDatabases
in classAnalysisContext
-
lookupClass
public org.apache.bcel.classfile.JavaClass lookupClass(@DottedClassName java.lang.String className) throws java.lang.ClassNotFoundException
Description copied from class:AnalysisContext
Lookup a class. Use this method instead of Repository.lookupClass().- Specified by:
lookupClass
in classAnalysisContext
- Parameters:
className
- the name of the class- Returns:
- the JavaClass representing the class
- Throws:
java.lang.ClassNotFoundException
- (but not really)
-
getInnerClassAccessMap
public InnerClassAccessMap getInnerClassAccessMap()
- Specified by:
getInnerClassAccessMap
in classAnalysisContext
-
setAppClassList
public void setAppClassList(java.util.List<ClassDescriptor> appClassCollection) throws CheckedAnalysisException
Set the collection of class descriptors identifying all application classes.- Parameters:
appClassCollection
- List of ClassDescriptors identifying application classes- Throws:
CheckedAnalysisException
-
updateDatabases
public void updateDatabases(int pass)
Description copied from class:AnalysisContext
After a pass has been completed, allow the analysis context to update information.- Specified by:
updateDatabases
in classAnalysisContext
- Parameters:
pass
- -- the first pass is pass 0
-
getReturnValueNullnessPropertyDatabase
public ReturnValueNullnessPropertyDatabase getReturnValueNullnessPropertyDatabase()
Description copied from class:AnalysisContext
Get the property database recording which methods always return nonnull values- Specified by:
getReturnValueNullnessPropertyDatabase
in classAnalysisContext
- Returns:
- the database, or null if there is no database available
-
getSubtypes2
public Subtypes2 getSubtypes2()
Description copied from class:AnalysisContext
Get the Subtypes2 inheritance hierarchy database.- Specified by:
getSubtypes2
in classAnalysisContext
-
getDirectlyRelevantTypeQualifiersDatabase
public DirectlyRelevantTypeQualifiersDatabase getDirectlyRelevantTypeQualifiersDatabase()
- Specified by:
getDirectlyRelevantTypeQualifiersDatabase
in classAnalysisContext
-
-