From 48134f694dbf86f4b267acbd226037636bf7cd87 Mon Sep 17 00:00:00 2001 From: Mark Waite Date: Wed, 8 May 2024 06:10:52 -0600 Subject: [PATCH] Replace JSR-305 annotations with spotbugs annotations (#329) --- .../java/com/datapipe/jenkins/vault/VaultBindingStep.java | 4 ++-- .../common/VaultCertificateCredentialsBinding.java | 4 ++-- .../credentials/common/VaultStringCredentialBinding.java | 8 ++++---- .../common/VaultUsernamePasswordCredentialBinding.java | 4 ++-- .../jenkins/vault/VaultBindingStepWithMockAccessor.java | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/datapipe/jenkins/vault/VaultBindingStep.java b/src/main/java/com/datapipe/jenkins/vault/VaultBindingStep.java index 9e64d477..0a674e96 100644 --- a/src/main/java/com/datapipe/jenkins/vault/VaultBindingStep.java +++ b/src/main/java/com/datapipe/jenkins/vault/VaultBindingStep.java @@ -28,6 +28,7 @@ import com.datapipe.jenkins.vault.model.VaultSecret; import com.google.common.annotations.VisibleForTesting; import edu.umd.cs.findbugs.annotations.CheckForNull; +import edu.umd.cs.findbugs.annotations.NonNull; import hudson.EnvVars; import hudson.Extension; import hudson.console.ConsoleLogFilter; @@ -43,7 +44,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import javax.annotation.Nonnull; import org.jenkinsci.plugins.workflow.steps.BodyExecutionCallback.TailCall; import org.jenkinsci.plugins.workflow.steps.BodyInvoker; import org.jenkinsci.plugins.workflow.steps.EnvironmentExpander; @@ -182,7 +182,7 @@ public String getFunctionName() { return "withVault"; } - @Nonnull + @NonNull @Override public String getDisplayName() { return "Vault Plugin"; diff --git a/src/main/java/com/datapipe/jenkins/vault/credentials/common/VaultCertificateCredentialsBinding.java b/src/main/java/com/datapipe/jenkins/vault/credentials/common/VaultCertificateCredentialsBinding.java index 695f5578..f282530a 100644 --- a/src/main/java/com/datapipe/jenkins/vault/credentials/common/VaultCertificateCredentialsBinding.java +++ b/src/main/java/com/datapipe/jenkins/vault/credentials/common/VaultCertificateCredentialsBinding.java @@ -1,5 +1,6 @@ package com.datapipe.jenkins.vault.credentials.common; +import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.Nullable; import hudson.Extension; import hudson.FilePath; @@ -13,7 +14,6 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import javax.annotation.Nonnull; import org.jenkinsci.plugins.credentialsbinding.BindingDescriptor; import org.jenkinsci.plugins.credentialsbinding.MultiBinding; import org.jenkinsci.plugins.credentialsbinding.impl.UnbindableDir; @@ -46,7 +46,7 @@ protected Class type() { } @Override - public MultiEnvironment bind(@Nonnull Run build, FilePath workspace, Launcher launcher, + public MultiEnvironment bind(@NonNull Run build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { VaultCertificateCredentials credentials = this.getCredentials(build); diff --git a/src/main/java/com/datapipe/jenkins/vault/credentials/common/VaultStringCredentialBinding.java b/src/main/java/com/datapipe/jenkins/vault/credentials/common/VaultStringCredentialBinding.java index 5a346a25..23d4f52d 100644 --- a/src/main/java/com/datapipe/jenkins/vault/credentials/common/VaultStringCredentialBinding.java +++ b/src/main/java/com/datapipe/jenkins/vault/credentials/common/VaultStringCredentialBinding.java @@ -1,13 +1,13 @@ package com.datapipe.jenkins.vault.credentials.common; +import edu.umd.cs.findbugs.annotations.NonNull; +import edu.umd.cs.findbugs.annotations.Nullable; import hudson.Extension; import hudson.FilePath; import hudson.Launcher; import hudson.model.Run; import hudson.model.TaskListener; import java.io.IOException; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import org.jenkinsci.Symbol; import org.jenkinsci.plugins.credentialsbinding.Binding; import org.jenkinsci.plugins.credentialsbinding.BindingDescriptor; @@ -25,10 +25,10 @@ public VaultStringCredentialBinding(String variable, String credentialsId) { return VaultStringCredential.class; } - @Override public SingleEnvironment bindSingle(@Nonnull Run build, + @Override public SingleEnvironment bindSingle(@NonNull Run build, @Nullable FilePath workspace, @Nullable Launcher launcher, - @Nonnull TaskListener listener) throws IOException, InterruptedException { + @NonNull TaskListener listener) throws IOException, InterruptedException { return new SingleEnvironment(getCredentials(build).getSecret().getPlainText()); } diff --git a/src/main/java/com/datapipe/jenkins/vault/credentials/common/VaultUsernamePasswordCredentialBinding.java b/src/main/java/com/datapipe/jenkins/vault/credentials/common/VaultUsernamePasswordCredentialBinding.java index 055f94a1..5926f84e 100644 --- a/src/main/java/com/datapipe/jenkins/vault/credentials/common/VaultUsernamePasswordCredentialBinding.java +++ b/src/main/java/com/datapipe/jenkins/vault/credentials/common/VaultUsernamePasswordCredentialBinding.java @@ -1,5 +1,6 @@ package com.datapipe.jenkins.vault.credentials.common; +import edu.umd.cs.findbugs.annotations.NonNull; import edu.umd.cs.findbugs.annotations.Nullable; import hudson.Extension; import hudson.FilePath; @@ -13,7 +14,6 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import javax.annotation.Nonnull; import org.jenkinsci.plugins.credentialsbinding.BindingDescriptor; import org.jenkinsci.plugins.credentialsbinding.MultiBinding; import org.kohsuke.stapler.AncestorInPath; @@ -45,7 +45,7 @@ protected Class type() { } @Override - public MultiEnvironment bind(@Nonnull Run build, FilePath workspace, Launcher launcher, + public MultiEnvironment bind(@NonNull Run build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException { VaultUsernamePasswordCredential credentials = this.getCredentials(build); diff --git a/src/test/java/com/datapipe/jenkins/vault/VaultBindingStepWithMockAccessor.java b/src/test/java/com/datapipe/jenkins/vault/VaultBindingStepWithMockAccessor.java index df19d27b..4028b6be 100644 --- a/src/test/java/com/datapipe/jenkins/vault/VaultBindingStepWithMockAccessor.java +++ b/src/test/java/com/datapipe/jenkins/vault/VaultBindingStepWithMockAccessor.java @@ -6,6 +6,7 @@ import com.datapipe.jenkins.vault.credentials.VaultAppRoleCredential; import com.datapipe.jenkins.vault.credentials.VaultCredential; import com.datapipe.jenkins.vault.model.VaultSecret; +import edu.umd.cs.findbugs.annotations.NonNull; import hudson.EnvVars; import hudson.Extension; import hudson.model.Run; @@ -17,7 +18,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import javax.annotation.Nonnull; import org.jenkinsci.plugins.workflow.steps.StepContext; import org.jenkinsci.plugins.workflow.steps.StepDescriptor; import org.jenkinsci.plugins.workflow.steps.StepExecution; @@ -103,7 +103,7 @@ public String getFunctionName() { return "withVaultMock"; } - @Nonnull + @NonNull @Override public String getDisplayName() { return "Vault Mock Plugin";