From 7c349477f24b055adc098400156c208d44468459 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Fri, 31 Dec 2021 10:56:09 -0800 Subject: [PATCH] EOL JSR 305 --- .../DefaultHttpClientFactory.java | 4 ++-- .../hudson/plugins/jira/CredentialsHelper.java | 8 ++++---- .../hudson/plugins/jira/JiraBuildAction.java | 6 +++--- .../plugins/jira/JiraFolderProperty.java | 4 ++-- .../plugins/jira/JiraGlobalConfiguration.java | 4 ++-- .../hudson/plugins/jira/JiraJobAction.java | 6 +++--- .../plugins/jira/JiraProjectProperty.java | 2 +- .../hudson/plugins/jira/JiraRestService.java | 6 +++--- .../java/hudson/plugins/jira/JiraSession.java | 6 +++--- .../java/hudson/plugins/jira/JiraSite.java | 18 +++++++++--------- .../jira/extension/ExtendedVersion.java | 2 +- .../jira/extension/ExtendedVersionInput.java | 2 +- .../hudson/plugins/jira/model/JiraIssue.java | 4 ++-- .../plugins/jira/pipeline/CommentStep.java | 6 +++--- .../jira/pipeline/IssueSelectorStep.java | 4 ++-- .../jira/pipeline/SearchIssuesStep.java | 6 +++--- .../jira/selector/AbstractIssueSelector.java | 4 ++-- .../jira/selector/DefaultIssueSelector.java | 6 +++--- .../jira/selector/ExplicitIssueSelector.java | 2 +- .../ApacheAsyncHttpClientTest.java | 16 ++++++++-------- .../jira/JiraCreateIssueNotifierTest.java | 2 +- 21 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/main/java/com/atlassian/httpclient/apache/httpcomponents/DefaultHttpClientFactory.java b/src/main/java/com/atlassian/httpclient/apache/httpcomponents/DefaultHttpClientFactory.java index ff536080b..96809a152 100644 --- a/src/main/java/com/atlassian/httpclient/apache/httpcomponents/DefaultHttpClientFactory.java +++ b/src/main/java/com/atlassian/httpclient/apache/httpcomponents/DefaultHttpClientFactory.java @@ -8,7 +8,7 @@ import com.atlassian.sal.api.executor.ThreadLocalContextManager; import org.springframework.beans.factory.DisposableBean; -import javax.annotation.Nonnull; +import edu.umd.cs.findbugs.annotations.NonNull; import java.util.Objects; public final class DefaultHttpClientFactory implements HttpClientFactory, DisposableBean @@ -39,7 +39,7 @@ public HttpClient create(HttpClientOptions options, ThreadLocalContextManager th } @Override - public void dispose(@Nonnull final HttpClient httpClient) throws Exception + public void dispose(@NonNull final HttpClient httpClient) throws Exception { if (httpClient instanceof ApacheAsyncHttpClient) { diff --git a/src/main/java/hudson/plugins/jira/CredentialsHelper.java b/src/main/java/hudson/plugins/jira/CredentialsHelper.java index 917c3635c..efdc17eac 100644 --- a/src/main/java/hudson/plugins/jira/CredentialsHelper.java +++ b/src/main/java/hudson/plugins/jira/CredentialsHelper.java @@ -7,9 +7,9 @@ import java.util.logging.Level; import java.util.logging.Logger; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import edu.umd.cs.findbugs.annotations.CheckForNull; +import edu.umd.cs.findbugs.annotations.NonNull; +import edu.umd.cs.findbugs.annotations.Nullable; import com.cloudbees.plugins.credentials.CredentialsMatchers; import com.cloudbees.plugins.credentials.CredentialsProvider; @@ -58,7 +58,7 @@ protected static StandardUsernamePasswordCredentials lookupSystemCredentials(@Ch ); } - protected static StandardUsernamePasswordCredentials migrateCredentials(@Nonnull String username, String password, @CheckForNull URL url) { + protected static StandardUsernamePasswordCredentials migrateCredentials(@NonNull String username, String password, @CheckForNull URL url) { List credentials = CredentialsMatchers.filter( CredentialsProvider.lookupCredentials( StandardUsernamePasswordCredentials.class, diff --git a/src/main/java/hudson/plugins/jira/JiraBuildAction.java b/src/main/java/hudson/plugins/jira/JiraBuildAction.java index 00193860c..af1d5f272 100644 --- a/src/main/java/hudson/plugins/jira/JiraBuildAction.java +++ b/src/main/java/hudson/plugins/jira/JiraBuildAction.java @@ -5,7 +5,7 @@ import java.net.URL; import java.util.HashSet; import java.util.Set; -import javax.annotation.Nonnull; +import edu.umd.cs.findbugs.annotations.NonNull; import jenkins.model.RunAction2; import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.ExportedBean; @@ -21,7 +21,7 @@ public class JiraBuildAction implements RunAction2 { private final HashSet issues; private transient Run owner; - public JiraBuildAction(@Nonnull Set issues) { + public JiraBuildAction(@NonNull Set issues) { this.issues = new HashSet<>(issues); } @@ -33,7 +33,7 @@ public JiraBuildAction(@Nonnull Set issues) { * @param issues the Jira issues */ @Deprecated - public JiraBuildAction(Run owner, @Nonnull Set issues) { + public JiraBuildAction(Run owner, @NonNull Set issues) { this(issues); // the owner will be set by #onAttached(hudson.model.Run) } diff --git a/src/main/java/hudson/plugins/jira/JiraFolderProperty.java b/src/main/java/hudson/plugins/jira/JiraFolderProperty.java index 948bd46f9..c2f41d6df 100644 --- a/src/main/java/hudson/plugins/jira/JiraFolderProperty.java +++ b/src/main/java/hudson/plugins/jira/JiraFolderProperty.java @@ -8,7 +8,7 @@ import org.kohsuke.stapler.DataBoundConstructor; import org.kohsuke.stapler.DataBoundSetter; -import javax.annotation.Nonnull; +import edu.umd.cs.findbugs.annotations.NonNull; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -68,7 +68,7 @@ public static List getSitesFromFolders(ItemGroup itemGroup) { @Extension public static class DescriptorImpl extends AbstractFolderPropertyDescriptor { - @Nonnull + @NonNull @Override public String getDisplayName() { return Messages.JiraFolderProperty_DisplayName(); diff --git a/src/main/java/hudson/plugins/jira/JiraGlobalConfiguration.java b/src/main/java/hudson/plugins/jira/JiraGlobalConfiguration.java index 323f49c21..39e4ba77b 100644 --- a/src/main/java/hudson/plugins/jira/JiraGlobalConfiguration.java +++ b/src/main/java/hudson/plugins/jira/JiraGlobalConfiguration.java @@ -3,7 +3,7 @@ import hudson.Extension; import hudson.util.PersistedList; import java.util.List; -import javax.annotation.Nonnull; +import edu.umd.cs.findbugs.annotations.NonNull; import jenkins.model.GlobalConfiguration; import jenkins.model.Jenkins; import org.kohsuke.stapler.DataBoundSetter; @@ -11,7 +11,7 @@ @Extension public class JiraGlobalConfiguration extends GlobalConfiguration { - @Nonnull + @NonNull public static JiraGlobalConfiguration get() { return (JiraGlobalConfiguration) Jenkins.get().getDescriptorOrDie(JiraGlobalConfiguration.class); } diff --git a/src/main/java/hudson/plugins/jira/JiraJobAction.java b/src/main/java/hudson/plugins/jira/JiraJobAction.java index cfbd9f3bb..7e343ade6 100644 --- a/src/main/java/hudson/plugins/jira/JiraJobAction.java +++ b/src/main/java/hudson/plugins/jira/JiraJobAction.java @@ -13,8 +13,8 @@ import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.ExportedBean; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import edu.umd.cs.findbugs.annotations.NonNull; +import edu.umd.cs.findbugs.annotations.Nullable; import java.io.IOException; import java.net.URL; import java.net.URLDecoder; @@ -70,7 +70,7 @@ public String getServerURL() { * @param site to fetch issue data * @throws IOException if something goes wrong fetching the Jira issue */ - public static void setAction(@Nonnull Job job, @Nonnull JiraSite site) throws IOException { + public static void setAction(@NonNull Job job, @NonNull JiraSite site) throws IOException { // If there is already a action set then skip if (job.getAction(JiraJobAction.class) != null) { return; diff --git a/src/main/java/hudson/plugins/jira/JiraProjectProperty.java b/src/main/java/hudson/plugins/jira/JiraProjectProperty.java index 731278336..8f190832a 100644 --- a/src/main/java/hudson/plugins/jira/JiraProjectProperty.java +++ b/src/main/java/hudson/plugins/jira/JiraProjectProperty.java @@ -11,7 +11,7 @@ import hudson.util.ListBoxModel; import java.util.List; import java.util.stream.Stream; -import javax.annotation.Nullable; +import edu.umd.cs.findbugs.annotations.Nullable; import jenkins.model.Jenkins; import org.kohsuke.stapler.AncestorInPath; import org.kohsuke.stapler.DataBoundConstructor; diff --git a/src/main/java/hudson/plugins/jira/JiraRestService.java b/src/main/java/hudson/plugins/jira/JiraRestService.java index 1a33e790c..11e8d230d 100644 --- a/src/main/java/hudson/plugins/jira/JiraRestService.java +++ b/src/main/java/hudson/plugins/jira/JiraRestService.java @@ -54,8 +54,8 @@ import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import edu.umd.cs.findbugs.annotations.NonNull; +import edu.umd.cs.findbugs.annotations.Nullable; import java.io.UnsupportedEncodingException; import java.net.URI; import java.util.ArrayList; @@ -279,7 +279,7 @@ public BasicIssue createIssue(String projectKey, String description, String assi } public BasicIssue createIssue(String projectKey, String description, String assignee, Iterable components, String summary, - @Nonnull Long issueTypeId, @Nullable Long priorityId) { + @NonNull Long issueTypeId, @Nullable Long priorityId) { IssueInputBuilder builder = new IssueInputBuilder(); builder.setProjectKey(projectKey) .setDescription(description) diff --git a/src/main/java/hudson/plugins/jira/JiraSession.java b/src/main/java/hudson/plugins/jira/JiraSession.java index 61f407a43..e5f5c78bd 100644 --- a/src/main/java/hudson/plugins/jira/JiraSession.java +++ b/src/main/java/hudson/plugins/jira/JiraSession.java @@ -13,8 +13,8 @@ import hudson.plugins.jira.model.JiraIssueField; import org.apache.commons.lang.StringUtils; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import edu.umd.cs.findbugs.annotations.NonNull; +import edu.umd.cs.findbugs.annotations.Nullable; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -408,7 +408,7 @@ public Issue createIssue(String projectKey, String description, String assignee, return createIssue(projectKey, description, assignee, components, summary, null, null); } - public Issue createIssue(String projectKey, String description, String assignee, Iterable components, String summary, @Nonnull Long issueTypeId, @Nullable Long priorityId) { + public Issue createIssue(String projectKey, String description, String assignee, Iterable components, String summary, @NonNull Long issueTypeId, @Nullable Long priorityId) { final BasicIssue basicIssue = service.createIssue(projectKey, description, assignee, components, summary, issueTypeId, priorityId); return service.getIssue(basicIssue.getKey()); } diff --git a/src/main/java/hudson/plugins/jira/JiraSite.java b/src/main/java/hudson/plugins/jira/JiraSite.java index bcd08b8a1..6644cd5db 100644 --- a/src/main/java/hudson/plugins/jira/JiraSite.java +++ b/src/main/java/hudson/plugins/jira/JiraSite.java @@ -45,9 +45,9 @@ import org.kohsuke.stapler.QueryParameter; import org.kohsuke.stapler.interceptor.RequirePOST; -import javax.annotation.CheckForNull; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import edu.umd.cs.findbugs.annotations.CheckForNull; +import edu.umd.cs.findbugs.annotations.NonNull; +import edu.umd.cs.findbugs.annotations.Nullable; import javax.annotation.PreDestroy; import javax.servlet.ServletException; import java.io.File; @@ -753,37 +753,37 @@ public String getBaseUrl() { /** * We'll always have an absolute URL as a client. */ - @Nonnull + @NonNull @Override public String getBaseUrl( UrlMode urlMode) { return baseUrl; } - @Nonnull + @NonNull @Override public String getDisplayName() { return "Atlassian Jira Rest Java Client"; } - @Nonnull + @NonNull @Override public String getPlatformId() { return ApplicationProperties.PLATFORM_JIRA; } - @Nonnull + @NonNull @Override public String getVersion() { return ""; } - @Nonnull + @NonNull @Override public Date getBuildDate() { throw new UnsupportedOperationException(); } - @Nonnull + @NonNull @Override public String getBuildNumber() { return String.valueOf(0); diff --git a/src/main/java/hudson/plugins/jira/extension/ExtendedVersion.java b/src/main/java/hudson/plugins/jira/extension/ExtendedVersion.java index b98e5f5ea..f772446cb 100644 --- a/src/main/java/hudson/plugins/jira/extension/ExtendedVersion.java +++ b/src/main/java/hudson/plugins/jira/extension/ExtendedVersion.java @@ -3,7 +3,7 @@ import com.atlassian.jira.rest.client.api.domain.Version; import org.joda.time.DateTime; -import javax.annotation.Nullable; +import edu.umd.cs.findbugs.annotations.Nullable; import java.net.URI; public class ExtendedVersion extends Version { diff --git a/src/main/java/hudson/plugins/jira/extension/ExtendedVersionInput.java b/src/main/java/hudson/plugins/jira/extension/ExtendedVersionInput.java index caa201269..202b2c719 100644 --- a/src/main/java/hudson/plugins/jira/extension/ExtendedVersionInput.java +++ b/src/main/java/hudson/plugins/jira/extension/ExtendedVersionInput.java @@ -6,7 +6,7 @@ import org.apache.commons.lang3.builder.ToStringBuilder; import org.joda.time.DateTime; -import javax.annotation.Nullable; +import edu.umd.cs.findbugs.annotations.Nullable; public class ExtendedVersionInput extends VersionInput { private final DateTime startDate; diff --git a/src/main/java/hudson/plugins/jira/model/JiraIssue.java b/src/main/java/hudson/plugins/jira/model/JiraIssue.java index bee2f069e..cb736d8de 100644 --- a/src/main/java/hudson/plugins/jira/model/JiraIssue.java +++ b/src/main/java/hudson/plugins/jira/model/JiraIssue.java @@ -5,7 +5,7 @@ import org.kohsuke.stapler.export.Exported; import org.kohsuke.stapler.export.ExportedBean; -import javax.annotation.Nonnull; +import edu.umd.cs.findbugs.annotations.NonNull; /** * One Jira issue. @@ -47,7 +47,7 @@ public JiraIssue(Issue issue) { this(issue.getKey(), issue.getSummary()); } - public int compareTo(@Nonnull JiraIssue that) { + public int compareTo(@NonNull JiraIssue that) { return this.id.compareTo(that.id); } diff --git a/src/main/java/hudson/plugins/jira/pipeline/CommentStep.java b/src/main/java/hudson/plugins/jira/pipeline/CommentStep.java index 6df26530e..8ee6fe793 100644 --- a/src/main/java/hudson/plugins/jira/pipeline/CommentStep.java +++ b/src/main/java/hudson/plugins/jira/pipeline/CommentStep.java @@ -17,7 +17,7 @@ import java.util.HashSet; import java.util.Set; -import javax.annotation.Nonnull; +import edu.umd.cs.findbugs.annotations.NonNull; /** * Simple add comment step. @@ -31,7 +31,7 @@ public class CommentStep extends Step { public final String body; @DataBoundConstructor - public CommentStep(@Nonnull String issueKey, @Nonnull String body) { + public CommentStep(@NonNull String issueKey, @NonNull String body) { this.issueKey = issueKey; this.body = body; } @@ -79,7 +79,7 @@ public static class CommentStepExecution extends SynchronousNonBlockingStepExecu private final transient CommentStep step; - protected CommentStepExecution(CommentStep step, @Nonnull StepContext context) { + protected CommentStepExecution(CommentStep step, @NonNull StepContext context) { super(context); this.step = step; } diff --git a/src/main/java/hudson/plugins/jira/pipeline/IssueSelectorStep.java b/src/main/java/hudson/plugins/jira/pipeline/IssueSelectorStep.java index c50bac0bd..4dae51908 100644 --- a/src/main/java/hudson/plugins/jira/pipeline/IssueSelectorStep.java +++ b/src/main/java/hudson/plugins/jira/pipeline/IssueSelectorStep.java @@ -6,7 +6,7 @@ import java.util.Optional; import java.util.Set; -import javax.annotation.Nonnull; +import edu.umd.cs.findbugs.annotations.NonNull; import hudson.model.Descriptor; import hudson.model.Result; @@ -84,7 +84,7 @@ public static class IssueSelectorStepExecution extends SynchronousNonBlockingSte private final transient IssueSelectorStep step; - protected IssueSelectorStepExecution(IssueSelectorStep step, @Nonnull StepContext context) { + protected IssueSelectorStepExecution(IssueSelectorStep step, @NonNull StepContext context) { super(context); this.step = step; } diff --git a/src/main/java/hudson/plugins/jira/pipeline/SearchIssuesStep.java b/src/main/java/hudson/plugins/jira/pipeline/SearchIssuesStep.java index 013730220..029327149 100644 --- a/src/main/java/hudson/plugins/jira/pipeline/SearchIssuesStep.java +++ b/src/main/java/hudson/plugins/jira/pipeline/SearchIssuesStep.java @@ -15,7 +15,7 @@ import org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution; import org.kohsuke.stapler.DataBoundConstructor; -import javax.annotation.Nonnull; +import edu.umd.cs.findbugs.annotations.NonNull; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; @@ -32,7 +32,7 @@ public class SearchIssuesStep extends Step { public final String jql; @DataBoundConstructor - public SearchIssuesStep(@Nonnull String jql) { + public SearchIssuesStep(@NonNull String jql) { this.jql = jql; } @@ -75,7 +75,7 @@ public static class SearchStepExecution extends SynchronousNonBlockingStepExecut private final transient SearchIssuesStep step; - protected SearchStepExecution(SearchIssuesStep step, @Nonnull StepContext context) { + protected SearchStepExecution(SearchIssuesStep step, @NonNull StepContext context) { super(context); this.step = step; } diff --git a/src/main/java/hudson/plugins/jira/selector/AbstractIssueSelector.java b/src/main/java/hudson/plugins/jira/selector/AbstractIssueSelector.java index 7ec0fe677..13b401b84 100644 --- a/src/main/java/hudson/plugins/jira/selector/AbstractIssueSelector.java +++ b/src/main/java/hudson/plugins/jira/selector/AbstractIssueSelector.java @@ -2,7 +2,7 @@ import java.util.Set; -import javax.annotation.Nonnull; +import edu.umd.cs.findbugs.annotations.NonNull; import hudson.ExtensionPoint; import hudson.model.AbstractDescribableImpl; @@ -28,6 +28,6 @@ public abstract class AbstractIssueSelector extends AbstractDescribableImpl findIssueIds(@Nonnull Run run, @Nonnull JiraSite site, @Nonnull TaskListener listener); + public abstract Set findIssueIds(@NonNull Run run, @NonNull JiraSite site, @NonNull TaskListener listener); } diff --git a/src/main/java/hudson/plugins/jira/selector/DefaultIssueSelector.java b/src/main/java/hudson/plugins/jira/selector/DefaultIssueSelector.java index b9c780c92..2a040688d 100644 --- a/src/main/java/hudson/plugins/jira/selector/DefaultIssueSelector.java +++ b/src/main/java/hudson/plugins/jira/selector/DefaultIssueSelector.java @@ -9,7 +9,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.annotation.Nonnull; +import edu.umd.cs.findbugs.annotations.NonNull; import org.apache.commons.lang.StringUtils; import org.kohsuke.stapler.DataBoundConstructor; @@ -42,8 +42,8 @@ public DefaultIssueSelector() { * See {@link #addIssuesRecursive(Run, JiraSite, TaskListener, Set)} */ @Override - public Set findIssueIds(@Nonnull final Run run, @Nonnull final JiraSite site, - @Nonnull final TaskListener listener) { + public Set findIssueIds(@NonNull final Run run, @NonNull final JiraSite site, + @NonNull final TaskListener listener) { HashSet issuesIds = new LinkedHashSet<>(); addIssuesRecursive(run, site, listener, issuesIds); return issuesIds; diff --git a/src/main/java/hudson/plugins/jira/selector/ExplicitIssueSelector.java b/src/main/java/hudson/plugins/jira/selector/ExplicitIssueSelector.java index 50a4f1a77..96c103184 100644 --- a/src/main/java/hudson/plugins/jira/selector/ExplicitIssueSelector.java +++ b/src/main/java/hudson/plugins/jira/selector/ExplicitIssueSelector.java @@ -9,7 +9,7 @@ import org.apache.commons.lang.StringUtils; import org.kohsuke.stapler.DataBoundConstructor; -import javax.annotation.CheckForNull; +import edu.umd.cs.findbugs.annotations.CheckForNull; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; diff --git a/src/test/java/com/atlassian/httpclient/apache/httpcomponents/ApacheAsyncHttpClientTest.java b/src/test/java/com/atlassian/httpclient/apache/httpcomponents/ApacheAsyncHttpClientTest.java index 8c3abb211..7207a1a97 100644 --- a/src/test/java/com/atlassian/httpclient/apache/httpcomponents/ApacheAsyncHttpClientTest.java +++ b/src/test/java/com/atlassian/httpclient/apache/httpcomponents/ApacheAsyncHttpClientTest.java @@ -24,8 +24,8 @@ import org.junit.Test; import org.jvnet.hudson.test.JenkinsRule; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; +import edu.umd.cs.findbugs.annotations.NonNull; +import edu.umd.cs.findbugs.annotations.Nullable; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -254,42 +254,42 @@ public String getBaseUrl() return null; } - @Nonnull + @NonNull @Override public String getBaseUrl( UrlMode urlMode ) { return null; } - @Nonnull + @NonNull @Override public String getDisplayName() { return "Foo"; } - @Nonnull + @NonNull @Override public String getPlatformId() { return null; } - @Nonnull + @NonNull @Override public String getVersion() { return "1"; } - @Nonnull + @NonNull @Override public Date getBuildDate() { return null; } - @Nonnull + @NonNull @Override public String getBuildNumber() { diff --git a/src/test/java/hudson/plugins/jira/JiraCreateIssueNotifierTest.java b/src/test/java/hudson/plugins/jira/JiraCreateIssueNotifierTest.java index 6fbaac9bf..dc9a97b4b 100644 --- a/src/test/java/hudson/plugins/jira/JiraCreateIssueNotifierTest.java +++ b/src/test/java/hudson/plugins/jira/JiraCreateIssueNotifierTest.java @@ -33,7 +33,7 @@ import org.mockito.Mockito; import org.mockito.mock.SerializableMode; -import javax.annotation.Nullable; +import edu.umd.cs.findbugs.annotations.Nullable; import java.io.File; import java.io.IOException; import java.io.PrintStream;