edu.umd.cs.findbugs.classfile

Interface IAnalysisCache

public interface IAnalysisCache

The analysis cache performs analyses on classes and methods and caches the results.

Author: David Hovemeyer

Method Summary
<E> voideagerlyPutMethodAnalysis(Class<E> analysisClass, MethodDescriptor methodDescriptor, Object analysisObject)
Eagerly put a method analysis object in the cache.
<E> EgetClassAnalysis(Class<E> analysisClass, ClassDescriptor classDescriptor)
Get an analysis of the given class.
IClassPathgetClassPath()
Get the classpath from which classes are loaded.
<E> EgetDatabase(Class<E> databaseClass)
Get a database.
IErrorLoggergetErrorLogger()
Get the error logger.
<E> EgetMethodAnalysis(Class<E> analysisClass, MethodDescriptor methodDescriptor)
Get an analysis of the given method.
<E> EprobeClassAnalysis(Class<E> analysisClass, ClassDescriptor classDescriptor)
See if the cache contains a cached class analysis result for given class descriptor.
voidpurgeMethodAnalyses(MethodDescriptor methodDescriptor)
Purge all analysis results for given method.
<E> voidregisterClassAnalysisEngine(Class<E> analysisResultType, IClassAnalysisEngine classAnalysisEngine)
Register the given class analysis engine as producing the analysis result type whose Class is given.
<E> voidregisterDatabaseFactory(Class<E> databaseClass, IDatabaseFactory<E> databaseFactory)
Register a database factory.
<E> voidregisterMethodAnalysisEngine(Class<E> analysisResultType, IMethodAnalysisEngine methodAnalysisEngine)
Register the given method analysis engine as producing the analysis result type whose Class is given.

Method Detail

eagerlyPutMethodAnalysis

public <E> void eagerlyPutMethodAnalysis(Class<E> analysisClass, MethodDescriptor methodDescriptor, Object analysisObject)
Eagerly put a method analysis object in the cache. This can be necessary if an method analysis engine invokes other analysis engines that might recursively require the analysis being produced.

Parameters: the type of the analysis (e.g., FoobarAnalysis) analysisClass the analysis class object (e.g., FoobarAnalysis.class) methodDescriptor the descriptor of the method to analyze analysisObject

getClassAnalysis

public <E> E getClassAnalysis(Class<E> analysisClass, ClassDescriptor classDescriptor)
Get an analysis of the given class.

Parameters: the type of the analysis (e.g., FoobarAnalysis) analysisClass the analysis class object (e.g., FoobarAnalysis.class) classDescriptor the descriptor of the class to analyze

Returns: the analysis object (e.g., instance of FoobarAnalysis for the class)

Throws: CheckedAnalysisException if an error occurs performing the analysis

getClassPath

public IClassPath getClassPath()
Get the classpath from which classes are loaded.

Returns: the classpath

getDatabase

public <E> E getDatabase(Class<E> databaseClass)
Get a database.

Parameters: type of database databaseClass Class of database

Returns: the database (which is created by a database factory if required)

Throws: CheckedAnalysisException

getErrorLogger

public IErrorLogger getErrorLogger()
Get the error logger.

Returns: the error logger

getMethodAnalysis

public <E> E getMethodAnalysis(Class<E> analysisClass, MethodDescriptor methodDescriptor)
Get an analysis of the given method.

Parameters: the type of the analysis (e.g., FoobarAnalysis) analysisClass the analysis class object (e.g., FoobarAnalysis.class) methodDescriptor the descriptor of the method to analyze

Returns: the analysis object (e.g., instance of FoobarAnalysis for the method)

Throws: CheckedAnalysisException if an error occurs performing the analysis

probeClassAnalysis

public <E> E probeClassAnalysis(Class<E> analysisClass, ClassDescriptor classDescriptor)
See if the cache contains a cached class analysis result for given class descriptor.

Parameters: analysisClass analysis result class classDescriptor the class descriptor

Returns: a cached analysis result, or null if there is no cached analysis result

purgeMethodAnalyses

public void purgeMethodAnalyses(MethodDescriptor methodDescriptor)
Purge all analysis results for given method. This can be called when a CFG is pruned and we want to compute more accurate analysis results on the new CFG.

Parameters: methodDescriptor method whose analysis results should be purged

registerClassAnalysisEngine

public <E> void registerClassAnalysisEngine(Class<E> analysisResultType, IClassAnalysisEngine classAnalysisEngine)
Register the given class analysis engine as producing the analysis result type whose Class is given.

Parameters: analysis result type analysisResultType analysis result type Class object classAnalysisEngine the class analysis engine to register

registerDatabaseFactory

public <E> void registerDatabaseFactory(Class<E> databaseClass, IDatabaseFactory<E> databaseFactory)
Register a database factory.

Parameters: type of database databaseClass Class of database databaseFactory the database factory

registerMethodAnalysisEngine

public <E> void registerMethodAnalysisEngine(Class<E> analysisResultType, IMethodAnalysisEngine methodAnalysisEngine)
Register the given method analysis engine as producing the analysis result type whose Class is given.

Parameters: analysis result type analysisResultType analysis result type Class object methodAnalysisEngine the method analysis engine to register

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.