diff --git a/core/src/main/java/hudson/PluginManager.java b/core/src/main/java/hudson/PluginManager.java
index e46068ab109577a44c1f97ff7f145810c0046b03..8673d99ee4df892019829201f3eed960c8ee9def 100644
--- a/core/src/main/java/hudson/PluginManager.java
+++ b/core/src/main/java/hudson/PluginManager.java
@@ -1145,8 +1145,11 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
/**
* Get the plugin instance with the given short name.
* @param shortName the short name of the plugin
- * @return The plugin singleton or null
if a plugin with the given short name does not exist.
+ * @return The plugin singleton or {@code null} if a plugin with the given short name does not exist.
+ * The fact the plugin is loaded does not mean it is enabled and fully initialized for the current Jenkins session.
+ * Use {@link PluginWrapper#isActive()} to check it.
*/
+ @CheckForNull
public PluginWrapper getPlugin(String shortName) {
for (PluginWrapper p : getPlugins()) {
if(p.getShortName().equals(shortName))
@@ -1159,8 +1162,11 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
* Get the plugin instance that implements a specific class, use to find your plugin singleton.
* Note: beware the classloader fun.
* @param pluginClazz The class that your plugin implements.
- * @return The plugin singleton or null
if for some reason the plugin is not loaded.
+ * @return The plugin singleton or {@code null} if for some reason the plugin is not loaded.
+ * The fact the plugin is loaded does not mean it is enabled and fully initialized for the current Jenkins session.
+ * Use {@link Plugin#getWrapper()} and then {@link PluginWrapper#isActive()} to check it.
*/
+ @CheckForNull
public PluginWrapper getPlugin(Class extends Plugin> pluginClazz) {
for (PluginWrapper p : getPlugins()) {
if(pluginClazz.isInstance(p.getPlugin()))
diff --git a/core/src/main/java/jenkins/model/Jenkins.java b/core/src/main/java/jenkins/model/Jenkins.java
index 8ce9542eab4971d8cc21402bf28475b62ef66585..0d9a4b5b2fa1cef34cdc8a2415637c49e4e4a523 100644
--- a/core/src/main/java/jenkins/model/Jenkins.java
+++ b/core/src/main/java/jenkins/model/Jenkins.java
@@ -1556,11 +1556,14 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
/**
* Gets the plugin object from its short name.
- *
- *
* This allows URL hudson/plugin/ID to be served by the views * of the plugin class. + * @param shortName Short name of the plugin + * @return The plugin singleton or {@code null} if for some reason the plugin is not loaded. + * The fact the plugin is loaded does not mean it is enabled and fully initialized for the current Jenkins session. + * Use {@link Plugin#getWrapper()} and then {@link PluginWrapper#isActive()} to check it. */ + @CheckForNull public Plugin getPlugin(String shortName) { PluginWrapper p = pluginManager.getPlugin(shortName); if(p==null) return null; @@ -1574,12 +1577,15 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve * This allows easy storage of plugin information in the plugin singleton without * every plugin reimplementing the singleton pattern. * + * @param
Class of the plugin * @param clazz The plugin class (beware class-loader fun, this will probably only work * from within the jpi that defines the plugin class, it may or may not work in other cases) - * - * @return The plugin instance. + * @return The plugin singleton or {@code null} if for some reason the plugin is not loaded. + * The fact the plugin is loaded does not mean it is enabled and fully initialized for the current Jenkins session. + * Use {@link Plugin#getWrapper()} and then {@link PluginWrapper#isActive()} to check it. */ @SuppressWarnings("unchecked") + @CheckForNull public
P getPlugin(Class
clazz) { PluginWrapper p = pluginManager.getPlugin(clazz); if(p==null) return null;