Package edu.umd.cs.findbugs
Class Plugin
java.lang.Object
edu.umd.cs.findbugs.Plugin
A FindBugs plugin. A plugin contains executable Detector classes, as well as
meta information describing those detectors (such as human-readable detector
and bug descriptions).
- Author:
- David Hovemeyer
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionPlugin
(String pluginId, String version, Date releaseDate, PluginLoader pluginLoader, boolean enabled, boolean cannotDisable) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addBugCategory
(BugCategory bugCategory) Add a BugCategory reported by the Plugin.void
addBugCode
(BugCode bugCode) Add a BugCode reported by the Plugin.void
addBugPattern
(BugPattern bugPattern) Add a BugPattern reported by the Plugin.static Plugin
static Plugin
addCustomPlugin
(URI u, ClassLoader parent) static Plugin
static Plugin
addCustomPlugin
(URL u, ClassLoader parent) void
addDetectorFactory
(DetectorFactory factory) Add a DetectorFactory for a Detector implemented by the Plugin.void
Add an inter-pass Detector ordering constraint.void
Add an intra-pass Detector ordering constraint.boolean
static Collection<String>
static Collection<Plugin>
Get Iterator over BugCategories objects in the Plugin.getBugCategory
(String id) Get Iterator over BugCode objects in the Plugin.Get the set of BugPatternsstatic Plugin
getByPluginId
(String name) <T> ComponentPlugin<T>
getComponentPlugin
(Class<T> componentClass, String name) <T> Iterable<ComponentPlugin<T>>
getComponentPlugins
(Class<T> componentClass) Get Iterator over DetectorFactory objects in the Plugin.Class<? extends IAnalysisEngineRegistrar>
Get the analysis engine registrar class that, when instantiated, can be used to register the plugin's analysis engines with the analysis cache.getFactoryByFullName
(String fullName) Look up a DetectorFactory by full name.getFactoryByShortName
(String shortName) Look up a DetectorFactory by short name.getFindBugsMain
(String cmd) Get the plugin provider.getResource
(String name) Get the plugin website.Return an Iterator over the inter-pass Detector ordering constraints.Return an Iterator over the intra-pass Detector ordering constraints.boolean
boolean
Return whether or not the Plugin is enabled.boolean
boolean
static Plugin
loadCustomPlugin
(File f, Project project) Loads the given plugin and enables it for the given project.static Plugin
loadCustomPlugin
(URL urlString, Project project) Loads the given plugin and enables it for the given project.static void
removeCustomPlugin
(Plugin plugin) static void
removePlugin
(URI uri) void
setBugRanker
(BugRanker ranker) void
setDetailedDescription
(String detailedDescription) void
setEngineRegistrarClass
(Class<? extends IAnalysisEngineRegistrar> engineRegistrarClass) Set the analysis engine registrar class that, when instantiated, can be used to register the plugin's analysis engines with the analysis cache.void
setGloballyEnabled
(boolean enabled) void
setMyGlobalOption
(String key, String value) void
setProvider
(String provider) Set plugin provider.void
setShortDescription
(String shortDescription) void
setUpdateUrl
(String url) void
setWebsite
(String website) Set plugin website.toString()
-
Constructor Details
-
Plugin
public Plugin(String pluginId, String version, Date releaseDate, @Nonnull PluginLoader pluginLoader, boolean enabled, boolean cannotDisable) Constructor. Creates an empty plugin object.- Parameters:
pluginId
- the plugin's unique identifier
-
-
Method Details
-
toString
-
isEnabledByDefault
public boolean isEnabledByDefault()Return whether or not the Plugin is enabled.- Returns:
- true if the Plugin is enabled, false if not
-
setProvider
Set plugin provider.- Parameters:
provider
- the plugin provider
-
getProvider
Get the plugin provider.- Returns:
- the provider, or null if the provider was not specified
-
setUpdateUrl
- Throws:
URISyntaxException
-
getUpdateUrl
-
setMyGlobalOption
-
setWebsite
Set plugin website.- Parameters:
website
- the plugin website- Throws:
URISyntaxException
-
getWebsite
Get the plugin website.- Returns:
- the website, or null if the was not specified
-
getWebsiteURI
-
getVersion
-
getReleaseDate
-
setShortDescription
-
getShortDescription
-
getDetailedDescription
-
setDetailedDescription
-
addDetectorFactory
Add a DetectorFactory for a Detector implemented by the Plugin.- Parameters:
factory
- the DetectorFactory
-
addBugPattern
Add a BugPattern reported by the Plugin.- Parameters:
bugPattern
-
-
addBugCode
Add a BugCode reported by the Plugin.- Parameters:
bugCode
-
-
addBugCategory
Add a BugCategory reported by the Plugin.- Parameters:
bugCategory
-
-
addOrCreateBugCategory
-
addInterPassOrderingConstraint
Add an inter-pass Detector ordering constraint.- Parameters:
constraint
- the inter-pass Detector ordering constraint
-
addIntraPassOrderingConstraint
Add an intra-pass Detector ordering constraint.- Parameters:
constraint
- the intra-pass Detector ordering constraint
-
getFactoryByShortName
Look up a DetectorFactory by short name.- Parameters:
shortName
- the short name- Returns:
- the DetectorFactory
-
getFactoryByFullName
Look up a DetectorFactory by full name.- Parameters:
fullName
- the full name- Returns:
- the DetectorFactory
-
getDetectorFactories
Get Iterator over DetectorFactory objects in the Plugin.- Returns:
- Iterator over DetectorFactory objects
-
getBugPatterns
Get the set of BugPatterns -
getBugCodes
Get Iterator over BugCode objects in the Plugin.- Returns:
- Iterator over BugCode objects
-
getBugCategories
Get Iterator over BugCategories objects in the Plugin.- Returns:
- Iterator over BugCategory objects
-
getBugCategory
- Parameters:
id
- may be null- Returns:
- return bug category with given id, may return null if the bug category is unknown
-
interPassConstraintIterator
Return an Iterator over the inter-pass Detector ordering constraints. -
intraPassConstraintIterator
Return an Iterator over the intra-pass Detector ordering constraints. -
getPluginId
-
getShortPluginId
-
setEngineRegistrarClass
Set the analysis engine registrar class that, when instantiated, can be used to register the plugin's analysis engines with the analysis cache.- Parameters:
engineRegistrarClass
- The engine registrar class to set.
-
getEngineRegistrarClass
Get the analysis engine registrar class that, when instantiated, can be used to register the plugin's analysis engines with the analysis cache.- Returns:
- Returns the engine registrar class.
-
getPluginLoader
-
setBugRanker
-
getBugRanker
-
getFindBugsMain
-
getAllFindBugsMain
-
getComponentPlugins
-
getComponentPlugin
-
getByPluginId
-
removePlugin
-
getAllPlugins
- Returns:
- a copy of the internal plugins collection
-
getAllPluginIds
-
getAllPluginsMap
- Returns:
- a copy of the internal plugins collection
-
getAllPluginsURIs
-
isCorePlugin
public boolean isCorePlugin() -
cannotDisable
public boolean cannotDisable() -
isGloballyEnabled
public boolean isGloballyEnabled() -
setGloballyEnabled
public void setGloballyEnabled(boolean enabled) -
isInitialPlugin
public boolean isInitialPlugin() -
getResource
-
getClassLoader
-
getParentPlugin
-
loadCustomPlugin
Loads the given plugin and enables it for the given project.- Parameters:
f
- A non-null jar file of custom plugin.project
- A nullable target project- Throws:
PluginException
-
loadCustomPlugin
public static Plugin loadCustomPlugin(URL urlString, @CheckForNull Project project) throws PluginException Loads the given plugin and enables it for the given project.- Throws:
PluginException
-
addCustomPlugin
- Throws:
PluginException
-
addCustomPlugin
- Throws:
PluginException
-
addCustomPlugin
@CheckForNull public static Plugin addCustomPlugin(URL u, ClassLoader parent) throws PluginException - Throws:
PluginException
-
addCustomPlugin
@CheckForNull public static Plugin addCustomPlugin(URI u, ClassLoader parent) throws PluginException - Throws:
PluginException
-
removeCustomPlugin
-