@NotThreadSafe
public abstract class AnalysisContext
extends java.lang.Object
NOTE: this class is slated to become obsolete. New code should use the IAnalysisCache object returned by Global.getAnalysisCache() to access all analysis information (global databases, class and method analyses, etc.)
IAnalysisCache
,
Global
Modifier and Type | Field and Description |
---|---|
static boolean |
DEBUG |
static java.lang.String |
DEFAULT_CHECK_FOR_NULL_PARAM_DATABASE_FILENAME |
static java.lang.String |
DEFAULT_NONNULL_PARAM_DATABASE_FILENAME |
static java.lang.String |
DEFAULT_NULL_RETURN_VALUE_ANNOTATION_DATABASE |
static java.lang.String |
DEFAULT_NULL_RETURN_VALUE_DB_FILENAME |
static boolean |
IGNORE_BUILTIN_MODELS |
static java.lang.String |
NONNULL_RETURN_DB_FILENAME |
static java.lang.String |
NONNULL_RETURN_DB_RESOURCE |
protected Project |
project |
static java.lang.String |
UNCONDITIONAL_DEREF_DB_FILENAME |
static java.lang.String |
UNCONDITIONAL_DEREF_DB_RESOURCE |
Modifier | Constructor and Description |
---|---|
protected |
AnalysisContext() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addClasspathEntry(java.lang.String url)
Add an entry to the Repository's classpath.
|
abstract void |
clearClassContextCache()
Clear the ClassContext cache.
|
abstract void |
clearRepository()
Clear the BCEL Repository in preparation for analysis.
|
static AnalysisContext |
currentAnalysisContext()
Get the AnalysisContext associated with this thread
|
static XFactory |
currentXFactory() |
abstract AnnotationRetentionDatabase |
getAnnotationRetentionDatabase() |
boolean |
getBoolProperty(int prop)
Get a boolean property.
|
abstract CheckReturnAnnotationDatabase |
getCheckReturnAnnotationDatabase() |
abstract ClassContext |
getClassContext(org.apache.bcel.classfile.JavaClass javaClass)
Get the ClassContext for a class.
|
abstract java.lang.String |
getClassContextStats()
Get stats about hit rate for ClassContext cache.
|
ClassSummary |
getClassSummary() |
java.lang.String |
getDatabaseInputDir()
Get the interprocedural database input directory.
|
java.lang.String |
getDatabaseOutputDir()
Get the interprocedural database output directory.
|
abstract DirectlyRelevantTypeQualifiersDatabase |
getDirectlyRelevantTypeQualifiersDatabase() |
EqualsKindSummary |
getEqualsKindSummary() |
abstract FieldStoreTypeDatabase |
getFieldStoreTypeDatabase()
Get the property database recording the types of values stored
into fields.
|
FieldSummary |
getFieldSummary() |
abstract InnerClassAccessMap |
getInnerClassAccessMap() |
abstract JCIPAnnotationDatabase |
getJCIPAnnotationDatabase() |
abstract RepositoryLookupFailureCallback |
getLookupFailureCallback()
Get the lookup failure callback.
|
abstract INullnessAnnotationDatabase |
getNullnessAnnotationDatabase() |
abstract ReturnValueNullnessPropertyDatabase |
getReturnValueNullnessPropertyDatabase()
Get the property database recording which methods always return nonnull values
|
abstract SourceFinder |
getSourceFinder()
Get the SourceFinder, for finding source files.
|
abstract SourceInfoMap |
getSourceInfoMap()
Get the SourceInfoMap.
|
abstract Subtypes2 |
getSubtypes2()
Get the Subtypes2 inheritance hierarchy database.
|
abstract ParameterNullnessPropertyDatabase |
getUnconditionalDerefParamDatabase()
Get the property database recording which methods unconditionally
dereference parameters.
|
UnreadFields |
getUnreadFields() |
java.util.Collection<XClass> |
getXClassCollection()
Get Collection of all XClass objects seen so far.
|
abstract void |
initDatabases()
Instantiate the CheckReturnAnnotationDatabase.
|
boolean |
isApplicationClass(ClassDescriptor desc) |
boolean |
isApplicationClass(org.apache.bcel.classfile.JavaClass cls)
Return whether or not the given class is an application class.
|
boolean |
isApplicationClass(java.lang.String className)
Return whether or not the given class is an application class.
|
boolean |
isTooBig(ClassDescriptor desc) |
void |
loadDefaultInterproceduralDatabases()
If possible, load default (built-in) interprocedural property databases.
|
void |
loadInterproceduralDatabases()
If possible, load interprocedural property databases.
|
<DatabaseType extends PropertyDatabase<KeyType,Property>,KeyType extends FieldOrMethodDescriptor,Property> |
loadPropertyDatabase(DatabaseType database,
java.lang.String fileName,
java.lang.String description)
Load an interprocedural property database.
|
<DatabaseType extends PropertyDatabase<KeyType,Property>,KeyType extends FieldOrMethodDescriptor,Property> |
loadPropertyDatabaseFromResource(DatabaseType database,
java.lang.String resourceName,
java.lang.String description)
Load an interprocedural property database.
|
static void |
logError(java.lang.String msg)
Report an error
|
static void |
logError(java.lang.String msg,
java.lang.Exception e)
Report an error
|
org.apache.bcel.classfile.JavaClass |
lookupClass(ClassDescriptor classDescriptor)
Lookup a class.
|
abstract org.apache.bcel.classfile.JavaClass |
lookupClass(java.lang.String className)
Lookup a class.
|
java.lang.String |
lookupSourceFile(java.lang.String dottedClassName)
Lookup a class's source file
|
static org.apache.bcel.classfile.JavaClass |
lookupSystemClass(java.lang.String className)
This is equivalent to Repository.lookupClass() or this.lookupClass(),
except it uses the original Repository instead of the current one.
|
static void |
removeCurrentAnalysisContext() |
static void |
reportMissingClass(java.lang.ClassNotFoundException e)
file a ClassNotFoundException with the lookupFailureCallback
|
void |
setBoolProperty(int prop,
boolean value)
Set a boolean property.
|
void |
setClassSummary(ClassSummary classSummary) |
static void |
setCurrentAnalysisContext(AnalysisContext analysisContext)
Set the current analysis context for this thread.
|
void |
setDatabaseInputDir(java.lang.String databaseInputDir)
Set the interprocedural database input directory.
|
void |
setDatabaseOutputDir(java.lang.String databaseOutputDir)
Set the interprocedural database output directory.
|
void |
setFieldSummary(FieldSummary fieldSummary) |
boolean |
setMissingClassWarningsSuppressed(boolean value) |
void |
setProject(Project project)
Set the source path.
|
void |
setUnreadFields(UnreadFields unreadFields) |
<DatabaseType extends PropertyDatabase<KeyType,Property>,KeyType extends FieldOrMethodDescriptor,Property> |
storePropertyDatabase(DatabaseType database,
java.lang.String fileName,
java.lang.String description)
Write an interprocedural property database.
|
boolean |
unreadFieldsAvailable() |
abstract void |
updateDatabases(int pass)
After a pass has been completed, allow the analysis context to update information.
|
public static final boolean DEBUG
public static final boolean IGNORE_BUILTIN_MODELS
public static final java.lang.String DEFAULT_NONNULL_PARAM_DATABASE_FILENAME
public static final java.lang.String DEFAULT_CHECK_FOR_NULL_PARAM_DATABASE_FILENAME
public static final java.lang.String DEFAULT_NULL_RETURN_VALUE_ANNOTATION_DATABASE
public static final java.lang.String UNCONDITIONAL_DEREF_DB_FILENAME
public static final java.lang.String NONNULL_RETURN_DB_FILENAME
public static final java.lang.String UNCONDITIONAL_DEREF_DB_RESOURCE
public static final java.lang.String NONNULL_RETURN_DB_RESOURCE
public static final java.lang.String DEFAULT_NULL_RETURN_VALUE_DB_FILENAME
protected Project project
public abstract INullnessAnnotationDatabase getNullnessAnnotationDatabase()
public abstract CheckReturnAnnotationDatabase getCheckReturnAnnotationDatabase()
public abstract AnnotationRetentionDatabase getAnnotationRetentionDatabase()
public abstract JCIPAnnotationDatabase getJCIPAnnotationDatabase()
public abstract void initDatabases()
public abstract void updateDatabases(int pass)
pass
- -- the first pass is pass 0public static AnalysisContext currentAnalysisContext()
public static XFactory currentXFactory()
public ClassSummary getClassSummary()
public void setClassSummary(@NonNull ClassSummary classSummary)
public EqualsKindSummary getEqualsKindSummary()
public FieldSummary getFieldSummary()
public void setFieldSummary(@NonNull FieldSummary fieldSummary)
public UnreadFields getUnreadFields()
public boolean unreadFieldsAvailable()
public void setUnreadFields(@NonNull UnreadFields unreadFields)
public abstract DirectlyRelevantTypeQualifiersDatabase getDirectlyRelevantTypeQualifiersDatabase()
public static void reportMissingClass(java.lang.ClassNotFoundException e)
getLookupFailureCallback()
public static void logError(java.lang.String msg, java.lang.Exception e)
public static void logError(java.lang.String msg)
public boolean setMissingClassWarningsSuppressed(boolean value)
public abstract RepositoryLookupFailureCallback getLookupFailureCallback()
public final void setProject(Project project)
public abstract SourceFinder getSourceFinder()
public abstract void clearRepository()
public abstract void clearClassContextCache()
public abstract void addClasspathEntry(java.lang.String url) throws java.io.IOException
url
- the classpath entry URLjava.io.IOException
public boolean isApplicationClass(org.apache.bcel.classfile.JavaClass cls)
cls
- the class to lookuppublic boolean isApplicationClass(@DottedClassName java.lang.String className)
className
- name of a classpublic boolean isApplicationClass(ClassDescriptor desc)
public boolean isTooBig(ClassDescriptor desc)
public abstract org.apache.bcel.classfile.JavaClass lookupClass(@NonNull@DottedClassName java.lang.String className) throws java.lang.ClassNotFoundException
className
- the name of the classjava.lang.ClassNotFoundException
- (but not really)public org.apache.bcel.classfile.JavaClass lookupClass(@NonNull ClassDescriptor classDescriptor) throws java.lang.ClassNotFoundException
classDescriptor
- descriptor specifying the class to look upjava.lang.ClassNotFoundException
- if the class can't be foundpublic static org.apache.bcel.classfile.JavaClass lookupSystemClass(@NonNull java.lang.String className) throws java.lang.ClassNotFoundException
className
- the name of the classjava.lang.ClassNotFoundException
public final java.lang.String lookupSourceFile(@NonNull@DottedClassName java.lang.String dottedClassName)
dottedClassName
- the name of the classSourceLineAnnotation.UNKNOWN_SOURCE_FILE
if unable to determinepublic abstract ClassContext getClassContext(org.apache.bcel.classfile.JavaClass javaClass)
javaClass
- the classpublic abstract java.lang.String getClassContextStats()
public final void loadInterproceduralDatabases()
public final void loadDefaultInterproceduralDatabases()
public final void setBoolProperty(int prop, boolean value)
prop
- the property to setvalue
- the value of the propertypublic final boolean getBoolProperty(int prop)
prop
- the propertypublic abstract SourceInfoMap getSourceInfoMap()
public final void setDatabaseInputDir(java.lang.String databaseInputDir)
databaseInputDir
- the interprocedural database input directorypublic final java.lang.String getDatabaseInputDir()
public final void setDatabaseOutputDir(java.lang.String databaseOutputDir)
databaseOutputDir
- the interprocedural database output directorypublic final java.lang.String getDatabaseOutputDir()
public abstract FieldStoreTypeDatabase getFieldStoreTypeDatabase()
public abstract ParameterNullnessPropertyDatabase getUnconditionalDerefParamDatabase()
public abstract ReturnValueNullnessPropertyDatabase getReturnValueNullnessPropertyDatabase()
public <DatabaseType extends PropertyDatabase<KeyType,Property>,KeyType extends FieldOrMethodDescriptor,Property> DatabaseType loadPropertyDatabase(DatabaseType database, java.lang.String fileName, java.lang.String description)
DatabaseType
- actual type of the databaseKeyType
- type of key (e.g., method or field)Property
- type of properties stored in the databasedatabase
- the empty database objectfileName
- file to load database fromdescription
- description of the database (for diagnostics)public <DatabaseType extends PropertyDatabase<KeyType,Property>,KeyType extends FieldOrMethodDescriptor,Property> DatabaseType loadPropertyDatabaseFromResource(DatabaseType database, java.lang.String resourceName, java.lang.String description)
DatabaseType
- actual type of the databaseKeyType
- type of key (e.g., method or field)Property
- type of properties stored in the databasedatabase
- the empty database objectresourceName
- name of resource to load the database fromdescription
- description of the database (for diagnostics)public <DatabaseType extends PropertyDatabase<KeyType,Property>,KeyType extends FieldOrMethodDescriptor,Property> void storePropertyDatabase(DatabaseType database, java.lang.String fileName, java.lang.String description)
DatabaseType
- actual type of the databaseKeyType
- type of key (e.g., method or field)Property
- type of properties stored in the databasedatabase
- the databasefileName
- name of database filedescription
- description of the databasepublic abstract InnerClassAccessMap getInnerClassAccessMap()
public static void setCurrentAnalysisContext(AnalysisContext analysisContext)
analysisContext
- the current analysis context for this threadpublic static void removeCurrentAnalysisContext()
public abstract Subtypes2 getSubtypes2()
public java.util.Collection<XClass> getXClassCollection()
FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.