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

Use findbugs annotations (as JSR 305 is dormant) #397

Merged
merged 1 commit into from
Jan 20, 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 @@ -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
Expand Down Expand Up @@ -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)
{
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/hudson/plugins/jira/CredentialsHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<StandardUsernamePasswordCredentials> credentials = CredentialsMatchers.filter(
CredentialsProvider.lookupCredentials(
StandardUsernamePasswordCredentials.class,
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/hudson/plugins/jira/JiraBuildAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,7 +21,7 @@ public class JiraBuildAction implements RunAction2 {
private final HashSet<JiraIssue> issues;
private transient Run<?, ?> owner;

public JiraBuildAction(@Nonnull Set<JiraIssue> issues) {
public JiraBuildAction(@NonNull Set<JiraIssue> issues) {
this.issues = new HashSet<>(issues);
}

Expand All @@ -33,7 +33,7 @@ public JiraBuildAction(@Nonnull Set<JiraIssue> issues) {
* @param issues the Jira issues
*/
@Deprecated
public JiraBuildAction(Run<?, ?> owner, @Nonnull Set<JiraIssue> issues) {
public JiraBuildAction(Run<?, ?> owner, @NonNull Set<JiraIssue> issues) {
this(issues);
// the owner will be set by #onAttached(hudson.model.Run)
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/hudson/plugins/jira/JiraFolderProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -68,7 +68,7 @@ public static List<JiraSite> getSitesFromFolders(ItemGroup itemGroup) {
@Extension
public static class DescriptorImpl extends AbstractFolderPropertyDescriptor {

@Nonnull
@NonNull
@Override
public String getDisplayName() {
return Messages.JiraFolderProperty_DisplayName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
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;

@Extension
public class JiraGlobalConfiguration extends GlobalConfiguration {

@Nonnull
@NonNull
public static JiraGlobalConfiguration get() {
return (JiraGlobalConfiguration) Jenkins.get().getDescriptorOrDie(JiraGlobalConfiguration.class);
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/hudson/plugins/jira/JiraJobAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/hudson/plugins/jira/JiraRestService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -279,7 +279,7 @@ public BasicIssue createIssue(String projectKey, String description, String assi
}

public BasicIssue createIssue(String projectKey, String description, String assignee, Iterable<String> components, String summary,
@Nonnull Long issueTypeId, @Nullable Long priorityId) {
@NonNull Long issueTypeId, @Nullable Long priorityId) {
IssueInputBuilder builder = new IssueInputBuilder();
builder.setProjectKey(projectKey)
.setDescription(description)
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/hudson/plugins/jira/JiraSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<String> components, String summary, @Nonnull Long issueTypeId, @Nullable Long priorityId) {
public Issue createIssue(String projectKey, String description, String assignee, Iterable<String> 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());
}
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/hudson/plugins/jira/JiraSite.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/hudson/plugins/jira/model/JiraIssue.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
}

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/hudson/plugins/jira/pipeline/CommentStep.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -28,6 +28,6 @@ public abstract class AbstractIssueSelector extends AbstractDescribableImpl<Abst
* @param listener Current's run listener.
* @return Set of ids of issues which should be updated.
*/
public abstract Set<String> findIssueIds(@Nonnull Run<?, ?> run, @Nonnull JiraSite site, @Nonnull TaskListener listener);
public abstract Set<String> findIssueIds(@NonNull Run<?, ?> run, @NonNull JiraSite site, @NonNull TaskListener listener);

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -42,8 +42,8 @@ public DefaultIssueSelector() {
* See {@link #addIssuesRecursive(Run, JiraSite, TaskListener, Set)}
*/
@Override
public Set<String> findIssueIds(@Nonnull final Run<?, ?> run, @Nonnull final JiraSite site,
@Nonnull final TaskListener listener) {
public Set<String> findIssueIds(@NonNull final Run<?, ?> run, @NonNull final JiraSite site,
@NonNull final TaskListener listener) {
HashSet<String> issuesIds = new LinkedHashSet<>();
addIssuesRecursive(run, site, listener, issuesIds);
return issuesIds;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading