From 75603abbd56f55f46ea3dceda9ef1cdb719f935a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Dec 2021 08:33:19 -0800 Subject: [PATCH 01/17] Bump bridge-method-annotation from 1.21 to 1.22 (#5993) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- core/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pom.xml b/core/pom.xml index 494997f2fa8f..2126bb129250 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -178,7 +178,7 @@ THE SOFTWARE. com.infradna.tool bridge-method-annotation - 1.21 + 1.22 From 816bb676b2a85fb77defbf4f65848615ae8ecd63 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Dec 2021 08:33:39 -0800 Subject: [PATCH 02/17] Bump bridge-method-injector from 1.21 to 1.22 (#5994) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 894a0daca8eb..a4cd5a29ae39 100644 --- a/pom.xml +++ b/pom.xml @@ -351,7 +351,7 @@ THE SOFTWARE. com.infradna.tool bridge-method-injector - 1.21 + 1.22 org.codehaus.mojo From e7f9774c60bbcab61856a5382b650920d4be3996 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Thu, 2 Dec 2021 08:33:49 -0800 Subject: [PATCH 03/17] Prevent the expansion of Guava usages (#5996) --- core/src/main/java/hudson/util/Iterators.java | 4 ++-- pom.xml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/hudson/util/Iterators.java b/core/src/main/java/hudson/util/Iterators.java index 384ff29ed56b..def851e081ef 100644 --- a/core/src/main/java/hudson/util/Iterators.java +++ b/core/src/main/java/hudson/util/Iterators.java @@ -23,7 +23,6 @@ */ package hudson.util; -import com.google.common.base.Predicates; import com.google.common.collect.ImmutableList; import edu.umd.cs.findbugs.annotations.NonNull; import java.util.AbstractList; @@ -33,6 +32,7 @@ import java.util.List; import java.util.ListIterator; import java.util.NoSuchElementException; +import java.util.Objects; import java.util.Set; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.NoExternalUse; @@ -322,7 +322,7 @@ public void remove() { * Wraps another iterator and throws away nulls. */ public static Iterator removeNull(final Iterator itr) { - return com.google.common.collect.Iterators.filter(itr, Predicates.notNull()); + return com.google.common.collect.Iterators.filter(itr, Objects::nonNull); } /** diff --git a/pom.xml b/pom.xml index a4cd5a29ae39..67ce28ffbcd7 100644 --- a/pom.xml +++ b/pom.xml @@ -474,6 +474,8 @@ THE SOFTWARE. + + diff --git a/pom.xml b/pom.xml index 17379dc142cd..2b6f3aa87abd 100644 --- a/pom.xml +++ b/pom.xml @@ -99,6 +99,7 @@ THE SOFTWARE. ${project.basedir}/../src/spotbugs/spotbugs-excludes.xml 1.25 + 1.22 5.8.2 2.17.5 @@ -351,7 +352,7 @@ THE SOFTWARE. com.infradna.tool bridge-method-injector - 1.22 + ${bridge-method-injector.version} org.codehaus.mojo From ac6956c1773f2b2ceec8c0aabb1d4c7bc8d48d3d Mon Sep 17 00:00:00 2001 From: Ikko Ashimine Date: Fri, 3 Dec 2021 17:16:43 +0900 Subject: [PATCH 06/17] Fix typo in default-whitelist.txt (#6003) --- .../resources/jenkins/security/stapler/default-whitelist.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/jenkins/security/stapler/default-whitelist.txt b/core/src/main/resources/jenkins/security/stapler/default-whitelist.txt index c9fd1dfcba8d..6ac3b1bb09dc 100644 --- a/core/src/main/resources/jenkins/security/stapler/default-whitelist.txt +++ b/core/src/main/resources/jenkins/security/stapler/default-whitelist.txt @@ -131,7 +131,7 @@ method hudson.plugins.build_publisher.BuildPublisher$BuildPublisherDescriptor do ############################################### -# Changes since last successfull build Plugin # (sic) +# Changes since last successful build Plugin # (sic) ############################################### # Only has an index.jelly view, so needs to be explicit class com.cloudbees.jenkins.plugins.changelog.Changes From a0b929070e6d20833fc6e5fc2e9cc4a67df37b5a Mon Sep 17 00:00:00 2001 From: Daniel Beck <1831569+daniel-beck@users.noreply.github.com> Date: Fri, 3 Dec 2021 17:36:08 +0100 Subject: [PATCH 07/17] Amend #6003 (#6005) --- .../resources/jenkins/security/stapler/default-whitelist.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/jenkins/security/stapler/default-whitelist.txt b/core/src/main/resources/jenkins/security/stapler/default-whitelist.txt index 6ac3b1bb09dc..b2a39e2ed602 100644 --- a/core/src/main/resources/jenkins/security/stapler/default-whitelist.txt +++ b/core/src/main/resources/jenkins/security/stapler/default-whitelist.txt @@ -131,7 +131,7 @@ method hudson.plugins.build_publisher.BuildPublisher$BuildPublisherDescriptor do ############################################### -# Changes since last successful build Plugin # (sic) +# Changes since last successful build Plugin # ############################################### # Only has an index.jelly view, so needs to be explicit class com.cloudbees.jenkins.plugins.changelog.Changes From af4e20e2f3b261e2d72ff77e18c82290b39f0350 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Dec 2021 10:24:58 -0800 Subject: [PATCH 08/17] Bump jnr-posix from 3.1.12 to 3.1.13 (#5998) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- bom/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bom/pom.xml b/bom/pom.xml index cbf02bc59b11..059056f4a372 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -191,7 +191,7 @@ THE SOFTWARE. com.github.jnr jnr-posix - 3.1.12 + 3.1.13 org.kohsuke From cd92d7f88fdcf7c83d9103ffa097b53298d0e532 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Fri, 3 Dec 2021 12:25:01 -0800 Subject: [PATCH 09/17] Fix `PublicConstructorForAbstractClass` Error Prone violations (#5951) --- core/src/main/java/hudson/FilePath.java | 2 +- core/src/main/java/hudson/Launcher.java | 2 +- core/src/main/java/hudson/PluginManager.java | 2 +- .../java/hudson/console/ConsoleAnnotationDescriptor.java | 4 ++-- core/src/main/java/hudson/model/Computer.java | 2 +- .../src/main/java/hudson/model/FullDuplexHttpChannel.java | 2 +- core/src/main/java/hudson/model/Label.java | 2 +- core/src/main/java/hudson/model/ParameterDefinition.java | 4 ++-- core/src/main/java/hudson/model/Project.java | 2 +- core/src/main/java/hudson/model/Slave.java | 8 ++++---- .../main/java/hudson/model/labels/LabelExpression.java | 2 +- .../hudson/node_monitors/AbstractDiskSpaceMonitor.java | 4 ++-- core/src/main/java/hudson/slaves/AbstractCloudSlave.java | 6 +++--- .../main/java/hudson/slaves/ComputerLauncherFilter.java | 2 +- core/src/main/java/hudson/tasks/CommandInterpreter.java | 2 +- .../main/java/hudson/tools/AbstractCommandInstaller.java | 2 +- .../main/java/hudson/tools/DownloadFromUrlInstaller.java | 2 +- core/src/main/java/hudson/tools/ToolInstallation.java | 6 +++--- core/src/main/java/hudson/util/FormFieldValidator.java | 2 +- core/src/main/java/hudson/util/XStream2.java | 2 +- .../main/java/jenkins/security/RSAConfidentialKey.java | 4 ++-- .../java/jenkins/util/InterceptingExecutorService.java | 2 +- .../main/java/jenkins/util/MarkFindingOutputStream.java | 2 +- .../jenkins/util/groovy/AbstractGroovyViewModule.java | 2 +- .../java/org/acegisecurity/AcegiSecurityException.java | 4 ++-- .../java/org/acegisecurity/AuthenticationException.java | 6 +++--- .../providers/AbstractAuthenticationToken.java | 4 ++-- 27 files changed, 42 insertions(+), 42 deletions(-) diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index ef4867ea0a9b..08ace200fe30 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -1197,7 +1197,7 @@ public abstract static class AbstractInterceptorCallableWrapper implements De private final DelegatingCallable callable; - public AbstractInterceptorCallableWrapper(DelegatingCallable callable) { + protected AbstractInterceptorCallableWrapper(DelegatingCallable callable) { this.callable = callable; } diff --git a/core/src/main/java/hudson/Launcher.java b/core/src/main/java/hudson/Launcher.java index b14cee5418b3..85fc42ea5b9e 100644 --- a/core/src/main/java/hudson/Launcher.java +++ b/core/src/main/java/hudson/Launcher.java @@ -97,7 +97,7 @@ public abstract class Launcher { @Restricted(Beta.class) protected EnvVarsFilterRuleWrapper envVarsFilterRuleWrapper; - public Launcher(@NonNull TaskListener listener, @CheckForNull VirtualChannel channel) { + protected Launcher(@NonNull TaskListener listener, @CheckForNull VirtualChannel channel) { this.listener = listener; this.channel = channel; } diff --git a/core/src/main/java/hudson/PluginManager.java b/core/src/main/java/hudson/PluginManager.java index 957f161895d1..e45bc76ba1bd 100644 --- a/core/src/main/java/hudson/PluginManager.java +++ b/core/src/main/java/hudson/PluginManager.java @@ -351,7 +351,7 @@ PluginManager doCreate(@NonNull Class extends PluginManager> klass, */ private final PluginStrategy strategy; - public PluginManager(ServletContext context, File rootDir) { + protected PluginManager(ServletContext context, File rootDir) { this.context = context; this.rootDir = rootDir; diff --git a/core/src/main/java/hudson/console/ConsoleAnnotationDescriptor.java b/core/src/main/java/hudson/console/ConsoleAnnotationDescriptor.java index 1cfbbbfd4f81..3f9a17d14317 100644 --- a/core/src/main/java/hudson/console/ConsoleAnnotationDescriptor.java +++ b/core/src/main/java/hudson/console/ConsoleAnnotationDescriptor.java @@ -42,11 +42,11 @@ * @since 1.349 */ public abstract class ConsoleAnnotationDescriptor extends Descriptor> implements ExtensionPoint { - public ConsoleAnnotationDescriptor(Class extends ConsoleNote>> clazz) { + protected ConsoleAnnotationDescriptor(Class extends ConsoleNote>> clazz) { super(clazz); } - public ConsoleAnnotationDescriptor() { + protected ConsoleAnnotationDescriptor() { } /** diff --git a/core/src/main/java/hudson/model/Computer.java b/core/src/main/java/hudson/model/Computer.java index efd82044bd71..c6586cd354eb 100644 --- a/core/src/main/java/hudson/model/Computer.java +++ b/core/src/main/java/hudson/model/Computer.java @@ -251,7 +251,7 @@ public List getTerminatedBy() { return new ArrayList<>(terminatedBy); } - public Computer(Node node) { + protected Computer(Node node) { setNode(node); } diff --git a/core/src/main/java/hudson/model/FullDuplexHttpChannel.java b/core/src/main/java/hudson/model/FullDuplexHttpChannel.java index f7da784a9351..6251bddec842 100644 --- a/core/src/main/java/hudson/model/FullDuplexHttpChannel.java +++ b/core/src/main/java/hudson/model/FullDuplexHttpChannel.java @@ -44,7 +44,7 @@ public abstract class FullDuplexHttpChannel extends FullDuplexHttpService { private Channel channel; private final boolean restricted; - public FullDuplexHttpChannel(UUID uuid, boolean restricted) throws IOException { + protected FullDuplexHttpChannel(UUID uuid, boolean restricted) throws IOException { super(uuid); this.restricted = restricted; } diff --git a/core/src/main/java/hudson/model/Label.java b/core/src/main/java/hudson/model/Label.java index 367a25f36068..0e38b876f8a7 100644 --- a/core/src/main/java/hudson/model/Label.java +++ b/core/src/main/java/hudson/model/Label.java @@ -97,7 +97,7 @@ public abstract class Label extends Actionable implements Comparable, Mod @NonNull public final transient NodeProvisioner nodeProvisioner; - public Label(@NonNull String name) { + protected Label(@NonNull String name) { this.name = name; // passing these causes an infinite loop - getTotalExecutors(),getBusyExecutors()); this.loadStatistics = new LoadStatistics(0,0) { diff --git a/core/src/main/java/hudson/model/ParameterDefinition.java b/core/src/main/java/hudson/model/ParameterDefinition.java index 740c75d97740..31e98bfe49ce 100644 --- a/core/src/main/java/hudson/model/ParameterDefinition.java +++ b/core/src/main/java/hudson/model/ParameterDefinition.java @@ -102,7 +102,7 @@ public abstract class ParameterDefinition implements private String description; - public ParameterDefinition(@NonNull String name) { + protected ParameterDefinition(@NonNull String name) { if (name == null) { throw new IllegalArgumentException("Parameter name must be non-null"); } @@ -113,7 +113,7 @@ public ParameterDefinition(@NonNull String name) { * @deprecated Prefer {@link #ParameterDefinition(String)} with a {@link org.kohsuke.stapler.DataBoundConstructor} and allow {@link #setDescription} to be used as needed */ @Deprecated - public ParameterDefinition(@NonNull String name, String description) { + protected ParameterDefinition(@NonNull String name, String description) { this(name); setDescription(description); } diff --git a/core/src/main/java/hudson/model/Project.java b/core/src/main/java/hudson/model/Project.java index b0d3c9eb6f01..26232f942375 100644 --- a/core/src/main/java/hudson/model/Project.java +++ b/core/src/main/java/hudson/model/Project.java @@ -86,7 +86,7 @@ public abstract class Project,B extends Build> /** * Creates a new project. */ - public Project(ItemGroup parent,String name) { + protected Project(ItemGroup parent,String name) { super(parent,name); } diff --git a/core/src/main/java/hudson/model/Slave.java b/core/src/main/java/hudson/model/Slave.java index aa0f13e47b8f..90b36b2c2b64 100644 --- a/core/src/main/java/hudson/model/Slave.java +++ b/core/src/main/java/hudson/model/Slave.java @@ -164,7 +164,7 @@ public abstract class Slave extends Node implements Serializable { * @deprecated since 2.184 */ @Deprecated - public Slave(String name, String nodeDescription, String remoteFS, String numExecutors, + protected Slave(String name, String nodeDescription, String remoteFS, String numExecutors, Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy, List extends NodeProperty>> nodeProperties) throws FormException, IOException { this(name,nodeDescription,remoteFS,Util.tryParseNumber(numExecutors, 1).intValue(),mode,labelString,launcher,retentionStrategy, nodeProperties); } @@ -173,12 +173,12 @@ public Slave(String name, String nodeDescription, String remoteFS, String numExe * @deprecated since 2009-02-20. */ @Deprecated - public Slave(String name, String nodeDescription, String remoteFS, int numExecutors, + protected Slave(String name, String nodeDescription, String remoteFS, int numExecutors, Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy) throws FormException, IOException { this(name, nodeDescription, remoteFS, numExecutors, mode, labelString, launcher, retentionStrategy, new ArrayList()); } - public Slave(@NonNull String name, String remoteFS, ComputerLauncher launcher) throws FormException, IOException { + protected Slave(@NonNull String name, String remoteFS, ComputerLauncher launcher) throws FormException, IOException { this.name = name; this.remoteFS = remoteFS; this.launcher = launcher; @@ -189,7 +189,7 @@ public Slave(@NonNull String name, String remoteFS, ComputerLauncher launcher) t * Use {@link #Slave(String, String, ComputerLauncher)} and set the rest through setters. */ @Deprecated - public Slave(@NonNull String name, String nodeDescription, String remoteFS, int numExecutors, + protected Slave(@NonNull String name, String nodeDescription, String remoteFS, int numExecutors, Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy, List extends NodeProperty>> nodeProperties) throws FormException, IOException { this.name = name; this.description = nodeDescription; diff --git a/core/src/main/java/hudson/model/labels/LabelExpression.java b/core/src/main/java/hudson/model/labels/LabelExpression.java index 8443174fdb6b..00a81c271555 100644 --- a/core/src/main/java/hudson/model/labels/LabelExpression.java +++ b/core/src/main/java/hudson/model/labels/LabelExpression.java @@ -121,7 +121,7 @@ static String paren(LabelOperatorPrecedence op, Label l) { public abstract static class Binary extends LabelExpression { public final Label lhs,rhs; - public Binary(Label lhs, Label rhs, LabelOperatorPrecedence op) { + protected Binary(Label lhs, Label rhs, LabelOperatorPrecedence op) { super(combine(lhs, rhs, op)); this.lhs = lhs; this.rhs = rhs; diff --git a/core/src/main/java/hudson/node_monitors/AbstractDiskSpaceMonitor.java b/core/src/main/java/hudson/node_monitors/AbstractDiskSpaceMonitor.java index c5790a436f8b..dce9ca3e14e1 100644 --- a/core/src/main/java/hudson/node_monitors/AbstractDiskSpaceMonitor.java +++ b/core/src/main/java/hudson/node_monitors/AbstractDiskSpaceMonitor.java @@ -18,12 +18,12 @@ public abstract class AbstractDiskSpaceMonitor extends NodeMonitor { */ public final String freeSpaceThreshold; - public AbstractDiskSpaceMonitor(String threshold) throws ParseException { + protected AbstractDiskSpaceMonitor(String threshold) throws ParseException { this.freeSpaceThreshold = threshold; DiskSpace.parse(threshold); // make sure it parses } - public AbstractDiskSpaceMonitor() { + protected AbstractDiskSpaceMonitor() { this.freeSpaceThreshold = "1GB"; } diff --git a/core/src/main/java/hudson/slaves/AbstractCloudSlave.java b/core/src/main/java/hudson/slaves/AbstractCloudSlave.java index f466f8a957c3..2197d8eb138f 100644 --- a/core/src/main/java/hudson/slaves/AbstractCloudSlave.java +++ b/core/src/main/java/hudson/slaves/AbstractCloudSlave.java @@ -44,7 +44,7 @@ */ public abstract class AbstractCloudSlave extends Slave { - public AbstractCloudSlave(@NonNull String name, String remoteFS, ComputerLauncher launcher) + protected AbstractCloudSlave(@NonNull String name, String remoteFS, ComputerLauncher launcher) throws FormException, IOException { super(name, remoteFS, launcher); } @@ -54,7 +54,7 @@ public AbstractCloudSlave(@NonNull String name, String remoteFS, ComputerLaunche * @deprecated since 2.184 */ @Deprecated - public AbstractCloudSlave(String name, String nodeDescription, String remoteFS, String numExecutors, + protected AbstractCloudSlave(String name, String nodeDescription, String remoteFS, String numExecutors, Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy, List extends NodeProperty>> nodeProperties) throws FormException, IOException { @@ -66,7 +66,7 @@ public AbstractCloudSlave(String name, String nodeDescription, String remoteFS, * @deprecated since 2.184 */ @Deprecated - public AbstractCloudSlave(String name, String nodeDescription, String remoteFS, int numExecutors, + protected AbstractCloudSlave(String name, String nodeDescription, String remoteFS, int numExecutors, Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy, List extends NodeProperty>> nodeProperties) throws FormException, IOException { diff --git a/core/src/main/java/hudson/slaves/ComputerLauncherFilter.java b/core/src/main/java/hudson/slaves/ComputerLauncherFilter.java index a1c34816f644..ddc6ea0afa59 100644 --- a/core/src/main/java/hudson/slaves/ComputerLauncherFilter.java +++ b/core/src/main/java/hudson/slaves/ComputerLauncherFilter.java @@ -41,7 +41,7 @@ public abstract class ComputerLauncherFilter extends ComputerLauncher { protected volatile ComputerLauncher core; - public ComputerLauncherFilter(ComputerLauncher core) { + protected ComputerLauncherFilter(ComputerLauncher core) { this.core = core; } diff --git a/core/src/main/java/hudson/tasks/CommandInterpreter.java b/core/src/main/java/hudson/tasks/CommandInterpreter.java index fc916af2e126..f9e8c24344a7 100644 --- a/core/src/main/java/hudson/tasks/CommandInterpreter.java +++ b/core/src/main/java/hudson/tasks/CommandInterpreter.java @@ -67,7 +67,7 @@ public abstract class CommandInterpreter extends Builder implements EnvVarsFilte @Restricted(Beta.class) protected List configuredLocalRules = new ArrayList<>(); - public CommandInterpreter(String command) { + protected CommandInterpreter(String command) { this.command = command; } diff --git a/core/src/main/java/hudson/tools/AbstractCommandInstaller.java b/core/src/main/java/hudson/tools/AbstractCommandInstaller.java index cacc9820758f..d3dd0d4daf21 100644 --- a/core/src/main/java/hudson/tools/AbstractCommandInstaller.java +++ b/core/src/main/java/hudson/tools/AbstractCommandInstaller.java @@ -47,7 +47,7 @@ public abstract class AbstractCommandInstaller extends ToolInstaller { private final String command; private final String toolHome; - public AbstractCommandInstaller(String label, String command, String toolHome) { + protected AbstractCommandInstaller(String label, String command, String toolHome) { super(label); this.command = command; this.toolHome = toolHome; diff --git a/core/src/main/java/hudson/tools/DownloadFromUrlInstaller.java b/core/src/main/java/hudson/tools/DownloadFromUrlInstaller.java index 5661efe174c5..c032b9275891 100644 --- a/core/src/main/java/hudson/tools/DownloadFromUrlInstaller.java +++ b/core/src/main/java/hudson/tools/DownloadFromUrlInstaller.java @@ -254,7 +254,7 @@ public static class Installable { */ public abstract class NodeSpecificInstallable extends Installable implements NodeSpecific { - public NodeSpecificInstallable(Installable inst) { + protected NodeSpecificInstallable(Installable inst) { this.id = inst.id; this.name = inst.name; this.url = inst.url; diff --git a/core/src/main/java/hudson/tools/ToolInstallation.java b/core/src/main/java/hudson/tools/ToolInstallation.java index 49a0f0d7e207..7472c009d01d 100644 --- a/core/src/main/java/hudson/tools/ToolInstallation.java +++ b/core/src/main/java/hudson/tools/ToolInstallation.java @@ -103,12 +103,12 @@ public abstract class ToolInstallation extends AbstractDescribableImpl> properties) { + protected ToolInstallation(String name, String home, List extends ToolProperty>> properties) { this.name = name; this.home = home; if(properties!=null) { @@ -258,7 +258,7 @@ protected Object writeReplace() throws Exception { * Subclasses can extend this for data migration from old field storing home directory. */ protected abstract static class ToolConverter extends XStream2.PassthruConverter { - public ToolConverter(XStream2 xstream) { super(xstream); } + protected ToolConverter(XStream2 xstream) { super(xstream); } @Override protected void callback(ToolInstallation obj, UnmarshallingContext context) { String s; diff --git a/core/src/main/java/hudson/util/FormFieldValidator.java b/core/src/main/java/hudson/util/FormFieldValidator.java index 8f5c2619694e..466b65b3e891 100644 --- a/core/src/main/java/hudson/util/FormFieldValidator.java +++ b/core/src/main/java/hudson/util/FormFieldValidator.java @@ -250,7 +250,7 @@ private void _errorWithMarkup(String message, String cssClass) throws IOExceptio @Deprecated public abstract static class URLCheck extends FormFieldValidator { - public URLCheck(StaplerRequest request, StaplerResponse response) { + protected URLCheck(StaplerRequest request, StaplerResponse response) { // can be used to check the existence of any file in file system // or other HTTP URLs inside firewall, so limit this to the admin. super(request, response, true); diff --git a/core/src/main/java/hudson/util/XStream2.java b/core/src/main/java/hudson/util/XStream2.java index f72010157ab2..d04ceabc73ed 100644 --- a/core/src/main/java/hudson/util/XStream2.java +++ b/core/src/main/java/hudson/util/XStream2.java @@ -492,7 +492,7 @@ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext co public abstract static class PassthruConverter implements Converter { private Converter converter; - public PassthruConverter(XStream2 xstream) { + protected PassthruConverter(XStream2 xstream) { converter = xstream.reflectionConverter; } diff --git a/core/src/main/java/jenkins/security/RSAConfidentialKey.java b/core/src/main/java/jenkins/security/RSAConfidentialKey.java index 8c5f64b31748..35e920535020 100644 --- a/core/src/main/java/jenkins/security/RSAConfidentialKey.java +++ b/core/src/main/java/jenkins/security/RSAConfidentialKey.java @@ -52,11 +52,11 @@ public abstract class RSAConfidentialKey extends ConfidentialKey { private RSAPrivateKey priv; private RSAPublicKey pub; - public RSAConfidentialKey(String id) { + protected RSAConfidentialKey(String id) { super(id); } - public RSAConfidentialKey(Class owner, String shortName) { + protected RSAConfidentialKey(Class owner, String shortName) { this(owner.getName() + '.' + shortName); } diff --git a/core/src/main/java/jenkins/util/InterceptingExecutorService.java b/core/src/main/java/jenkins/util/InterceptingExecutorService.java index 6be88667c741..beb1e363bff8 100644 --- a/core/src/main/java/jenkins/util/InterceptingExecutorService.java +++ b/core/src/main/java/jenkins/util/InterceptingExecutorService.java @@ -19,7 +19,7 @@ public abstract class InterceptingExecutorService implements ExecutorService { private final ExecutorService base; - public InterceptingExecutorService(ExecutorService base) { + protected InterceptingExecutorService(ExecutorService base) { this.base = base; } diff --git a/core/src/main/java/jenkins/util/MarkFindingOutputStream.java b/core/src/main/java/jenkins/util/MarkFindingOutputStream.java index 09d42c0639e0..1c5d52e85cab 100644 --- a/core/src/main/java/jenkins/util/MarkFindingOutputStream.java +++ b/core/src/main/java/jenkins/util/MarkFindingOutputStream.java @@ -15,7 +15,7 @@ public abstract class MarkFindingOutputStream extends OutputStream { private final OutputStream base; - public MarkFindingOutputStream(OutputStream base) { + protected MarkFindingOutputStream(OutputStream base) { this.base = base; } diff --git a/core/src/main/java/jenkins/util/groovy/AbstractGroovyViewModule.java b/core/src/main/java/jenkins/util/groovy/AbstractGroovyViewModule.java index 97dc9b22e0c0..ba4391ebee03 100644 --- a/core/src/main/java/jenkins/util/groovy/AbstractGroovyViewModule.java +++ b/core/src/main/java/jenkins/util/groovy/AbstractGroovyViewModule.java @@ -25,7 +25,7 @@ public abstract class AbstractGroovyViewModule extends GroovyObjectSupport { public JenkinsTagLib t; public Namespace st; - public AbstractGroovyViewModule(JellyBuilder b) { + protected AbstractGroovyViewModule(JellyBuilder b) { builder = b; f = builder.namespace(FormTagLib.class); l = builder.namespace(LayoutTagLib.class); diff --git a/core/src/main/java/org/acegisecurity/AcegiSecurityException.java b/core/src/main/java/org/acegisecurity/AcegiSecurityException.java index bfc529de387c..d4e780fe57c4 100644 --- a/core/src/main/java/org/acegisecurity/AcegiSecurityException.java +++ b/core/src/main/java/org/acegisecurity/AcegiSecurityException.java @@ -32,11 +32,11 @@ @Deprecated public abstract class AcegiSecurityException extends NestedRuntimeException { - public AcegiSecurityException(String msg) { + protected AcegiSecurityException(String msg) { super(msg); } - public AcegiSecurityException(String msg, Throwable cause) { + protected AcegiSecurityException(String msg, Throwable cause) { super(msg, cause); } diff --git a/core/src/main/java/org/acegisecurity/AuthenticationException.java b/core/src/main/java/org/acegisecurity/AuthenticationException.java index ff3f9bc9a545..22a3fc398015 100644 --- a/core/src/main/java/org/acegisecurity/AuthenticationException.java +++ b/core/src/main/java/org/acegisecurity/AuthenticationException.java @@ -38,16 +38,16 @@ public abstract class AuthenticationException extends AcegiSecurityException { private Authentication authentication; private Object extraInformation; - public AuthenticationException(String msg) { + protected AuthenticationException(String msg) { super(msg); } - public AuthenticationException(String msg, Object extraInformation) { + protected AuthenticationException(String msg, Object extraInformation) { super(msg); this.extraInformation = extraInformation; } - public AuthenticationException(String msg, Throwable t) { + protected AuthenticationException(String msg, Throwable t) { super(msg, t); } diff --git a/core/src/main/java/org/acegisecurity/providers/AbstractAuthenticationToken.java b/core/src/main/java/org/acegisecurity/providers/AbstractAuthenticationToken.java index 266e581e40d6..63cbeb0aec01 100644 --- a/core/src/main/java/org/acegisecurity/providers/AbstractAuthenticationToken.java +++ b/core/src/main/java/org/acegisecurity/providers/AbstractAuthenticationToken.java @@ -40,11 +40,11 @@ public abstract class AbstractAuthenticationToken implements Authentication { private Object details; private boolean authenticated; - public AbstractAuthenticationToken() { + protected AbstractAuthenticationToken() { this.authorities = new GrantedAuthority[0]; } - public AbstractAuthenticationToken(GrantedAuthority[] authorities) { + protected AbstractAuthenticationToken(GrantedAuthority[] authorities) { this.authorities = authorities; } From a67fc45541cf18a3516b7095c40300110d18a0bf Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Fri, 3 Dec 2021 12:25:16 -0800 Subject: [PATCH 10/17] Fix `BadAnnotationImplementation` Error Prone violation (#5953) --- .../hudson/cli/declarative/MethodBinder.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/src/main/java/hudson/cli/declarative/MethodBinder.java b/core/src/main/java/hudson/cli/declarative/MethodBinder.java index b04747afb88f..08438aac9d87 100644 --- a/core/src/main/java/hudson/cli/declarative/MethodBinder.java +++ b/core/src/main/java/hudson/cli/declarative/MethodBinder.java @@ -31,6 +31,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.List; +import java.util.Objects; import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineParser; @@ -171,5 +172,22 @@ public Class extends Annotation> annotationType() { public boolean hidden() { return base.hidden(); } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof ArgumentImpl)) { + return false; + } + ArgumentImpl argument = (ArgumentImpl) o; + return Objects.equals(base, argument.base) && bias == argument.bias; + } + + @Override + public int hashCode() { + return Objects.hash(base, bias); + } } } From 44e96a82b9df68c82033e6b8966b88dfbb1997c0 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Fri, 3 Dec 2021 12:25:25 -0800 Subject: [PATCH 11/17] Enable `CustomImportOrder` and `UnusedImports` Checkstyle checks (#5962) --- core/src/main/java/hudson/logging/LogRecorder.java | 10 +++++----- .../java/hudson/model/DirectoryBrowserSupport.java | 2 -- .../src/main/java/hudson/model/TimeZoneProperty.java | 1 - core/src/main/java/hudson/util/XStream2.java | 6 +++--- core/src/main/java/jenkins/SoloFilePathFilter.java | 7 +++---- core/src/main/java/jenkins/model/Nodes.java | 1 - .../jenkins/security/SuspiciousRequestFilter.java | 3 +-- .../security/s2m/RunningBuildFilePathFilter.java | 12 ++++++------ core/src/main/java/jenkins/views/Header.java | 6 ++---- core/src/main/java/jenkins/views/PartialHeader.java | 3 +-- core/src/main/java/org/jenkins/ui/icon/IconSet.java | 9 ++++----- pom.xml | 6 ++++++ 12 files changed, 31 insertions(+), 35 deletions(-) diff --git a/core/src/main/java/hudson/logging/LogRecorder.java b/core/src/main/java/hudson/logging/LogRecorder.java index 09c7a69cd35b..661212023115 100644 --- a/core/src/main/java/hudson/logging/LogRecorder.java +++ b/core/src/main/java/hudson/logging/LogRecorder.java @@ -31,11 +31,6 @@ import hudson.RestrictedSince; import hudson.Util; import hudson.XmlFile; -import hudson.util.CopyOnWriteList; -import hudson.util.HttpResponses; -import java.util.Objects; -import jenkins.util.MemoryReductionUtil; -import jenkins.model.Jenkins; import hudson.model.AbstractModelObject; import hudson.model.AutoCompletionCandidates; import hudson.model.Computer; @@ -45,6 +40,8 @@ import hudson.remoting.Channel; import hudson.remoting.VirtualChannel; import hudson.slaves.ComputerListener; +import hudson.util.CopyOnWriteList; +import hudson.util.HttpResponses; import hudson.util.RingBufferLogHandler; import hudson.util.XStream2; import java.io.File; @@ -61,6 +58,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.SortedSet; import java.util.TreeMap; @@ -70,7 +68,9 @@ import java.util.logging.LogRecord; import java.util.logging.Logger; import javax.servlet.ServletException; +import jenkins.model.Jenkins; import jenkins.security.MasterToSlaveCallable; +import jenkins.util.MemoryReductionUtil; import net.sf.json.JSONObject; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.NoExternalUse; diff --git a/core/src/main/java/hudson/model/DirectoryBrowserSupport.java b/core/src/main/java/hudson/model/DirectoryBrowserSupport.java index 7ce1db734b09..5ed6f2260905 100644 --- a/core/src/main/java/hudson/model/DirectoryBrowserSupport.java +++ b/core/src/main/java/hudson/model/DirectoryBrowserSupport.java @@ -26,7 +26,6 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import hudson.FilePath; import hudson.Util; - import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -54,7 +53,6 @@ import java.util.stream.Stream; import javax.servlet.ServletException; import javax.servlet.http.HttpServletResponse; - import jenkins.model.Jenkins; import jenkins.security.MasterToSlaveCallable; import jenkins.security.ResourceDomainConfiguration; diff --git a/core/src/main/java/hudson/model/TimeZoneProperty.java b/core/src/main/java/hudson/model/TimeZoneProperty.java index 6c6780d621da..620f3129aafe 100644 --- a/core/src/main/java/hudson/model/TimeZoneProperty.java +++ b/core/src/main/java/hudson/model/TimeZoneProperty.java @@ -2,7 +2,6 @@ import edu.umd.cs.findbugs.annotations.CheckForNull; import edu.umd.cs.findbugs.annotations.NonNull; -import edu.umd.cs.findbugs.annotations.Nullable; import hudson.Extension; import hudson.Util; import hudson.util.FormValidation; diff --git a/core/src/main/java/hudson/util/XStream2.java b/core/src/main/java/hudson/util/XStream2.java index d04ceabc73ed..0802197390b8 100644 --- a/core/src/main/java/hudson/util/XStream2.java +++ b/core/src/main/java/hudson/util/XStream2.java @@ -28,13 +28,16 @@ import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.converters.ConversionException; import com.thoughtworks.xstream.converters.Converter; +import com.thoughtworks.xstream.converters.ConverterLookup; import com.thoughtworks.xstream.converters.ConverterMatcher; +import com.thoughtworks.xstream.converters.ConverterRegistry; import com.thoughtworks.xstream.converters.DataHolder; import com.thoughtworks.xstream.converters.MarshallingContext; import com.thoughtworks.xstream.converters.SingleValueConverter; import com.thoughtworks.xstream.converters.SingleValueConverterWrapper; import com.thoughtworks.xstream.converters.UnmarshallingContext; import com.thoughtworks.xstream.converters.extended.DynamicProxyConverter; +import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; import com.thoughtworks.xstream.core.ClassLoaderReference; import com.thoughtworks.xstream.core.JVM; import com.thoughtworks.xstream.core.util.Fields; @@ -47,9 +50,6 @@ import com.thoughtworks.xstream.mapper.Mapper; import com.thoughtworks.xstream.mapper.MapperWrapper; import com.thoughtworks.xstream.security.AnyTypePermission; -import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; -import com.thoughtworks.xstream.converters.ConverterLookup; -import com.thoughtworks.xstream.converters.ConverterRegistry; import edu.umd.cs.findbugs.annotations.CheckForNull; import edu.umd.cs.findbugs.annotations.NonNull; import hudson.PluginManager; diff --git a/core/src/main/java/jenkins/SoloFilePathFilter.java b/core/src/main/java/jenkins/SoloFilePathFilter.java index 079373cf237f..19a949bfde7a 100644 --- a/core/src/main/java/jenkins/SoloFilePathFilter.java +++ b/core/src/main/java/jenkins/SoloFilePathFilter.java @@ -3,14 +3,13 @@ import edu.umd.cs.findbugs.annotations.Nullable; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import hudson.FilePath; -import jenkins.util.SystemProperties; -import org.kohsuke.accmod.Restricted; -import org.kohsuke.accmod.restrictions.NoExternalUse; - import java.io.File; import java.util.UUID; import java.util.logging.Level; import java.util.logging.Logger; +import jenkins.util.SystemProperties; +import org.kohsuke.accmod.Restricted; +import org.kohsuke.accmod.restrictions.NoExternalUse; /** * Variant of {@link FilePathFilter} that assumes it is the sole actor. diff --git a/core/src/main/java/jenkins/model/Nodes.java b/core/src/main/java/jenkins/model/Nodes.java index 8eaaca810c58..ad35e4fc066f 100644 --- a/core/src/main/java/jenkins/model/Nodes.java +++ b/core/src/main/java/jenkins/model/Nodes.java @@ -32,7 +32,6 @@ import hudson.model.Node; import hudson.model.Queue; import hudson.model.Saveable; -import hudson.model.labels.LabelAtom; import hudson.model.listeners.SaveableListener; import hudson.slaves.EphemeralNode; import hudson.slaves.OfflineCause; diff --git a/core/src/main/java/jenkins/security/SuspiciousRequestFilter.java b/core/src/main/java/jenkins/security/SuspiciousRequestFilter.java index 0e839433a301..9b9f413606d8 100644 --- a/core/src/main/java/jenkins/security/SuspiciousRequestFilter.java +++ b/core/src/main/java/jenkins/security/SuspiciousRequestFilter.java @@ -1,5 +1,6 @@ package jenkins.security; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.io.IOException; import java.util.logging.Logger; import javax.servlet.Filter; @@ -10,8 +11,6 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import jenkins.util.SystemProperties; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.NoExternalUse; diff --git a/core/src/main/java/jenkins/security/s2m/RunningBuildFilePathFilter.java b/core/src/main/java/jenkins/security/s2m/RunningBuildFilePathFilter.java index 091153017e0b..5e4d88757e75 100644 --- a/core/src/main/java/jenkins/security/s2m/RunningBuildFilePathFilter.java +++ b/core/src/main/java/jenkins/security/s2m/RunningBuildFilePathFilter.java @@ -32,18 +32,18 @@ import hudson.model.Queue; import hudson.model.Run; import hudson.remoting.ChannelBuilder; -import jenkins.ReflectiveFilePathFilter; -import jenkins.model.Jenkins; -import jenkins.security.ChannelConfigurator; -import jenkins.util.SystemProperties; -import org.kohsuke.accmod.Restricted; -import org.kohsuke.accmod.restrictions.NoExternalUse; import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; +import jenkins.ReflectiveFilePathFilter; +import jenkins.model.Jenkins; +import jenkins.security.ChannelConfigurator; +import jenkins.util.SystemProperties; +import org.kohsuke.accmod.Restricted; +import org.kohsuke.accmod.restrictions.NoExternalUse; /** * When an agent tries to access build directories on the controller, limit it to those for builds running on that agent. diff --git a/core/src/main/java/jenkins/views/Header.java b/core/src/main/java/jenkins/views/Header.java index 9f4f6ecb3d55..9f235c66d548 100644 --- a/core/src/main/java/jenkins/views/Header.java +++ b/core/src/main/java/jenkins/views/Header.java @@ -1,13 +1,11 @@ package jenkins.views; +import hudson.ExtensionList; +import hudson.ExtensionPoint; import java.util.Optional; - import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.NoExternalUse; -import hudson.ExtensionList; -import hudson.ExtensionPoint; - /** * Extension point that provides capabilities to render a specific header. * diff --git a/core/src/main/java/jenkins/views/PartialHeader.java b/core/src/main/java/jenkins/views/PartialHeader.java index a35eae887840..2bc4255b55a9 100644 --- a/core/src/main/java/jenkins/views/PartialHeader.java +++ b/core/src/main/java/jenkins/views/PartialHeader.java @@ -1,11 +1,10 @@ package jenkins.views; -import java.util.logging.Logger; - import hudson.ExtensionList; import hudson.init.InitMilestone; import hudson.init.Initializer; import hudson.util.AdministrativeError; +import java.util.logging.Logger; import jenkins.model.Jenkins; /** diff --git a/core/src/main/java/org/jenkins/ui/icon/IconSet.java b/core/src/main/java/org/jenkins/ui/icon/IconSet.java index d79b81d3fc44..f43b7a0e40ea 100644 --- a/core/src/main/java/org/jenkins/ui/icon/IconSet.java +++ b/core/src/main/java/org/jenkins/ui/icon/IconSet.java @@ -23,18 +23,17 @@ */ package org.jenkins.ui.icon; +import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; -import org.apache.commons.io.IOUtils; -import org.apache.commons.jelly.JellyContext; -import org.apache.commons.lang.StringUtils; - -import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import org.apache.commons.io.IOUtils; +import org.apache.commons.jelly.JellyContext; +import org.apache.commons.lang.StringUtils; /** * An icon set. diff --git a/pom.xml b/pom.xml index 2b6f3aa87abd..3dbeb6e38640 100644 --- a/pom.xml +++ b/pom.xml @@ -472,6 +472,11 @@ THE SOFTWARE. Imports: https://checkstyle.sourceforge.io/config_imports.html --> + + + + + @@ -479,6 +484,7 @@ THE SOFTWARE. + From 623b7340d5968ce0c23ef51d4e8e0f08e30b5a5e Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Fri, 3 Dec 2021 18:56:50 -0800 Subject: [PATCH 12/17] Enable Javadoc-related Checkstyle checks (#5968) --- core/src/main/java/hudson/FilePath.java | 2 +- core/src/main/java/hudson/ProxyConfiguration.java | 4 ++-- core/src/main/java/hudson/WebAppMain.java | 3 ++- core/src/main/java/hudson/XmlFile.java | 6 +++--- core/src/main/java/hudson/logging/LogRecorder.java | 6 +++--- core/src/main/java/hudson/model/Computer.java | 11 ++++++----- .../model/EnvironmentContributingAction.java | 3 +-- core/src/main/java/hudson/model/ItemGroup.java | 2 +- core/src/main/java/hudson/model/Run.java | 2 +- core/src/main/java/hudson/model/UpdateCenter.java | 4 ++-- core/src/main/java/hudson/model/View.java | 2 +- core/src/main/java/hudson/model/queue/Latch.java | 3 +-- .../main/java/hudson/security/SecurityRealm.java | 4 ++-- core/src/main/java/hudson/triggers/Trigger.java | 6 +++--- .../main/java/hudson/util/KeyedDataStorage.java | 4 ++-- .../src/main/java/hudson/util/jna/RegistryKey.java | 2 +- pom.xml | 14 ++++++++++++++ 17 files changed, 46 insertions(+), 32 deletions(-) diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index 08ace200fe30..fc6d6f39cbc7 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -1674,8 +1674,8 @@ public String invoke(File dir, VirtualChannel channel) throws IOException { /** * Deletes this file. - * @throws IOException if it exists but could not be successfully deleted * @return true, for a modicum of compatibility + * @throws IOException if it exists but could not be successfully deleted */ public boolean delete() throws IOException, InterruptedException { act(new Delete()); diff --git a/core/src/main/java/hudson/ProxyConfiguration.java b/core/src/main/java/hudson/ProxyConfiguration.java index 2f764a923df2..cecd40f979a0 100644 --- a/core/src/main/java/hudson/ProxyConfiguration.java +++ b/core/src/main/java/hudson/ProxyConfiguration.java @@ -176,10 +176,10 @@ public String getPassword() { } /** + * @return the encrypted proxy password + * * @deprecated * Use {@link #getSecretPassword()} - * - * @return the encrypted proxy password */ @Deprecated public String getEncryptedPassword() { diff --git a/core/src/main/java/hudson/WebAppMain.java b/core/src/main/java/hudson/WebAppMain.java index c6d0ef776bff..c7fdcced0234 100644 --- a/core/src/main/java/hudson/WebAppMain.java +++ b/core/src/main/java/hudson/WebAppMain.java @@ -120,7 +120,8 @@ public class WebAppMain implements ServletContextListener { } }; - /**This getter returns the int DEFAULT_RING_BUFFER_SIZE from the class RingBufferLogHandler from a static context. + /** + * This getter returns the int DEFAULT_RING_BUFFER_SIZE from the class RingBufferLogHandler from a static context. * Exposes access from RingBufferLogHandler.DEFAULT_RING_BUFFER_SIZE to WebAppMain. * Written for the requirements of JENKINS-50669 * @return int This returns DEFAULT_RING_BUFFER_SIZE diff --git a/core/src/main/java/hudson/XmlFile.java b/core/src/main/java/hudson/XmlFile.java index 755d4a66f662..75bff5fc0f78 100644 --- a/core/src/main/java/hudson/XmlFile.java +++ b/core/src/main/java/hudson/XmlFile.java @@ -263,8 +263,8 @@ public String toString() { * Opens a {@link Reader} that loads XML. * This method uses {@link #sniffEncoding() the right encoding}, * not just the system default encoding. - * @throws IOException Encoding issues * @return Reader for the file. should be close externally once read. + * @throws IOException Encoding issues */ public Reader readRaw() throws IOException { try { @@ -304,10 +304,10 @@ public void writeRawTo(Writer w) throws IOException { /** * Parses the beginning of the file and determines the encoding. * - * @throws IOException - * if failed to detect encoding. * @return * always non-null. + * @throws IOException + * if failed to detect encoding. */ public String sniffEncoding() throws IOException { class Eureka extends SAXException { diff --git a/core/src/main/java/hudson/logging/LogRecorder.java b/core/src/main/java/hudson/logging/LogRecorder.java index 661212023115..4155576a9e9e 100644 --- a/core/src/main/java/hudson/logging/LogRecorder.java +++ b/core/src/main/java/hudson/logging/LogRecorder.java @@ -98,14 +98,14 @@ public class LogRecorder extends AbstractModelObject implements Saveable { private volatile String name; - @Deprecated - @Restricted(NoExternalUse.class) - @RestrictedSince("TODO") /** * No longer used. * * @deprecated use {@link #getLoggers()} */ + @Deprecated + @Restricted(NoExternalUse.class) + @RestrictedSince("TODO") public final transient CopyOnWriteList targets = new CopyOnWriteList<>(); private List loggers = new ArrayList<>(); private static final TargetComparator TARGET_COMPARATOR = new TargetComparator(); diff --git a/core/src/main/java/hudson/model/Computer.java b/core/src/main/java/hudson/model/Computer.java index c6586cd354eb..cbcdb99cd30c 100644 --- a/core/src/main/java/hudson/model/Computer.java +++ b/core/src/main/java/hudson/model/Computer.java @@ -462,10 +462,11 @@ public final Future> connect(boolean forceReconnect) { protected abstract Future> _connect(boolean forceReconnect); /** - * @deprecated Implementation of CLI command "connect-node" moved to {@link hudson.cli.ConnectNodeCommand}. * * @param force * If true cancel any currently pending connect operation and retry from scratch + * + * @deprecated Implementation of CLI command "connect-node" moved to {@link hudson.cli.ConnectNodeCommand}. */ @Deprecated public void cliConnect(boolean force) throws ExecutionException, InterruptedException { @@ -524,10 +525,10 @@ public Future> disconnect() { } /** - * @deprecated Implementation of CLI command "disconnect-node" moved to {@link hudson.cli.DisconnectNodeCommand}. - * * @param cause * Record the note about why you are disconnecting this node + * + * @deprecated Implementation of CLI command "disconnect-node" moved to {@link hudson.cli.DisconnectNodeCommand}. */ @Deprecated public void cliDisconnect(String cause) throws ExecutionException, InterruptedException { @@ -536,10 +537,10 @@ public void cliDisconnect(String cause) throws ExecutionException, InterruptedEx } /** - * @deprecated Implementation of CLI command "offline-node" moved to {@link hudson.cli.OfflineNodeCommand}. - * * @param cause * Record the note about why you are disconnecting this node + * + * @deprecated Implementation of CLI command "offline-node" moved to {@link hudson.cli.OfflineNodeCommand}. */ @Deprecated public void cliOffline(String cause) throws ExecutionException, InterruptedException { diff --git a/core/src/main/java/hudson/model/EnvironmentContributingAction.java b/core/src/main/java/hudson/model/EnvironmentContributingAction.java index 2ffd5675574e..1df68de4c37f 100644 --- a/core/src/main/java/hudson/model/EnvironmentContributingAction.java +++ b/core/src/main/java/hudson/model/EnvironmentContributingAction.java @@ -68,12 +68,11 @@ default void buildEnvironment(@NonNull Run, ?> run, @NonNull EnvVars env) { /** * Called by {@link AbstractBuild} to allow plugins to contribute environment variables. * - * @deprecated Use {@link #buildEnvironment} instead - * * @param build * The calling build. Never null. * @param env * Environment variables should be added to this map. + * @deprecated Use {@link #buildEnvironment} instead */ @Deprecated @Restricted(ProtectedExternally.class) diff --git a/core/src/main/java/hudson/model/ItemGroup.java b/core/src/main/java/hudson/model/ItemGroup.java index 32de4c194b42..72eea584384b 100644 --- a/core/src/main/java/hudson/model/ItemGroup.java +++ b/core/src/main/java/hudson/model/ItemGroup.java @@ -99,8 +99,8 @@ default Stream getItemsStream(Predicate pred) { /** * Gets the {@link Item} inside this group that has a given name, or null if it does not exist. - * @throws AccessDeniedException if the current user has {@link Item#DISCOVER} but not {@link Item#READ} on this item * @return an item whose {@link Item#getName} is {@code name} and whose {@link Item#getParent} is {@code this}, or null if there is no such item, or there is but the current user lacks both {@link Item#DISCOVER} and {@link Item#READ} on it + * @throws AccessDeniedException if the current user has {@link Item#DISCOVER} but not {@link Item#READ} on this item */ @CheckForNull T getItem(String name) throws AccessDeniedException; diff --git a/core/src/main/java/hudson/model/Run.java b/core/src/main/java/hudson/model/Run.java index 0deafc1f586b..37836a9c4c24 100644 --- a/core/src/main/java/hudson/model/Run.java +++ b/core/src/main/java/hudson/model/Run.java @@ -1380,7 +1380,7 @@ public class Artifact { private String treeNodeId; /** - *length of this artifact for files. + * length of this artifact for files. */ private String length; diff --git a/core/src/main/java/hudson/model/UpdateCenter.java b/core/src/main/java/hudson/model/UpdateCenter.java index da936be626c4..4a215ad17f44 100644 --- a/core/src/main/java/hudson/model/UpdateCenter.java +++ b/core/src/main/java/hudson/model/UpdateCenter.java @@ -1371,11 +1371,11 @@ public String getConnectionCheckUrl() { * Returns the URL of the server that hosts the update-center.json * file. * + * @return + * Absolute URL that ends with '/'. * @deprecated as of 1.333 * With the introduction of multiple update center capability, this information * is now moved to {@link UpdateSite}. - * @return - * Absolute URL that ends with '/'. */ @Deprecated public String getUpdateCenterUrl() { diff --git a/core/src/main/java/hudson/model/View.java b/core/src/main/java/hudson/model/View.java index 384034a8a904..9363e881013e 100644 --- a/core/src/main/java/hudson/model/View.java +++ b/core/src/main/java/hudson/model/View.java @@ -526,8 +526,8 @@ public List getQueueItems() { } /** - * @deprecated Use {@link #getQueueItems()}. As of 1.607 the approximation is no longer needed. * @return The items in the queue. + * @deprecated Use {@link #getQueueItems()}. As of 1.607 the approximation is no longer needed. */ @Deprecated public List getApproximateQueueItemsQuickly() { diff --git a/core/src/main/java/hudson/model/queue/Latch.java b/core/src/main/java/hudson/model/queue/Latch.java index d6fe39a4a933..c8b361958940 100644 --- a/core/src/main/java/hudson/model/queue/Latch.java +++ b/core/src/main/java/hudson/model/queue/Latch.java @@ -64,8 +64,7 @@ public synchronized void abort(Throwable cause) { * Waits for N threads to enter the {@link #synchronize()} method, then * returns. * - * @return - * returns normally if N threads successfully synchronized. + * returns normally if N threads successfully synchronized. * @throws InterruptedException * if any of the threads that were synchronizing get interrupted, * or if the {@link #abort(Throwable)} is called. diff --git a/core/src/main/java/hudson/security/SecurityRealm.java b/core/src/main/java/hudson/security/SecurityRealm.java index 50a0cbd03f30..1c238c6b8a64 100644 --- a/core/src/main/java/hudson/security/SecurityRealm.java +++ b/core/src/main/java/hudson/security/SecurityRealm.java @@ -395,10 +395,10 @@ public boolean allowsSignup() { /** * Shortcut for {@link UserDetailsService#loadUserByUsername(String)}. * - * @throws UserMayOrMayNotExistException2 - * If the security realm cannot even tell if the user exists or not. * @return * never null. + * @throws UserMayOrMayNotExistException2 + * If the security realm cannot even tell if the user exists or not. * @since 2.266 */ public UserDetails loadUserByUsername2(String username) throws UsernameNotFoundException { diff --git a/core/src/main/java/hudson/triggers/Trigger.java b/core/src/main/java/hudson/triggers/Trigger.java index 4899b8f48445..5fea10010ab4 100644 --- a/core/src/main/java/hudson/triggers/Trigger.java +++ b/core/src/main/java/hudson/triggers/Trigger.java @@ -310,12 +310,12 @@ public void run(AbstractProject p) { } } - @SuppressFBWarnings("MS_SHOULD_BE_FINAL") - @Restricted(NoExternalUse.class) - @RestrictedSince("2.289") /** * Used to be milliseconds, now is seconds since Jenkins 2.289. */ + @SuppressFBWarnings("MS_SHOULD_BE_FINAL") + @Restricted(NoExternalUse.class) + @RestrictedSince("2.289") public static /* non-final for Groovy */ long CRON_THRESHOLD = SystemProperties.getLong(Trigger.class.getName() + ".CRON_THRESHOLD", 30L); // Default threshold 30s private static final Logger LOGGER = Logger.getLogger(Trigger.class.getName()); diff --git a/core/src/main/java/hudson/util/KeyedDataStorage.java b/core/src/main/java/hudson/util/KeyedDataStorage.java index 5ff68325e590..0f98df436dc1 100644 --- a/core/src/main/java/hudson/util/KeyedDataStorage.java +++ b/core/src/main/java/hudson/util/KeyedDataStorage.java @@ -100,10 +100,10 @@ public synchronized void set(@CheckForNull T value) { * Atomically gets the existing data object if any, or if it doesn't exist * {@link #create(String,Object) create} it and return it. * - * @return - * Item with the specified {@code key}. * @param createParams * Additional parameters needed to create a new data object. Can be null. + * @return + * Item with the specified {@code key}. * @throws IOException Loading error */ public @NonNull T getOrCreate(String key, P createParams) throws IOException { diff --git a/core/src/main/java/hudson/util/jna/RegistryKey.java b/core/src/main/java/hudson/util/jna/RegistryKey.java index f0d7280766cc..cae66d6b1087 100644 --- a/core/src/main/java/hudson/util/jna/RegistryKey.java +++ b/core/src/main/java/hudson/util/jna/RegistryKey.java @@ -60,8 +60,8 @@ private static String combine(String a, String b) { * Converts a Windows buffer to a Java String. * * @param buf buffer - * @throws java.io.UnsupportedEncodingException on error * @return String + * @throws java.io.UnsupportedEncodingException on error */ static String convertBufferToString(byte[] buf) { return new String(buf, 0, buf.length - 2, StandardCharsets.UTF_16LE); diff --git a/pom.xml b/pom.xml index 3dbeb6e38640..75a024bb3e3d 100644 --- a/pom.xml +++ b/pom.xml @@ -485,6 +485,20 @@ THE SOFTWARE. + + + + + + + + + + + + From 8d852984e73f5272bba4a08e26201f56c3bd308f Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Sat, 4 Dec 2021 08:17:02 -0800 Subject: [PATCH 13/17] Minor POM cleanup (#5973) --- core/pom.xml | 6 ++++++ pom.xml | 26 +------------------------- test/pom.xml | 6 ++++++ 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 2982634bac17..4384bb506787 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -380,6 +380,11 @@ THE SOFTWARE. org.fusesource.jansi jansi + + org.jenkins-ci + test-annotations + test + org.junit.jupiter junit-jupiter-api @@ -407,6 +412,7 @@ THE SOFTWARE. org.mockito mockito-inline + ${mockito.version} test diff --git a/pom.xml b/pom.xml index 75a024bb3e3d..423c425c35a0 100644 --- a/pom.xml +++ b/pom.xml @@ -101,6 +101,7 @@ THE SOFTWARE. 1.25 1.22 5.8.2 + 4.1.0 2.17.5 @@ -125,18 +126,6 @@ THE SOFTWARE. - - - org.mockito - mockito-inline - 4.1.0 - - - org.objenesis - objenesis - 3.2 - - @@ -159,19 +148,6 @@ THE SOFTWARE. - - - org.codehaus.mojo - animal-sniffer-annotations - provided - true - - - org.jenkins-ci - test-annotations - test - 1.4 - javax.servlet diff --git a/test/pom.xml b/test/pom.xml index 4e9add7365cb..f4ece531d36d 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -96,6 +96,11 @@ THE SOFTWARE. 2.2 test + + org.jenkins-ci + test-annotations + test + org.jenkins-ci.plugins cloudbees-folder @@ -154,6 +159,7 @@ THE SOFTWARE. org.mockito mockito-inline + ${mockito.version} test From 93a64d8f57e22a698f081a021cdebad2e9df4e3e Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Sat, 4 Dec 2021 08:17:46 -0800 Subject: [PATCH 14/17] Bump parent POM from 1.67 to 1.69 (#5990) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- test/pom.xml | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 423c425c35a0..58622861cc38 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ THE SOFTWARE. org.jenkins-ci jenkins - 1.67 + 1.69 diff --git a/test/pom.xml b/test/pom.xml index f4ece531d36d..5e0f7427f057 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -95,6 +95,12 @@ THE SOFTWARE. jenkins-test-harness-tools 2.2 test + + + ${project.groupId} + jenkins-test-harness + + org.jenkins-ci From 8fcb26e1de23ee2af498fadeb7a0636324ab04ac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 4 Dec 2021 08:18:06 -0800 Subject: [PATCH 15/17] Bump matrix-auth from 2.6.8 to 2.6.9 (#6008) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- test/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/pom.xml b/test/pom.xml index 5e0f7427f057..5585f1b9fb94 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -122,7 +122,7 @@ THE SOFTWARE. org.jenkins-ci.plugins matrix-auth - 2.6.8 + 2.6.9 test From de1a7e7f4daae63ab4aff70ee90830fed9fb1b58 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 4 Dec 2021 08:19:25 -0800 Subject: [PATCH 16/17] Bump jenkins-test-harness from 1645.vf98fc478f846 to 1666.vd1360abbfe9e (#6007) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- test/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/pom.xml b/test/pom.xml index 5585f1b9fb94..5697f1b22c9d 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -81,7 +81,7 @@ THE SOFTWARE. ${project.groupId} jenkins-test-harness - 1645.vf98fc478f846 + 1666.vd1360abbfe9e test From 14a763b4f5a6ebf97b640ba8f6056fd3f1f51252 Mon Sep 17 00:00:00 2001 From: Tim Jacomb <21194782+timja@users.noreply.github.com> Date: Sat, 4 Dec 2021 16:27:59 +0000 Subject: [PATCH 17/17] Don't enable form element path in unit tests by default (#6004) --- .../jenkins/formelementpath/FormElementPathPageDecorator.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/src/main/java/jenkins/formelementpath/FormElementPathPageDecorator.java b/core/src/main/java/jenkins/formelementpath/FormElementPathPageDecorator.java index 07efd8f0ddd1..b1c3b87d96f1 100644 --- a/core/src/main/java/jenkins/formelementpath/FormElementPathPageDecorator.java +++ b/core/src/main/java/jenkins/formelementpath/FormElementPathPageDecorator.java @@ -2,7 +2,6 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import hudson.Extension; -import hudson.Main; import hudson.model.PageDecorator; import jenkins.util.SystemProperties; @@ -10,7 +9,7 @@ public class FormElementPathPageDecorator extends PageDecorator { @SuppressFBWarnings("MS_SHOULD_BE_FINAL") - private static /*almost final */ boolean ENABLED = Main.isUnitTest || + private static /*almost final */ boolean ENABLED = SystemProperties.getBoolean(FormElementPathPageDecorator.class.getName() + ".enabled"); public boolean isEnabled() {
,B extends Build
> /** * Creates a new project. */ - public Project(ItemGroup parent,String name) { + protected Project(ItemGroup parent,String name) { super(parent,name); } diff --git a/core/src/main/java/hudson/model/Slave.java b/core/src/main/java/hudson/model/Slave.java index aa0f13e47b8f..90b36b2c2b64 100644 --- a/core/src/main/java/hudson/model/Slave.java +++ b/core/src/main/java/hudson/model/Slave.java @@ -164,7 +164,7 @@ public abstract class Slave extends Node implements Serializable { * @deprecated since 2.184 */ @Deprecated - public Slave(String name, String nodeDescription, String remoteFS, String numExecutors, + protected Slave(String name, String nodeDescription, String remoteFS, String numExecutors, Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy, List extends NodeProperty>> nodeProperties) throws FormException, IOException { this(name,nodeDescription,remoteFS,Util.tryParseNumber(numExecutors, 1).intValue(),mode,labelString,launcher,retentionStrategy, nodeProperties); } @@ -173,12 +173,12 @@ public Slave(String name, String nodeDescription, String remoteFS, String numExe * @deprecated since 2009-02-20. */ @Deprecated - public Slave(String name, String nodeDescription, String remoteFS, int numExecutors, + protected Slave(String name, String nodeDescription, String remoteFS, int numExecutors, Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy) throws FormException, IOException { this(name, nodeDescription, remoteFS, numExecutors, mode, labelString, launcher, retentionStrategy, new ArrayList()); } - public Slave(@NonNull String name, String remoteFS, ComputerLauncher launcher) throws FormException, IOException { + protected Slave(@NonNull String name, String remoteFS, ComputerLauncher launcher) throws FormException, IOException { this.name = name; this.remoteFS = remoteFS; this.launcher = launcher; @@ -189,7 +189,7 @@ public Slave(@NonNull String name, String remoteFS, ComputerLauncher launcher) t * Use {@link #Slave(String, String, ComputerLauncher)} and set the rest through setters. */ @Deprecated - public Slave(@NonNull String name, String nodeDescription, String remoteFS, int numExecutors, + protected Slave(@NonNull String name, String nodeDescription, String remoteFS, int numExecutors, Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy, List extends NodeProperty>> nodeProperties) throws FormException, IOException { this.name = name; this.description = nodeDescription; diff --git a/core/src/main/java/hudson/model/labels/LabelExpression.java b/core/src/main/java/hudson/model/labels/LabelExpression.java index 8443174fdb6b..00a81c271555 100644 --- a/core/src/main/java/hudson/model/labels/LabelExpression.java +++ b/core/src/main/java/hudson/model/labels/LabelExpression.java @@ -121,7 +121,7 @@ static String paren(LabelOperatorPrecedence op, Label l) { public abstract static class Binary extends LabelExpression { public final Label lhs,rhs; - public Binary(Label lhs, Label rhs, LabelOperatorPrecedence op) { + protected Binary(Label lhs, Label rhs, LabelOperatorPrecedence op) { super(combine(lhs, rhs, op)); this.lhs = lhs; this.rhs = rhs; diff --git a/core/src/main/java/hudson/node_monitors/AbstractDiskSpaceMonitor.java b/core/src/main/java/hudson/node_monitors/AbstractDiskSpaceMonitor.java index c5790a436f8b..dce9ca3e14e1 100644 --- a/core/src/main/java/hudson/node_monitors/AbstractDiskSpaceMonitor.java +++ b/core/src/main/java/hudson/node_monitors/AbstractDiskSpaceMonitor.java @@ -18,12 +18,12 @@ public abstract class AbstractDiskSpaceMonitor extends NodeMonitor { */ public final String freeSpaceThreshold; - public AbstractDiskSpaceMonitor(String threshold) throws ParseException { + protected AbstractDiskSpaceMonitor(String threshold) throws ParseException { this.freeSpaceThreshold = threshold; DiskSpace.parse(threshold); // make sure it parses } - public AbstractDiskSpaceMonitor() { + protected AbstractDiskSpaceMonitor() { this.freeSpaceThreshold = "1GB"; } diff --git a/core/src/main/java/hudson/slaves/AbstractCloudSlave.java b/core/src/main/java/hudson/slaves/AbstractCloudSlave.java index f466f8a957c3..2197d8eb138f 100644 --- a/core/src/main/java/hudson/slaves/AbstractCloudSlave.java +++ b/core/src/main/java/hudson/slaves/AbstractCloudSlave.java @@ -44,7 +44,7 @@ */ public abstract class AbstractCloudSlave extends Slave { - public AbstractCloudSlave(@NonNull String name, String remoteFS, ComputerLauncher launcher) + protected AbstractCloudSlave(@NonNull String name, String remoteFS, ComputerLauncher launcher) throws FormException, IOException { super(name, remoteFS, launcher); } @@ -54,7 +54,7 @@ public AbstractCloudSlave(@NonNull String name, String remoteFS, ComputerLaunche * @deprecated since 2.184 */ @Deprecated - public AbstractCloudSlave(String name, String nodeDescription, String remoteFS, String numExecutors, + protected AbstractCloudSlave(String name, String nodeDescription, String remoteFS, String numExecutors, Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy, List extends NodeProperty>> nodeProperties) throws FormException, IOException { @@ -66,7 +66,7 @@ public AbstractCloudSlave(String name, String nodeDescription, String remoteFS, * @deprecated since 2.184 */ @Deprecated - public AbstractCloudSlave(String name, String nodeDescription, String remoteFS, int numExecutors, + protected AbstractCloudSlave(String name, String nodeDescription, String remoteFS, int numExecutors, Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy, List extends NodeProperty>> nodeProperties) throws FormException, IOException { diff --git a/core/src/main/java/hudson/slaves/ComputerLauncherFilter.java b/core/src/main/java/hudson/slaves/ComputerLauncherFilter.java index a1c34816f644..ddc6ea0afa59 100644 --- a/core/src/main/java/hudson/slaves/ComputerLauncherFilter.java +++ b/core/src/main/java/hudson/slaves/ComputerLauncherFilter.java @@ -41,7 +41,7 @@ public abstract class ComputerLauncherFilter extends ComputerLauncher { protected volatile ComputerLauncher core; - public ComputerLauncherFilter(ComputerLauncher core) { + protected ComputerLauncherFilter(ComputerLauncher core) { this.core = core; } diff --git a/core/src/main/java/hudson/tasks/CommandInterpreter.java b/core/src/main/java/hudson/tasks/CommandInterpreter.java index fc916af2e126..f9e8c24344a7 100644 --- a/core/src/main/java/hudson/tasks/CommandInterpreter.java +++ b/core/src/main/java/hudson/tasks/CommandInterpreter.java @@ -67,7 +67,7 @@ public abstract class CommandInterpreter extends Builder implements EnvVarsFilte @Restricted(Beta.class) protected List configuredLocalRules = new ArrayList<>(); - public CommandInterpreter(String command) { + protected CommandInterpreter(String command) { this.command = command; } diff --git a/core/src/main/java/hudson/tools/AbstractCommandInstaller.java b/core/src/main/java/hudson/tools/AbstractCommandInstaller.java index cacc9820758f..d3dd0d4daf21 100644 --- a/core/src/main/java/hudson/tools/AbstractCommandInstaller.java +++ b/core/src/main/java/hudson/tools/AbstractCommandInstaller.java @@ -47,7 +47,7 @@ public abstract class AbstractCommandInstaller extends ToolInstaller { private final String command; private final String toolHome; - public AbstractCommandInstaller(String label, String command, String toolHome) { + protected AbstractCommandInstaller(String label, String command, String toolHome) { super(label); this.command = command; this.toolHome = toolHome; diff --git a/core/src/main/java/hudson/tools/DownloadFromUrlInstaller.java b/core/src/main/java/hudson/tools/DownloadFromUrlInstaller.java index 5661efe174c5..c032b9275891 100644 --- a/core/src/main/java/hudson/tools/DownloadFromUrlInstaller.java +++ b/core/src/main/java/hudson/tools/DownloadFromUrlInstaller.java @@ -254,7 +254,7 @@ public static class Installable { */ public abstract class NodeSpecificInstallable extends Installable implements NodeSpecific { - public NodeSpecificInstallable(Installable inst) { + protected NodeSpecificInstallable(Installable inst) { this.id = inst.id; this.name = inst.name; this.url = inst.url; diff --git a/core/src/main/java/hudson/tools/ToolInstallation.java b/core/src/main/java/hudson/tools/ToolInstallation.java index 49a0f0d7e207..7472c009d01d 100644 --- a/core/src/main/java/hudson/tools/ToolInstallation.java +++ b/core/src/main/java/hudson/tools/ToolInstallation.java @@ -103,12 +103,12 @@ public abstract class ToolInstallation extends AbstractDescribableImpl> properties) { + protected ToolInstallation(String name, String home, List extends ToolProperty>> properties) { this.name = name; this.home = home; if(properties!=null) { @@ -258,7 +258,7 @@ protected Object writeReplace() throws Exception { * Subclasses can extend this for data migration from old field storing home directory. */ protected abstract static class ToolConverter extends XStream2.PassthruConverter { - public ToolConverter(XStream2 xstream) { super(xstream); } + protected ToolConverter(XStream2 xstream) { super(xstream); } @Override protected void callback(ToolInstallation obj, UnmarshallingContext context) { String s; diff --git a/core/src/main/java/hudson/util/FormFieldValidator.java b/core/src/main/java/hudson/util/FormFieldValidator.java index 8f5c2619694e..466b65b3e891 100644 --- a/core/src/main/java/hudson/util/FormFieldValidator.java +++ b/core/src/main/java/hudson/util/FormFieldValidator.java @@ -250,7 +250,7 @@ private void _errorWithMarkup(String message, String cssClass) throws IOExceptio @Deprecated public abstract static class URLCheck extends FormFieldValidator { - public URLCheck(StaplerRequest request, StaplerResponse response) { + protected URLCheck(StaplerRequest request, StaplerResponse response) { // can be used to check the existence of any file in file system // or other HTTP URLs inside firewall, so limit this to the admin. super(request, response, true); diff --git a/core/src/main/java/hudson/util/XStream2.java b/core/src/main/java/hudson/util/XStream2.java index f72010157ab2..d04ceabc73ed 100644 --- a/core/src/main/java/hudson/util/XStream2.java +++ b/core/src/main/java/hudson/util/XStream2.java @@ -492,7 +492,7 @@ public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext co public abstract static class PassthruConverter implements Converter { private Converter converter; - public PassthruConverter(XStream2 xstream) { + protected PassthruConverter(XStream2 xstream) { converter = xstream.reflectionConverter; } diff --git a/core/src/main/java/jenkins/security/RSAConfidentialKey.java b/core/src/main/java/jenkins/security/RSAConfidentialKey.java index 8c5f64b31748..35e920535020 100644 --- a/core/src/main/java/jenkins/security/RSAConfidentialKey.java +++ b/core/src/main/java/jenkins/security/RSAConfidentialKey.java @@ -52,11 +52,11 @@ public abstract class RSAConfidentialKey extends ConfidentialKey { private RSAPrivateKey priv; private RSAPublicKey pub; - public RSAConfidentialKey(String id) { + protected RSAConfidentialKey(String id) { super(id); } - public RSAConfidentialKey(Class owner, String shortName) { + protected RSAConfidentialKey(Class owner, String shortName) { this(owner.getName() + '.' + shortName); } diff --git a/core/src/main/java/jenkins/util/InterceptingExecutorService.java b/core/src/main/java/jenkins/util/InterceptingExecutorService.java index 6be88667c741..beb1e363bff8 100644 --- a/core/src/main/java/jenkins/util/InterceptingExecutorService.java +++ b/core/src/main/java/jenkins/util/InterceptingExecutorService.java @@ -19,7 +19,7 @@ public abstract class InterceptingExecutorService implements ExecutorService { private final ExecutorService base; - public InterceptingExecutorService(ExecutorService base) { + protected InterceptingExecutorService(ExecutorService base) { this.base = base; } diff --git a/core/src/main/java/jenkins/util/MarkFindingOutputStream.java b/core/src/main/java/jenkins/util/MarkFindingOutputStream.java index 09d42c0639e0..1c5d52e85cab 100644 --- a/core/src/main/java/jenkins/util/MarkFindingOutputStream.java +++ b/core/src/main/java/jenkins/util/MarkFindingOutputStream.java @@ -15,7 +15,7 @@ public abstract class MarkFindingOutputStream extends OutputStream { private final OutputStream base; - public MarkFindingOutputStream(OutputStream base) { + protected MarkFindingOutputStream(OutputStream base) { this.base = base; } diff --git a/core/src/main/java/jenkins/util/groovy/AbstractGroovyViewModule.java b/core/src/main/java/jenkins/util/groovy/AbstractGroovyViewModule.java index 97dc9b22e0c0..ba4391ebee03 100644 --- a/core/src/main/java/jenkins/util/groovy/AbstractGroovyViewModule.java +++ b/core/src/main/java/jenkins/util/groovy/AbstractGroovyViewModule.java @@ -25,7 +25,7 @@ public abstract class AbstractGroovyViewModule extends GroovyObjectSupport { public JenkinsTagLib t; public Namespace st; - public AbstractGroovyViewModule(JellyBuilder b) { + protected AbstractGroovyViewModule(JellyBuilder b) { builder = b; f = builder.namespace(FormTagLib.class); l = builder.namespace(LayoutTagLib.class); diff --git a/core/src/main/java/org/acegisecurity/AcegiSecurityException.java b/core/src/main/java/org/acegisecurity/AcegiSecurityException.java index bfc529de387c..d4e780fe57c4 100644 --- a/core/src/main/java/org/acegisecurity/AcegiSecurityException.java +++ b/core/src/main/java/org/acegisecurity/AcegiSecurityException.java @@ -32,11 +32,11 @@ @Deprecated public abstract class AcegiSecurityException extends NestedRuntimeException { - public AcegiSecurityException(String msg) { + protected AcegiSecurityException(String msg) { super(msg); } - public AcegiSecurityException(String msg, Throwable cause) { + protected AcegiSecurityException(String msg, Throwable cause) { super(msg, cause); } diff --git a/core/src/main/java/org/acegisecurity/AuthenticationException.java b/core/src/main/java/org/acegisecurity/AuthenticationException.java index ff3f9bc9a545..22a3fc398015 100644 --- a/core/src/main/java/org/acegisecurity/AuthenticationException.java +++ b/core/src/main/java/org/acegisecurity/AuthenticationException.java @@ -38,16 +38,16 @@ public abstract class AuthenticationException extends AcegiSecurityException { private Authentication authentication; private Object extraInformation; - public AuthenticationException(String msg) { + protected AuthenticationException(String msg) { super(msg); } - public AuthenticationException(String msg, Object extraInformation) { + protected AuthenticationException(String msg, Object extraInformation) { super(msg); this.extraInformation = extraInformation; } - public AuthenticationException(String msg, Throwable t) { + protected AuthenticationException(String msg, Throwable t) { super(msg, t); } diff --git a/core/src/main/java/org/acegisecurity/providers/AbstractAuthenticationToken.java b/core/src/main/java/org/acegisecurity/providers/AbstractAuthenticationToken.java index 266e581e40d6..63cbeb0aec01 100644 --- a/core/src/main/java/org/acegisecurity/providers/AbstractAuthenticationToken.java +++ b/core/src/main/java/org/acegisecurity/providers/AbstractAuthenticationToken.java @@ -40,11 +40,11 @@ public abstract class AbstractAuthenticationToken implements Authentication { private Object details; private boolean authenticated; - public AbstractAuthenticationToken() { + protected AbstractAuthenticationToken() { this.authorities = new GrantedAuthority[0]; } - public AbstractAuthenticationToken(GrantedAuthority[] authorities) { + protected AbstractAuthenticationToken(GrantedAuthority[] authorities) { this.authorities = authorities; } From a67fc45541cf18a3516b7095c40300110d18a0bf Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Fri, 3 Dec 2021 12:25:16 -0800 Subject: [PATCH 10/17] Fix `BadAnnotationImplementation` Error Prone violation (#5953) --- .../hudson/cli/declarative/MethodBinder.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/src/main/java/hudson/cli/declarative/MethodBinder.java b/core/src/main/java/hudson/cli/declarative/MethodBinder.java index b04747afb88f..08438aac9d87 100644 --- a/core/src/main/java/hudson/cli/declarative/MethodBinder.java +++ b/core/src/main/java/hudson/cli/declarative/MethodBinder.java @@ -31,6 +31,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.List; +import java.util.Objects; import org.kohsuke.args4j.Argument; import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineParser; @@ -171,5 +172,22 @@ public Class extends Annotation> annotationType() { public boolean hidden() { return base.hidden(); } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof ArgumentImpl)) { + return false; + } + ArgumentImpl argument = (ArgumentImpl) o; + return Objects.equals(base, argument.base) && bias == argument.bias; + } + + @Override + public int hashCode() { + return Objects.hash(base, bias); + } } } From 44e96a82b9df68c82033e6b8966b88dfbb1997c0 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Fri, 3 Dec 2021 12:25:25 -0800 Subject: [PATCH 11/17] Enable `CustomImportOrder` and `UnusedImports` Checkstyle checks (#5962) --- core/src/main/java/hudson/logging/LogRecorder.java | 10 +++++----- .../java/hudson/model/DirectoryBrowserSupport.java | 2 -- .../src/main/java/hudson/model/TimeZoneProperty.java | 1 - core/src/main/java/hudson/util/XStream2.java | 6 +++--- core/src/main/java/jenkins/SoloFilePathFilter.java | 7 +++---- core/src/main/java/jenkins/model/Nodes.java | 1 - .../jenkins/security/SuspiciousRequestFilter.java | 3 +-- .../security/s2m/RunningBuildFilePathFilter.java | 12 ++++++------ core/src/main/java/jenkins/views/Header.java | 6 ++---- core/src/main/java/jenkins/views/PartialHeader.java | 3 +-- core/src/main/java/org/jenkins/ui/icon/IconSet.java | 9 ++++----- pom.xml | 6 ++++++ 12 files changed, 31 insertions(+), 35 deletions(-) diff --git a/core/src/main/java/hudson/logging/LogRecorder.java b/core/src/main/java/hudson/logging/LogRecorder.java index 09c7a69cd35b..661212023115 100644 --- a/core/src/main/java/hudson/logging/LogRecorder.java +++ b/core/src/main/java/hudson/logging/LogRecorder.java @@ -31,11 +31,6 @@ import hudson.RestrictedSince; import hudson.Util; import hudson.XmlFile; -import hudson.util.CopyOnWriteList; -import hudson.util.HttpResponses; -import java.util.Objects; -import jenkins.util.MemoryReductionUtil; -import jenkins.model.Jenkins; import hudson.model.AbstractModelObject; import hudson.model.AutoCompletionCandidates; import hudson.model.Computer; @@ -45,6 +40,8 @@ import hudson.remoting.Channel; import hudson.remoting.VirtualChannel; import hudson.slaves.ComputerListener; +import hudson.util.CopyOnWriteList; +import hudson.util.HttpResponses; import hudson.util.RingBufferLogHandler; import hudson.util.XStream2; import java.io.File; @@ -61,6 +58,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.SortedSet; import java.util.TreeMap; @@ -70,7 +68,9 @@ import java.util.logging.LogRecord; import java.util.logging.Logger; import javax.servlet.ServletException; +import jenkins.model.Jenkins; import jenkins.security.MasterToSlaveCallable; +import jenkins.util.MemoryReductionUtil; import net.sf.json.JSONObject; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.NoExternalUse; diff --git a/core/src/main/java/hudson/model/DirectoryBrowserSupport.java b/core/src/main/java/hudson/model/DirectoryBrowserSupport.java index 7ce1db734b09..5ed6f2260905 100644 --- a/core/src/main/java/hudson/model/DirectoryBrowserSupport.java +++ b/core/src/main/java/hudson/model/DirectoryBrowserSupport.java @@ -26,7 +26,6 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import hudson.FilePath; import hudson.Util; - import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -54,7 +53,6 @@ import java.util.stream.Stream; import javax.servlet.ServletException; import javax.servlet.http.HttpServletResponse; - import jenkins.model.Jenkins; import jenkins.security.MasterToSlaveCallable; import jenkins.security.ResourceDomainConfiguration; diff --git a/core/src/main/java/hudson/model/TimeZoneProperty.java b/core/src/main/java/hudson/model/TimeZoneProperty.java index 6c6780d621da..620f3129aafe 100644 --- a/core/src/main/java/hudson/model/TimeZoneProperty.java +++ b/core/src/main/java/hudson/model/TimeZoneProperty.java @@ -2,7 +2,6 @@ import edu.umd.cs.findbugs.annotations.CheckForNull; import edu.umd.cs.findbugs.annotations.NonNull; -import edu.umd.cs.findbugs.annotations.Nullable; import hudson.Extension; import hudson.Util; import hudson.util.FormValidation; diff --git a/core/src/main/java/hudson/util/XStream2.java b/core/src/main/java/hudson/util/XStream2.java index d04ceabc73ed..0802197390b8 100644 --- a/core/src/main/java/hudson/util/XStream2.java +++ b/core/src/main/java/hudson/util/XStream2.java @@ -28,13 +28,16 @@ import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.converters.ConversionException; import com.thoughtworks.xstream.converters.Converter; +import com.thoughtworks.xstream.converters.ConverterLookup; import com.thoughtworks.xstream.converters.ConverterMatcher; +import com.thoughtworks.xstream.converters.ConverterRegistry; import com.thoughtworks.xstream.converters.DataHolder; import com.thoughtworks.xstream.converters.MarshallingContext; import com.thoughtworks.xstream.converters.SingleValueConverter; import com.thoughtworks.xstream.converters.SingleValueConverterWrapper; import com.thoughtworks.xstream.converters.UnmarshallingContext; import com.thoughtworks.xstream.converters.extended.DynamicProxyConverter; +import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; import com.thoughtworks.xstream.core.ClassLoaderReference; import com.thoughtworks.xstream.core.JVM; import com.thoughtworks.xstream.core.util.Fields; @@ -47,9 +50,6 @@ import com.thoughtworks.xstream.mapper.Mapper; import com.thoughtworks.xstream.mapper.MapperWrapper; import com.thoughtworks.xstream.security.AnyTypePermission; -import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; -import com.thoughtworks.xstream.converters.ConverterLookup; -import com.thoughtworks.xstream.converters.ConverterRegistry; import edu.umd.cs.findbugs.annotations.CheckForNull; import edu.umd.cs.findbugs.annotations.NonNull; import hudson.PluginManager; diff --git a/core/src/main/java/jenkins/SoloFilePathFilter.java b/core/src/main/java/jenkins/SoloFilePathFilter.java index 079373cf237f..19a949bfde7a 100644 --- a/core/src/main/java/jenkins/SoloFilePathFilter.java +++ b/core/src/main/java/jenkins/SoloFilePathFilter.java @@ -3,14 +3,13 @@ import edu.umd.cs.findbugs.annotations.Nullable; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import hudson.FilePath; -import jenkins.util.SystemProperties; -import org.kohsuke.accmod.Restricted; -import org.kohsuke.accmod.restrictions.NoExternalUse; - import java.io.File; import java.util.UUID; import java.util.logging.Level; import java.util.logging.Logger; +import jenkins.util.SystemProperties; +import org.kohsuke.accmod.Restricted; +import org.kohsuke.accmod.restrictions.NoExternalUse; /** * Variant of {@link FilePathFilter} that assumes it is the sole actor. diff --git a/core/src/main/java/jenkins/model/Nodes.java b/core/src/main/java/jenkins/model/Nodes.java index 8eaaca810c58..ad35e4fc066f 100644 --- a/core/src/main/java/jenkins/model/Nodes.java +++ b/core/src/main/java/jenkins/model/Nodes.java @@ -32,7 +32,6 @@ import hudson.model.Node; import hudson.model.Queue; import hudson.model.Saveable; -import hudson.model.labels.LabelAtom; import hudson.model.listeners.SaveableListener; import hudson.slaves.EphemeralNode; import hudson.slaves.OfflineCause; diff --git a/core/src/main/java/jenkins/security/SuspiciousRequestFilter.java b/core/src/main/java/jenkins/security/SuspiciousRequestFilter.java index 0e839433a301..9b9f413606d8 100644 --- a/core/src/main/java/jenkins/security/SuspiciousRequestFilter.java +++ b/core/src/main/java/jenkins/security/SuspiciousRequestFilter.java @@ -1,5 +1,6 @@ package jenkins.security; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.io.IOException; import java.util.logging.Logger; import javax.servlet.Filter; @@ -10,8 +11,6 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import jenkins.util.SystemProperties; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.NoExternalUse; diff --git a/core/src/main/java/jenkins/security/s2m/RunningBuildFilePathFilter.java b/core/src/main/java/jenkins/security/s2m/RunningBuildFilePathFilter.java index 091153017e0b..5e4d88757e75 100644 --- a/core/src/main/java/jenkins/security/s2m/RunningBuildFilePathFilter.java +++ b/core/src/main/java/jenkins/security/s2m/RunningBuildFilePathFilter.java @@ -32,18 +32,18 @@ import hudson.model.Queue; import hudson.model.Run; import hudson.remoting.ChannelBuilder; -import jenkins.ReflectiveFilePathFilter; -import jenkins.model.Jenkins; -import jenkins.security.ChannelConfigurator; -import jenkins.util.SystemProperties; -import org.kohsuke.accmod.Restricted; -import org.kohsuke.accmod.restrictions.NoExternalUse; import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; +import jenkins.ReflectiveFilePathFilter; +import jenkins.model.Jenkins; +import jenkins.security.ChannelConfigurator; +import jenkins.util.SystemProperties; +import org.kohsuke.accmod.Restricted; +import org.kohsuke.accmod.restrictions.NoExternalUse; /** * When an agent tries to access build directories on the controller, limit it to those for builds running on that agent. diff --git a/core/src/main/java/jenkins/views/Header.java b/core/src/main/java/jenkins/views/Header.java index 9f4f6ecb3d55..9f235c66d548 100644 --- a/core/src/main/java/jenkins/views/Header.java +++ b/core/src/main/java/jenkins/views/Header.java @@ -1,13 +1,11 @@ package jenkins.views; +import hudson.ExtensionList; +import hudson.ExtensionPoint; import java.util.Optional; - import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.NoExternalUse; -import hudson.ExtensionList; -import hudson.ExtensionPoint; - /** * Extension point that provides capabilities to render a specific header. * diff --git a/core/src/main/java/jenkins/views/PartialHeader.java b/core/src/main/java/jenkins/views/PartialHeader.java index a35eae887840..2bc4255b55a9 100644 --- a/core/src/main/java/jenkins/views/PartialHeader.java +++ b/core/src/main/java/jenkins/views/PartialHeader.java @@ -1,11 +1,10 @@ package jenkins.views; -import java.util.logging.Logger; - import hudson.ExtensionList; import hudson.init.InitMilestone; import hudson.init.Initializer; import hudson.util.AdministrativeError; +import java.util.logging.Logger; import jenkins.model.Jenkins; /** diff --git a/core/src/main/java/org/jenkins/ui/icon/IconSet.java b/core/src/main/java/org/jenkins/ui/icon/IconSet.java index d79b81d3fc44..f43b7a0e40ea 100644 --- a/core/src/main/java/org/jenkins/ui/icon/IconSet.java +++ b/core/src/main/java/org/jenkins/ui/icon/IconSet.java @@ -23,18 +23,17 @@ */ package org.jenkins.ui.icon; +import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; -import org.apache.commons.io.IOUtils; -import org.apache.commons.jelly.JellyContext; -import org.apache.commons.lang.StringUtils; - -import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import org.apache.commons.io.IOUtils; +import org.apache.commons.jelly.JellyContext; +import org.apache.commons.lang.StringUtils; /** * An icon set. diff --git a/pom.xml b/pom.xml index 2b6f3aa87abd..3dbeb6e38640 100644 --- a/pom.xml +++ b/pom.xml @@ -472,6 +472,11 @@ THE SOFTWARE. Imports: https://checkstyle.sourceforge.io/config_imports.html --> + + + + + @@ -479,6 +484,7 @@ THE SOFTWARE. + From 623b7340d5968ce0c23ef51d4e8e0f08e30b5a5e Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Fri, 3 Dec 2021 18:56:50 -0800 Subject: [PATCH 12/17] Enable Javadoc-related Checkstyle checks (#5968) --- core/src/main/java/hudson/FilePath.java | 2 +- core/src/main/java/hudson/ProxyConfiguration.java | 4 ++-- core/src/main/java/hudson/WebAppMain.java | 3 ++- core/src/main/java/hudson/XmlFile.java | 6 +++--- core/src/main/java/hudson/logging/LogRecorder.java | 6 +++--- core/src/main/java/hudson/model/Computer.java | 11 ++++++----- .../model/EnvironmentContributingAction.java | 3 +-- core/src/main/java/hudson/model/ItemGroup.java | 2 +- core/src/main/java/hudson/model/Run.java | 2 +- core/src/main/java/hudson/model/UpdateCenter.java | 4 ++-- core/src/main/java/hudson/model/View.java | 2 +- core/src/main/java/hudson/model/queue/Latch.java | 3 +-- .../main/java/hudson/security/SecurityRealm.java | 4 ++-- core/src/main/java/hudson/triggers/Trigger.java | 6 +++--- .../main/java/hudson/util/KeyedDataStorage.java | 4 ++-- .../src/main/java/hudson/util/jna/RegistryKey.java | 2 +- pom.xml | 14 ++++++++++++++ 17 files changed, 46 insertions(+), 32 deletions(-) diff --git a/core/src/main/java/hudson/FilePath.java b/core/src/main/java/hudson/FilePath.java index 08ace200fe30..fc6d6f39cbc7 100644 --- a/core/src/main/java/hudson/FilePath.java +++ b/core/src/main/java/hudson/FilePath.java @@ -1674,8 +1674,8 @@ public String invoke(File dir, VirtualChannel channel) throws IOException { /** * Deletes this file. - * @throws IOException if it exists but could not be successfully deleted * @return true, for a modicum of compatibility + * @throws IOException if it exists but could not be successfully deleted */ public boolean delete() throws IOException, InterruptedException { act(new Delete()); diff --git a/core/src/main/java/hudson/ProxyConfiguration.java b/core/src/main/java/hudson/ProxyConfiguration.java index 2f764a923df2..cecd40f979a0 100644 --- a/core/src/main/java/hudson/ProxyConfiguration.java +++ b/core/src/main/java/hudson/ProxyConfiguration.java @@ -176,10 +176,10 @@ public String getPassword() { } /** + * @return the encrypted proxy password + * * @deprecated * Use {@link #getSecretPassword()} - * - * @return the encrypted proxy password */ @Deprecated public String getEncryptedPassword() { diff --git a/core/src/main/java/hudson/WebAppMain.java b/core/src/main/java/hudson/WebAppMain.java index c6d0ef776bff..c7fdcced0234 100644 --- a/core/src/main/java/hudson/WebAppMain.java +++ b/core/src/main/java/hudson/WebAppMain.java @@ -120,7 +120,8 @@ public class WebAppMain implements ServletContextListener { } }; - /**This getter returns the int DEFAULT_RING_BUFFER_SIZE from the class RingBufferLogHandler from a static context. + /** + * This getter returns the int DEFAULT_RING_BUFFER_SIZE from the class RingBufferLogHandler from a static context. * Exposes access from RingBufferLogHandler.DEFAULT_RING_BUFFER_SIZE to WebAppMain. * Written for the requirements of JENKINS-50669 * @return int This returns DEFAULT_RING_BUFFER_SIZE diff --git a/core/src/main/java/hudson/XmlFile.java b/core/src/main/java/hudson/XmlFile.java index 755d4a66f662..75bff5fc0f78 100644 --- a/core/src/main/java/hudson/XmlFile.java +++ b/core/src/main/java/hudson/XmlFile.java @@ -263,8 +263,8 @@ public String toString() { * Opens a {@link Reader} that loads XML. * This method uses {@link #sniffEncoding() the right encoding}, * not just the system default encoding. - * @throws IOException Encoding issues * @return Reader for the file. should be close externally once read. + * @throws IOException Encoding issues */ public Reader readRaw() throws IOException { try { @@ -304,10 +304,10 @@ public void writeRawTo(Writer w) throws IOException { /** * Parses the beginning of the file and determines the encoding. * - * @throws IOException - * if failed to detect encoding. * @return * always non-null. + * @throws IOException + * if failed to detect encoding. */ public String sniffEncoding() throws IOException { class Eureka extends SAXException { diff --git a/core/src/main/java/hudson/logging/LogRecorder.java b/core/src/main/java/hudson/logging/LogRecorder.java index 661212023115..4155576a9e9e 100644 --- a/core/src/main/java/hudson/logging/LogRecorder.java +++ b/core/src/main/java/hudson/logging/LogRecorder.java @@ -98,14 +98,14 @@ public class LogRecorder extends AbstractModelObject implements Saveable { private volatile String name; - @Deprecated - @Restricted(NoExternalUse.class) - @RestrictedSince("TODO") /** * No longer used. * * @deprecated use {@link #getLoggers()} */ + @Deprecated + @Restricted(NoExternalUse.class) + @RestrictedSince("TODO") public final transient CopyOnWriteList targets = new CopyOnWriteList<>(); private List loggers = new ArrayList<>(); private static final TargetComparator TARGET_COMPARATOR = new TargetComparator(); diff --git a/core/src/main/java/hudson/model/Computer.java b/core/src/main/java/hudson/model/Computer.java index c6586cd354eb..cbcdb99cd30c 100644 --- a/core/src/main/java/hudson/model/Computer.java +++ b/core/src/main/java/hudson/model/Computer.java @@ -462,10 +462,11 @@ public final Future> connect(boolean forceReconnect) { protected abstract Future> _connect(boolean forceReconnect); /** - * @deprecated Implementation of CLI command "connect-node" moved to {@link hudson.cli.ConnectNodeCommand}. * * @param force * If true cancel any currently pending connect operation and retry from scratch + * + * @deprecated Implementation of CLI command "connect-node" moved to {@link hudson.cli.ConnectNodeCommand}. */ @Deprecated public void cliConnect(boolean force) throws ExecutionException, InterruptedException { @@ -524,10 +525,10 @@ public Future> disconnect() { } /** - * @deprecated Implementation of CLI command "disconnect-node" moved to {@link hudson.cli.DisconnectNodeCommand}. - * * @param cause * Record the note about why you are disconnecting this node + * + * @deprecated Implementation of CLI command "disconnect-node" moved to {@link hudson.cli.DisconnectNodeCommand}. */ @Deprecated public void cliDisconnect(String cause) throws ExecutionException, InterruptedException { @@ -536,10 +537,10 @@ public void cliDisconnect(String cause) throws ExecutionException, InterruptedEx } /** - * @deprecated Implementation of CLI command "offline-node" moved to {@link hudson.cli.OfflineNodeCommand}. - * * @param cause * Record the note about why you are disconnecting this node + * + * @deprecated Implementation of CLI command "offline-node" moved to {@link hudson.cli.OfflineNodeCommand}. */ @Deprecated public void cliOffline(String cause) throws ExecutionException, InterruptedException { diff --git a/core/src/main/java/hudson/model/EnvironmentContributingAction.java b/core/src/main/java/hudson/model/EnvironmentContributingAction.java index 2ffd5675574e..1df68de4c37f 100644 --- a/core/src/main/java/hudson/model/EnvironmentContributingAction.java +++ b/core/src/main/java/hudson/model/EnvironmentContributingAction.java @@ -68,12 +68,11 @@ default void buildEnvironment(@NonNull Run, ?> run, @NonNull EnvVars env) { /** * Called by {@link AbstractBuild} to allow plugins to contribute environment variables. * - * @deprecated Use {@link #buildEnvironment} instead - * * @param build * The calling build. Never null. * @param env * Environment variables should be added to this map. + * @deprecated Use {@link #buildEnvironment} instead */ @Deprecated @Restricted(ProtectedExternally.class) diff --git a/core/src/main/java/hudson/model/ItemGroup.java b/core/src/main/java/hudson/model/ItemGroup.java index 32de4c194b42..72eea584384b 100644 --- a/core/src/main/java/hudson/model/ItemGroup.java +++ b/core/src/main/java/hudson/model/ItemGroup.java @@ -99,8 +99,8 @@ default Stream getItemsStream(Predicate pred) { /** * Gets the {@link Item} inside this group that has a given name, or null if it does not exist. - * @throws AccessDeniedException if the current user has {@link Item#DISCOVER} but not {@link Item#READ} on this item * @return an item whose {@link Item#getName} is {@code name} and whose {@link Item#getParent} is {@code this}, or null if there is no such item, or there is but the current user lacks both {@link Item#DISCOVER} and {@link Item#READ} on it + * @throws AccessDeniedException if the current user has {@link Item#DISCOVER} but not {@link Item#READ} on this item */ @CheckForNull T getItem(String name) throws AccessDeniedException; diff --git a/core/src/main/java/hudson/model/Run.java b/core/src/main/java/hudson/model/Run.java index 0deafc1f586b..37836a9c4c24 100644 --- a/core/src/main/java/hudson/model/Run.java +++ b/core/src/main/java/hudson/model/Run.java @@ -1380,7 +1380,7 @@ public class Artifact { private String treeNodeId; /** - *length of this artifact for files. + * length of this artifact for files. */ private String length; diff --git a/core/src/main/java/hudson/model/UpdateCenter.java b/core/src/main/java/hudson/model/UpdateCenter.java index da936be626c4..4a215ad17f44 100644 --- a/core/src/main/java/hudson/model/UpdateCenter.java +++ b/core/src/main/java/hudson/model/UpdateCenter.java @@ -1371,11 +1371,11 @@ public String getConnectionCheckUrl() { * Returns the URL of the server that hosts the update-center.json * file. * + * @return + * Absolute URL that ends with '/'. * @deprecated as of 1.333 * With the introduction of multiple update center capability, this information * is now moved to {@link UpdateSite}. - * @return - * Absolute URL that ends with '/'. */ @Deprecated public String getUpdateCenterUrl() { diff --git a/core/src/main/java/hudson/model/View.java b/core/src/main/java/hudson/model/View.java index 384034a8a904..9363e881013e 100644 --- a/core/src/main/java/hudson/model/View.java +++ b/core/src/main/java/hudson/model/View.java @@ -526,8 +526,8 @@ public List getQueueItems() { } /** - * @deprecated Use {@link #getQueueItems()}. As of 1.607 the approximation is no longer needed. * @return The items in the queue. + * @deprecated Use {@link #getQueueItems()}. As of 1.607 the approximation is no longer needed. */ @Deprecated public List getApproximateQueueItemsQuickly() { diff --git a/core/src/main/java/hudson/model/queue/Latch.java b/core/src/main/java/hudson/model/queue/Latch.java index d6fe39a4a933..c8b361958940 100644 --- a/core/src/main/java/hudson/model/queue/Latch.java +++ b/core/src/main/java/hudson/model/queue/Latch.java @@ -64,8 +64,7 @@ public synchronized void abort(Throwable cause) { * Waits for N threads to enter the {@link #synchronize()} method, then * returns. * - * @return - * returns normally if N threads successfully synchronized. + * returns normally if N threads successfully synchronized. * @throws InterruptedException * if any of the threads that were synchronizing get interrupted, * or if the {@link #abort(Throwable)} is called. diff --git a/core/src/main/java/hudson/security/SecurityRealm.java b/core/src/main/java/hudson/security/SecurityRealm.java index 50a0cbd03f30..1c238c6b8a64 100644 --- a/core/src/main/java/hudson/security/SecurityRealm.java +++ b/core/src/main/java/hudson/security/SecurityRealm.java @@ -395,10 +395,10 @@ public boolean allowsSignup() { /** * Shortcut for {@link UserDetailsService#loadUserByUsername(String)}. * - * @throws UserMayOrMayNotExistException2 - * If the security realm cannot even tell if the user exists or not. * @return * never null. + * @throws UserMayOrMayNotExistException2 + * If the security realm cannot even tell if the user exists or not. * @since 2.266 */ public UserDetails loadUserByUsername2(String username) throws UsernameNotFoundException { diff --git a/core/src/main/java/hudson/triggers/Trigger.java b/core/src/main/java/hudson/triggers/Trigger.java index 4899b8f48445..5fea10010ab4 100644 --- a/core/src/main/java/hudson/triggers/Trigger.java +++ b/core/src/main/java/hudson/triggers/Trigger.java @@ -310,12 +310,12 @@ public void run(AbstractProject p) { } } - @SuppressFBWarnings("MS_SHOULD_BE_FINAL") - @Restricted(NoExternalUse.class) - @RestrictedSince("2.289") /** * Used to be milliseconds, now is seconds since Jenkins 2.289. */ + @SuppressFBWarnings("MS_SHOULD_BE_FINAL") + @Restricted(NoExternalUse.class) + @RestrictedSince("2.289") public static /* non-final for Groovy */ long CRON_THRESHOLD = SystemProperties.getLong(Trigger.class.getName() + ".CRON_THRESHOLD", 30L); // Default threshold 30s private static final Logger LOGGER = Logger.getLogger(Trigger.class.getName()); diff --git a/core/src/main/java/hudson/util/KeyedDataStorage.java b/core/src/main/java/hudson/util/KeyedDataStorage.java index 5ff68325e590..0f98df436dc1 100644 --- a/core/src/main/java/hudson/util/KeyedDataStorage.java +++ b/core/src/main/java/hudson/util/KeyedDataStorage.java @@ -100,10 +100,10 @@ public synchronized void set(@CheckForNull T value) { * Atomically gets the existing data object if any, or if it doesn't exist * {@link #create(String,Object) create} it and return it. * - * @return - * Item with the specified {@code key}. * @param createParams * Additional parameters needed to create a new data object. Can be null. + * @return + * Item with the specified {@code key}. * @throws IOException Loading error */ public @NonNull T getOrCreate(String key, P createParams) throws IOException { diff --git a/core/src/main/java/hudson/util/jna/RegistryKey.java b/core/src/main/java/hudson/util/jna/RegistryKey.java index f0d7280766cc..cae66d6b1087 100644 --- a/core/src/main/java/hudson/util/jna/RegistryKey.java +++ b/core/src/main/java/hudson/util/jna/RegistryKey.java @@ -60,8 +60,8 @@ private static String combine(String a, String b) { * Converts a Windows buffer to a Java String. * * @param buf buffer - * @throws java.io.UnsupportedEncodingException on error * @return String + * @throws java.io.UnsupportedEncodingException on error */ static String convertBufferToString(byte[] buf) { return new String(buf, 0, buf.length - 2, StandardCharsets.UTF_16LE); diff --git a/pom.xml b/pom.xml index 3dbeb6e38640..75a024bb3e3d 100644 --- a/pom.xml +++ b/pom.xml @@ -485,6 +485,20 @@ THE SOFTWARE. + + + + + + + + + + + + From 8d852984e73f5272bba4a08e26201f56c3bd308f Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Sat, 4 Dec 2021 08:17:02 -0800 Subject: [PATCH 13/17] Minor POM cleanup (#5973) --- core/pom.xml | 6 ++++++ pom.xml | 26 +------------------------- test/pom.xml | 6 ++++++ 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index 2982634bac17..4384bb506787 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -380,6 +380,11 @@ THE SOFTWARE. org.fusesource.jansi jansi