diff --git a/core/src/main/java/hudson/model/Computer.java b/core/src/main/java/hudson/model/Computer.java index d47ec824474d3ce8a12aef35fbf893a0f99682c7..86fbb6c0ea5381728f2c07a32c11571092f73e97 100644 --- a/core/src/main/java/hudson/model/Computer.java +++ b/core/src/main/java/hudson/model/Computer.java @@ -918,7 +918,7 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces * @see ProcStarter#envs(Map) * @since 1.489 */ - public EnvVars buildEnvironment(TaskListener listener) throws IOException, InterruptedException { + public @Nonnull EnvVars buildEnvironment(@Nonnull TaskListener listener) throws IOException, InterruptedException { EnvVars env = new EnvVars(); Node node = getNode(); diff --git a/core/src/main/java/hudson/model/EnvironmentContributor.java b/core/src/main/java/hudson/model/EnvironmentContributor.java index 37084b10cbcfa40c203f048aab69d63e86b84a63..cbe05353d70ed5920a9f0edeb9bb72cf8f134b97 100644 --- a/core/src/main/java/hudson/model/EnvironmentContributor.java +++ b/core/src/main/java/hudson/model/EnvironmentContributor.java @@ -31,6 +31,7 @@ import hudson.scm.SCM; import jenkins.model.Jenkins; import java.io.IOException; +import javax.annotation.Nonnull; /** * Contributes environment variables to builds. @@ -79,14 +80,14 @@ public abstract class EnvironmentContributor implements ExtensionPoint { * variables that are scoped to builds. * * @param r - * Build that's being performed. Never null. + * Build that's being performed. * @param envs * Partially built environment variable map. Implementation of this method is expected to - * add additional variables here. Never null. + * add additional variables here. * @param listener - * Connected to the build console. Can be used to report errors. Never null. + * Connected to the build console. Can be used to report errors. */ - public void buildEnvironmentFor(Run r, EnvVars envs, TaskListener listener) throws IOException, InterruptedException {} + public void buildEnvironmentFor(@Nonnull Run r, @Nonnull EnvVars envs, @Nonnull TaskListener listener) throws IOException, InterruptedException {} /** * Contributes environment variables used for a job. @@ -103,12 +104,12 @@ public abstract class EnvironmentContributor implements ExtensionPoint { * Job for which some activities are launched. * @param envs * Partially built environment variable map. Implementation of this method is expected to - * add additional variables here. Never null. + * add additional variables here. * @param listener - * Connected to the build console. Can be used to report errors. Never null. + * Connected to the build console. Can be used to report errors. * @since 1.527 */ - public void buildEnvironmentFor(Job j, EnvVars envs, TaskListener listener) throws IOException, InterruptedException {} + public void buildEnvironmentFor(@Nonnull Job j, @Nonnull EnvVars envs, @Nonnull TaskListener listener) throws IOException, InterruptedException {} /** * Returns all the registered {@link EnvironmentContributor}s. diff --git a/core/src/main/java/hudson/model/Job.java b/core/src/main/java/hudson/model/Job.java index 8818c9e764ee3c6be456ff649f43eb3348bc4965..31b3024f70e10c5bd350f2c68a57126f15915791 100644 --- a/core/src/main/java/hudson/model/Job.java +++ b/core/src/main/java/hudson/model/Job.java @@ -96,6 +96,8 @@ import java.io.*; import java.net.URLEncoder; import java.util.*; import java.util.List; +import javax.annotation.CheckForNull; +import javax.annotation.Nonnull; import static javax.servlet.http.HttpServletResponse.*; import jenkins.model.lazy.LazyBuildMixIn; @@ -356,7 +358,7 @@ public abstract class Job, RunT extends Run,RunT extends Runnull. + * @return the map with the environmental variables. * @since 1.305 */ - public EnvVars getEnvironment(TaskListener listener) throws IOException, InterruptedException { + public @Nonnull EnvVars getEnvironment(@Nonnull TaskListener listener) throws IOException, InterruptedException { Computer c = Computer.currentComputer(); Node n = c==null ? null : c.getNode(); diff --git a/core/src/main/java/hudson/slaves/NodeProperty.java b/core/src/main/java/hudson/slaves/NodeProperty.java index 828f0ac9055f279f44c57f8edc2b042dfe6735ef..42da21efeb8fcfa860b91f74e15d116e94733123 100644 --- a/core/src/main/java/hudson/slaves/NodeProperty.java +++ b/core/src/main/java/hudson/slaves/NodeProperty.java @@ -39,6 +39,7 @@ import hudson.model.BuildListener; import hudson.model.Environment; import jenkins.model.Jenkins; import hudson.model.Node; +import hudson.model.Queue; import hudson.model.Queue.Task; import net.sf.json.JSONObject; import org.kohsuke.stapler.StaplerRequest; @@ -47,6 +48,7 @@ import java.io.File; import java.io.IOException; import java.util.List; import java.util.Map; +import javax.annotation.Nonnull; /** * Extensible property of {@link Node}. @@ -161,7 +163,7 @@ public abstract class NodeProperty implements ReconfigurableDesc * * @since 1.489 */ - public void buildEnvVars(EnvVars env, TaskListener listener) throws IOException,InterruptedException { + public void buildEnvVars(@Nonnull EnvVars env, @Nonnull TaskListener listener) throws IOException,InterruptedException { // default is no-op }