Skip to content

Commit b8e7c15

Browse files
authored
Merge pull request #81 from jglick/AbstractStepImpl
Allow `AbstractStepImpl` to still be subclassed for serial compatibility
2 parents 9dffceb + d4d5f74 commit b8e7c15

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

Jenkinsfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
buildPlugin(useContainerAgent: true, configurations: [
2-
[ platform: "linux", jdk: "8" ],
32
[ platform: "windows", jdk: "8" ],
43
[ platform: "linux", jdk: "11" ]
54
])

src/main/java/org/jenkinsci/plugins/workflow/steps/AbstractStepImpl.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,28 @@
1010
* Partial convenient step implementation.
1111
* Used with {@link AbstractStepDescriptorImpl} and {@link AbstractStepExecutionImpl}.
1212
* @author Kohsuke Kawaguchi
13-
* @deprecated Directly extend {@link Step} and avoid Guice.
1413
*/
15-
@Deprecated
1614
public abstract class AbstractStepImpl extends Step {
1715

16+
/**
17+
* @deprecated Directly extend {@link Step} and avoid Guice.
18+
* Or see {@link #AbstractStepImpl(boolean)} for an existing step.
19+
*/
20+
@Deprecated
21+
protected AbstractStepImpl() {}
22+
23+
/**
24+
* Constructor for compatibility.
25+
* Retain this constructor and override {@link #start} if your step historically extended {@link AbstractStepImpl},
26+
* and your {@link AbstractStepExecutionImpl} kept a non-{@code transient} reference to the {@link AbstractStepImpl},
27+
* for serial form compatibility.
28+
* For new steps, extend {@link Step} directly.
29+
* @param ignored ignored, just to differentiate this constructor from {@link #AbstractStepImpl()} as a marker that the supertype must be retained
30+
*/
31+
protected AbstractStepImpl(boolean ignored) {}
32+
1833
/** Constructs a step execution automatically according to {@link AbstractStepDescriptorImpl#getExecutionType}. */
19-
@Override public final StepExecution start(StepContext context) throws Exception {
34+
@Override public StepExecution start(StepContext context) throws Exception {
2035
AbstractStepDescriptorImpl d = (AbstractStepDescriptorImpl) getDescriptor();
2136
return prepareInjector(context, this).getInstance(d.getExecutionType());
2237
}

0 commit comments

Comments
 (0)