Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove JSR 305 #249

Merged
merged 2 commits into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package org.jenkinsci.plugins.docker.workflow;

import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.EnvVars;
import java.io.IOException;
import java.util.logging.Level;
Expand All @@ -48,7 +49,7 @@ protected KeyMaterialFactory newKeyMaterialFactory() throws IOException, Interru
throw new AssertionError();
}

@Override public final void stop(Throwable cause) throws Exception {
@Override public final void stop(@NonNull Throwable cause) throws Exception {
// should not need to do anything special
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package org.jenkinsci.plugins.docker.workflow;

import edu.umd.cs.findbugs.annotations.NonNull;
import groovy.lang.Binding;
import hudson.Extension;
import org.jenkinsci.plugins.workflow.cps.CpsScript;
Expand All @@ -33,10 +34,12 @@
*/
@Extension public class DockerDSL extends GlobalVariable {

@NonNull
@Override public String getName() {
return "docker";
}

@NonNull
@Override public Object getValue(CpsScript script) throws Exception {
Binding binding = script.getBinding();
Object docker;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.Map;

import com.google.inject.Inject;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.AbortException;
import hudson.EnvVars;
import hudson.Extension;
Expand Down Expand Up @@ -133,6 +134,7 @@ public DescriptorImpl() {
return "dockerFingerprintFrom";
}

@NonNull
@Override public String getDisplayName() {
return "Record trace of a Docker image used in FROM";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package org.jenkinsci.plugins.docker.workflow;

import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.BulkChange;
import hudson.Extension;
import hudson.model.InvisibleAction;
Expand Down Expand Up @@ -70,6 +71,7 @@ static void add(String image, Run<?,?> run) throws IOException {

@Extension public static final class ExtractorImpl extends DockerImageExtractor {

@NonNull
@Override public Collection<String> getDockerImagesUsedByJob(Job<?,?> job) {
Run<?,?> build = job.getLastCompletedBuild();
if (build != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
*/
package org.jenkinsci.plugins.docker.workflow;

import javax.annotation.Nonnull;
import edu.umd.cs.findbugs.annotations.NonNull;

import java.io.Serializable;

/**
Expand All @@ -43,7 +44,7 @@ public class ImageNameTokens implements Serializable {
public final String userAndRepo;
public final String tag;

public ImageNameTokens(@Nonnull String name) {
public ImageNameTokens(@NonNull String name) {
int tagIdx = name.lastIndexOf(':');
if (tagIdx != -1) {
this.userAndRepo = name.substring(0, tagIdx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
package org.jenkinsci.plugins.docker.workflow;

import com.google.common.collect.ImmutableSet;
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.EnvVars;
import hudson.Extension;
import hudson.FilePath;
Expand All @@ -36,10 +38,9 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeMap;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import org.jenkinsci.plugins.docker.commons.credentials.DockerRegistryEndpoint;
import org.jenkinsci.plugins.docker.commons.credentials.KeyMaterialFactory;
import org.jenkinsci.plugins.docker.commons.tools.DockerTool;
Expand All @@ -53,18 +54,19 @@

public class RegistryEndpointStep extends Step {

private final @Nonnull DockerRegistryEndpoint registry;
private final @NonNull DockerRegistryEndpoint registry;
private @CheckForNull String toolName;

@DataBoundConstructor public RegistryEndpointStep(@Nonnull DockerRegistryEndpoint registry) {
assert registry != null;
this.registry = registry;
@DataBoundConstructor public RegistryEndpointStep(@NonNull DockerRegistryEndpoint registry) {
this.registry = Objects.requireNonNull(registry, "registry must not be null");;
}


@NonNull
public DockerRegistryEndpoint getRegistry() {
return registry;
}

@CheckForNull
public String getToolName() {
return toolName;
}
Expand Down Expand Up @@ -111,6 +113,7 @@ public static class Execution extends AbstractEndpointStepExecution {
return "withDockerRegistry";
}

@NonNull
@Override public String getDisplayName() {
return "Sets up Docker registry endpoint";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package org.jenkinsci.plugins.docker.workflow;

import edu.umd.cs.findbugs.annotations.NonNull;
import org.jenkinsci.plugins.docker.workflow.client.DockerClient;
import com.google.inject.Inject;
import hudson.EnvVars;
Expand Down Expand Up @@ -98,6 +99,7 @@ public DescriptorImpl() {
return "dockerFingerprintRun";
}

@NonNull
@Override public String getDisplayName() {
return "Record trace of a Docker image run in a container";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@
package org.jenkinsci.plugins.docker.workflow;

import com.google.common.collect.ImmutableSet;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.Extension;
import hudson.FilePath;
import hudson.model.Run;
import java.io.IOException;
import java.util.Objects;
import java.util.Set;
import javax.annotation.Nonnull;
import org.jenkinsci.plugins.docker.commons.credentials.DockerServerEndpoint;
import org.jenkinsci.plugins.docker.commons.credentials.KeyMaterialFactory;
import org.jenkinsci.plugins.workflow.steps.Step;
Expand All @@ -40,13 +41,13 @@

public class ServerEndpointStep extends Step {

private final @Nonnull DockerServerEndpoint server;
private final @NonNull DockerServerEndpoint server;

@DataBoundConstructor public ServerEndpointStep(@Nonnull DockerServerEndpoint server) {
assert server != null;
this.server = server;
@DataBoundConstructor public ServerEndpointStep(@NonNull DockerServerEndpoint server) {
this.server = Objects.requireNonNull(server, "server must not be null");;
}


@NonNull
public DockerServerEndpoint getServer() {
return server;
}
Expand Down Expand Up @@ -86,6 +87,7 @@ public static class Execution extends AbstractEndpointStepExecution {
return "withDockerServer";
}

@NonNull
@Override public String getDisplayName() {
return "Sets up Docker server endpoint";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

import com.google.common.base.Optional;
import com.google.inject.Inject;
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.AbortException;
import hudson.EnvVars;
import hudson.Extension;
Expand Down Expand Up @@ -63,8 +65,6 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.Serializable;
Expand All @@ -77,14 +77,15 @@
public class WithContainerStep extends AbstractStepImpl {

private static final Logger LOGGER = Logger.getLogger(WithContainerStep.class.getName());
private final @Nonnull String image;
private final @NonNull String image;
private String args;
private String toolName;

@DataBoundConstructor public WithContainerStep(@Nonnull String image) {
@DataBoundConstructor public WithContainerStep(@NonNull String image) {
this.image = image;
}


@NonNull
public String getImage() {
return image;
}
Expand Down Expand Up @@ -228,7 +229,7 @@ private static FilePath tempDir(FilePath ws) {
return ws.sibling(ws.getName() + System.getProperty(WorkspaceList.class.getName(), "@") + "tmp");
}

@Override public void stop(@Nonnull Throwable cause) throws Exception {
@Override public void stop(@NonNull Throwable cause) throws Exception {
if (container != null) {
LOGGER.log(Level.FINE, "stopping container " + container, cause);
destroy(container, launcher, getContext().get(Node.class), env, toolName);
Expand All @@ -247,7 +248,7 @@ private static class Decorator extends LauncherDecorator implements Serializable
private final boolean hasEnv;
private final boolean hasWorkdir;

Decorator(String container, EnvVars envHost, String ws, String toolName, VersionNumber dockerVersion) {
Decorator(String container, EnvVars envHost, String ws, @CheckForNull String toolName, VersionNumber dockerVersion) {
this.container = container;
this.envHost = Util.mapToEnv(envHost);
this.ws = ws;
Expand All @@ -256,7 +257,8 @@ private static class Decorator extends LauncherDecorator implements Serializable
this.hasWorkdir = dockerVersion != null && dockerVersion.compareTo(new VersionNumber("17.12")) >= 0;
}

@Override public Launcher decorate(final Launcher launcher, final Node node) {
@NonNull
@Override public Launcher decorate(@NonNull final Launcher launcher, @NonNull final Node node) {
return new Launcher.DecoratedLauncher(launcher) {
@Override public Proc launch(Launcher.ProcStarter starter) throws IOException {
String executable;
Expand Down Expand Up @@ -414,6 +416,7 @@ public DescriptorImpl() {
return "withDockerContainer";
}

@NonNull
@Override public String getDisplayName() {
return "Run build steps inside a Docker container";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
Expand Down
Loading