From 06fe7cb5c31cb2e3e0ea8d4c34b920078713d5cd Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Mon, 9 Jan 2017 17:42:08 -0500 Subject: [PATCH] [JENKINS-39134] Steps which traditionally extended AbstractStepExecutionImpl cannot just switch the superclass. --- .../workflow/steps/AbstractStepExecutionImpl.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jenkinsci/plugins/workflow/steps/AbstractStepExecutionImpl.java b/src/main/java/org/jenkinsci/plugins/workflow/steps/AbstractStepExecutionImpl.java index 7cf3688..4e47450 100644 --- a/src/main/java/org/jenkinsci/plugins/workflow/steps/AbstractStepExecutionImpl.java +++ b/src/main/java/org/jenkinsci/plugins/workflow/steps/AbstractStepExecutionImpl.java @@ -16,14 +16,23 @@ * make sure the {@link Step} is {@link Serializable} and do not mark it {@code transient}. * (For a {@link AbstractSynchronousStepExecution} these considerations are irrelevant.) * @author Kohsuke Kawaguchi - * @deprecated Directly extend {@link StepExecution} and avoid Guice. */ -@Deprecated public abstract class AbstractStepExecutionImpl extends StepExecution { + /** + * @deprecated Directly extend {@link StepExecution} and avoid Guice for a new step. + * Or see {@link #AbstractStepExecutionImpl(StepContext)} for an existing step. + */ + @Deprecated protected AbstractStepExecutionImpl() { } + /** + * Constructor for compatibility. + * Retain this constructor and override {@link #onResume} (do not call the {@code super} implementation) + * if your execution historically extended {@link AbstractStepExecutionImpl}, for serial form compatibility. + * For new steps, extend {@link StepExecution} directly. + */ protected AbstractStepExecutionImpl(StepContext context) { super(context); } @@ -33,11 +42,13 @@ protected AbstractStepExecutionImpl(StepContext context) { * Reinject {@link StepContextParameter}s. * The {@link Step} will not be reinjected. */ + // Cannot mark this @Deprecated without producing a warning for overriders. @Override public void onResume() { inject(); } + @Deprecated protected void inject() { try { AbstractStepImpl.prepareInjector(getContext(), null).injectMembers(this);