public class FindBugs2 extends Object implements IFindBugsEngine
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEBUG |
static boolean |
PROGRESS |
static String |
PROP_FINDBUGS_HOST_APP |
static String |
PROP_FINDBUGS_HOST_APP_VERSION |
| Constructor and Description |
|---|
FindBugs2()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addClassObserver(IClassObserver classObserver)
Add an IClassObserver.
|
void |
addFilter(String filterFileName,
boolean include)
Set filter of bug instances to include or exclude.
|
static void |
clearAnalysisContext() |
protected void |
clearCaches()
Protected to allow Eclipse plugin remember some cache data for later reuse
|
protected void |
configureFilters(UserPreferences userPreferences) |
protected IAnalysisCache |
createAnalysisCache()
Create the analysis cache object and register it for current execution thread.
|
static void |
createAnalysisContext(Project project,
List<ClassDescriptor> appClassList,
String sourceInfoFileName)
Create the AnalysisContext that will serve as the BCEL-compatibility
layer over the AnalysisCache.
|
void |
dispose()
To avoid cyclic cross-references and allow GC after engine is not more
needed.
|
boolean |
emitTrainingOutput()
Return whether or not training output should be emitted after analysis
completes.
|
void |
enableTrainingInput(String trainingInputDir)
Set whether or not training input should be used to make the analysis
more precise.
|
void |
enableTrainingOutput(String trainingOutputDir)
Set whether or not training output should be emitted.
|
void |
excludeBaselineBugs(String baselineBugs)
Provide baseline of bugs not to report
|
void |
execute()
Execute the analysis.
|
void |
finishSettings() |
int |
getBugCount()
Get the number of bug instances that were reported during analysis.
|
BugReporter |
getBugReporter()
Get the BugReporter.
|
String |
getCurrentClass()
Get the name of the most recent class to be analyzed.
|
int |
getErrorCount()
Get the number of errors that occurred during analysis.
|
int |
getMissingClassCount()
Get the number of time missing classes were reported during analysis.
|
Project |
getProject()
Get the Project.
|
String |
getProjectName() |
String |
getReleaseName() |
String |
getTrainingInputDir()
Get the training input database directory.
|
String |
getTrainingOutputDir()
Get the training output directory.
|
UserPreferences |
getUserPreferences()
Get the UserPreferences.
|
static void |
main(String[] args) |
static void |
registerBuiltInAnalysisEngines(IAnalysisCache analysisCache)
Register the "built-in" analysis engines with given IAnalysisCache.
|
static void |
registerPluginAnalysisEngines(DetectorFactoryCollection detectorFactoryCollection,
IAnalysisCache analysisCache)
Register all of the analysis engines defined in the plugins contained in
a DetectorFactoryCollection with an IAnalysisCache.
|
void |
setAbridgedMessages(boolean xmlWithAbridgedMessages) |
void |
setAnalysisFeatureSettings(AnalysisFeatureSetting[] settingList)
Set analysis feature settings.
|
static void |
setAppClassList(List<ClassDescriptor> appClassList) |
void |
setApplySuppression(boolean applySuppression) |
void |
setBugReporter(BugReporter bugReporter)
Set the BugReporter.
|
void |
setBugReporterDecorators(Set<String> explicitlyEnabled,
Set<String> explicitlyDisabled) |
void |
setClassScreener(IClassScreener classScreener)
Set the ClassScreener.
|
void |
setDetectorFactoryCollection(DetectorFactoryCollection detectorFactoryCollection)
Set the detector factory collection to be used by this FindBugs2 engine.
|
void |
setMergeSimilarWarnings(boolean mergeSimilarWarnings) |
void |
setNoClassOk(boolean noClassOk)
Set whether or not to generate an empty output file if there were no
class files specified.
|
void |
setProgressCallback(FindBugsProgress progressCallback)
Set the progress callback that will be used to keep track of the progress
of the analysis.
|
void |
setProject(Project project)
Set the Project.
|
void |
setProjectName(String name) |
void |
setRankThreshold(int rankThreshold) |
void |
setRelaxedReportingMode(boolean relaxedReportingMode)
Set relaxed reporting mode.
|
void |
setReleaseName(String releaseName) |
void |
setScanNestedArchives(boolean scanNestedArchives)
Set whether or not nested archives should be scanned.
|
void |
setSourceInfoFile(String sourceInfoFile)
Set the filename of the source info file containing line numbers for
fields and classes.
|
void |
setUserPreferences(UserPreferences userPreferences)
Set the UserPreferences representing which Detectors should be used.
|
List<ClassDescriptor> |
sortByCallGraph(Collection<ClassDescriptor> classList,
TopologicalSort.OutEdges<ClassDescriptor> outEdges) |
boolean |
useTrainingInput()
Return whether or not we should make use of training data.
|
public static final boolean DEBUG
public static final boolean PROGRESS
public static final String PROP_FINDBUGS_HOST_APP
public static final String PROP_FINDBUGS_HOST_APP_VERSION
public void setDetectorFactoryCollection(DetectorFactoryCollection detectorFactoryCollection)
setDetectorFactoryCollection in interface IFindBugsEnginedetectorFactoryCollection - The detectorFactoryCollection to set.public void execute()
throws IOException,
InterruptedException
execute in interface IFindBugsEngineIOExceptionInterruptedExceptionprotected void clearCaches()
public void dispose()
public BugReporter getBugReporter()
IFindBugsEnginegetBugReporter in interface IFindBugsEnginepublic Project getProject()
IFindBugsEnginegetProject in interface IFindBugsEnginepublic void addClassObserver(IClassObserver classObserver)
IFindBugsEngineaddClassObserver in interface IFindBugsEngineclassObserver - the IClassObserverpublic void addFilter(String filterFileName, boolean include) throws IOException, FilterException
IFindBugsEngineaddFilter in interface IFindBugsEnginefilterFileName - the name of the filter fileinclude - true if the filter specifies bug instances to include, false
if it specifies bug instances to excludeIOExceptionFilterExceptionpublic void excludeBaselineBugs(String baselineBugs) throws IOException, org.dom4j.DocumentException
IFindBugsEngineexcludeBaselineBugs in interface IFindBugsEnginebaselineBugs - the name of the xml bug baseline fileorg.dom4j.DocumentExceptionIOExceptionpublic void enableTrainingInput(String trainingInputDir)
IFindBugsEngineenableTrainingInput in interface IFindBugsEnginetrainingInputDir - directory to load training input frompublic void enableTrainingOutput(String trainingOutputDir)
IFindBugsEngineenableTrainingOutput in interface IFindBugsEnginetrainingOutputDir - directory to save training output inpublic int getBugCount()
IFindBugsEnginegetBugCount in interface IFindBugsEnginepublic String getCurrentClass()
IFindBugsEnginegetCurrentClass in interface IFindBugsEnginepublic int getErrorCount()
IFindBugsEnginegetErrorCount in interface IFindBugsEnginepublic int getMissingClassCount()
IFindBugsEnginegetMissingClassCount in interface IFindBugsEnginepublic String getReleaseName()
getReleaseName in interface IFindBugsEnginepublic String getProjectName()
getProjectName in interface IFindBugsEnginepublic void setProjectName(String name)
setProjectName in interface IFindBugsEnginename - The project name to set.public void setAnalysisFeatureSettings(AnalysisFeatureSetting[] settingList)
IFindBugsEnginesetAnalysisFeatureSettings in interface IFindBugsEnginesettingList - list of analysis feature settingspublic void setBugReporter(BugReporter bugReporter)
IFindBugsEnginesetBugReporter in interface IFindBugsEnginebugReporter - The BugReporter to setpublic void setClassScreener(IClassScreener classScreener)
IFindBugsEnginesetClassScreener in interface IFindBugsEngineclassScreener - the ClassScreener to usepublic void setProgressCallback(FindBugsProgress progressCallback)
IFindBugsEnginesetProgressCallback in interface IFindBugsEngineprogressCallback - the progress callbackpublic void setProject(Project project)
IFindBugsEnginesetProject in interface IFindBugsEngineproject - The Project to setpublic void setRelaxedReportingMode(boolean relaxedReportingMode)
IFindBugsEnginesetRelaxedReportingMode in interface IFindBugsEnginerelaxedReportingMode - true if relaxed reporting mode should be enabled, false if notpublic void setReleaseName(String releaseName)
setReleaseName in interface IFindBugsEnginereleaseName - The releaseName to set.public void setSourceInfoFile(String sourceInfoFile)
IFindBugsEnginesetSourceInfoFile in interface IFindBugsEnginesourceInfoFile - the source info filenamepublic void setUserPreferences(UserPreferences userPreferences)
IFindBugsEnginesetUserPreferences in interface IFindBugsEngineuserPreferences - the UserPreferencesprotected void configureFilters(UserPreferences userPreferences)
public boolean emitTrainingOutput()
IFindBugsEngineemitTrainingOutput in interface IFindBugsEnginepublic UserPreferences getUserPreferences()
IFindBugsEnginegetUserPreferences in interface IFindBugsEnginepublic String getTrainingInputDir()
IFindBugsEnginegetTrainingInputDir in interface IFindBugsEnginepublic String getTrainingOutputDir()
IFindBugsEnginegetTrainingOutputDir in interface IFindBugsEnginepublic boolean useTrainingInput()
IFindBugsEngineuseTrainingInput in interface IFindBugsEnginepublic void setScanNestedArchives(boolean scanNestedArchives)
IFindBugsEnginesetScanNestedArchives in interface IFindBugsEnginescanNestedArchives - true if nested archives should be scanned, false if notpublic void setNoClassOk(boolean noClassOk)
IFindBugsEnginesetNoClassOk in interface IFindBugsEnginenoClassOk - true if FindBugs should generate empty output fileprotected IAnalysisCache createAnalysisCache() throws IOException
This method is protected to allow clients override it and possibly reuse some previous analysis data (for Eclipse interactive re-build)
IOException - if error occurs registering analysis engines in a pluginpublic static void registerBuiltInAnalysisEngines(IAnalysisCache analysisCache)
analysisCache - an IAnalysisCachepublic static void registerPluginAnalysisEngines(DetectorFactoryCollection detectorFactoryCollection, IAnalysisCache analysisCache) throws IOException
detectorFactoryCollection - a DetectorFactoryCollectionanalysisCache - an IAnalysisCacheIOExceptionpublic List<ClassDescriptor> sortByCallGraph(Collection<ClassDescriptor> classList, TopologicalSort.OutEdges<ClassDescriptor> outEdges)
public static void clearAnalysisContext()
public static void createAnalysisContext(Project project, List<ClassDescriptor> appClassList, @CheckForNull String sourceInfoFileName) throws IOException
project - The projectappClassList - list of ClassDescriptors identifying application classessourceInfoFileName - name of source info file (null if none)IOExceptionpublic static void setAppClassList(List<ClassDescriptor> appClassList)
public void setAbridgedMessages(boolean xmlWithAbridgedMessages)
setAbridgedMessages in interface IFindBugsEnginepublic void setMergeSimilarWarnings(boolean mergeSimilarWarnings)
setMergeSimilarWarnings in interface IFindBugsEnginepublic void setApplySuppression(boolean applySuppression)
setApplySuppression in interface IFindBugsEnginepublic void setRankThreshold(int rankThreshold)
setRankThreshold in interface IFindBugsEnginepublic void finishSettings()
finishSettings in interface IFindBugsEnginepublic void setBugReporterDecorators(Set<String> explicitlyEnabled, Set<String> explicitlyDisabled)
setBugReporterDecorators in interface IFindBugsEngineCopyright © 2003–2015. All rights reserved.