From 30a151057e3d70bbc802e85a9e28f3fb8905c18c Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Sat, 16 Oct 2021 13:57:32 -0700 Subject: [PATCH 1/2] Reduce usages of Guava --- .../plugins/workflow/steps/FlowInterruptedException.java | 4 ++-- .../org/jenkinsci/plugins/workflow/steps/StepDescriptor.java | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jenkinsci/plugins/workflow/steps/FlowInterruptedException.java b/src/main/java/org/jenkinsci/plugins/workflow/steps/FlowInterruptedException.java index 1e75e819..110ae5a2 100644 --- a/src/main/java/org/jenkinsci/plugins/workflow/steps/FlowInterruptedException.java +++ b/src/main/java/org/jenkinsci/plugins/workflow/steps/FlowInterruptedException.java @@ -24,7 +24,6 @@ package org.jenkinsci.plugins.workflow.steps; -import com.google.common.collect.Sets; import hudson.AbortException; import hudson.Functions; import hudson.model.Executor; @@ -121,7 +120,8 @@ public void handle(Run run, TaskListener listener) { for (InterruptedBuildAction a : run.getActions(InterruptedBuildAction.class)) { boundCauses.addAll(a.getCauses()); } - Collection diff = Sets.difference(new LinkedHashSet<>(causes), boundCauses); + Set diff = new LinkedHashSet<>(causes); + diff.removeAll(boundCauses); if (!diff.isEmpty()) { run.addAction(new InterruptedBuildAction(diff)); for (CauseOfInterruption cause : diff) { diff --git a/src/main/java/org/jenkinsci/plugins/workflow/steps/StepDescriptor.java b/src/main/java/org/jenkinsci/plugins/workflow/steps/StepDescriptor.java index 3e419b09..f8a0dff1 100644 --- a/src/main/java/org/jenkinsci/plugins/workflow/steps/StepDescriptor.java +++ b/src/main/java/org/jenkinsci/plugins/workflow/steps/StepDescriptor.java @@ -25,7 +25,6 @@ package org.jenkinsci.plugins.workflow.steps; import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import hudson.ExtensionList; @@ -66,7 +65,7 @@ public abstract class StepDescriptor extends Descriptor { * if your step cannot trivially handle a null value of a given kind, list that type here. * The Pipeline execution engine will then signal a user error before even starting your step if called in an inappropriate context. * For example, a step requesting a {@link Launcher} may only be run inside a {@code node {…}} block. - * @return typically an {@link ImmutableSet#of(Object)} with context types like {@link TaskListener} or {@link Run} or {@link FilePath} + * @return typically a {@link Collections#unmodifiableSet(Set)} with context types like {@link TaskListener} or {@link Run} or {@link FilePath} */ public abstract Set> getRequiredContext(); From ad86ac5116907ce9c6e8179a2a9d6fc61ad974d8 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Wed, 8 Dec 2021 15:11:40 -0800 Subject: [PATCH 2/2] Update src/main/java/org/jenkinsci/plugins/workflow/steps/StepDescriptor.java Co-authored-by: Jesse Glick --- .../org/jenkinsci/plugins/workflow/steps/StepDescriptor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jenkinsci/plugins/workflow/steps/StepDescriptor.java b/src/main/java/org/jenkinsci/plugins/workflow/steps/StepDescriptor.java index f8a0dff1..924b834f 100644 --- a/src/main/java/org/jenkinsci/plugins/workflow/steps/StepDescriptor.java +++ b/src/main/java/org/jenkinsci/plugins/workflow/steps/StepDescriptor.java @@ -65,7 +65,7 @@ public abstract class StepDescriptor extends Descriptor { * if your step cannot trivially handle a null value of a given kind, list that type here. * The Pipeline execution engine will then signal a user error before even starting your step if called in an inappropriate context. * For example, a step requesting a {@link Launcher} may only be run inside a {@code node {…}} block. - * @return typically a {@link Collections#unmodifiableSet(Set)} with context types like {@link TaskListener} or {@link Run} or {@link FilePath} + * @return a set of context types like {@link TaskListener} or {@link Run} or {@link FilePath} */ public abstract Set> getRequiredContext();