Skip to content

Commit 8bfeba6

Browse files
committed
cleanup of context constructors
1 parent 6e16d45 commit 8bfeba6

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/ScmContext.groovy

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,17 @@ import static javaposse.jobdsl.dsl.ContextHelper.executeInContext
1818
import static javaposse.jobdsl.dsl.helpers.publisher.PublisherContext.validCloneWorkspaceCriteria
1919

2020
class ScmContext implements Context {
21-
boolean multiEnabled
22-
List<Node> scmNodes = []
23-
List<WithXmlAction> withXmlActions = []
24-
JobManagement jobManagement
21+
private final boolean multiEnabled
22+
final List<Node> scmNodes = []
23+
private final List<WithXmlAction> withXmlActions
24+
private final JobManagement jobManagement
2525

26-
ScmContext(multiEnabled = false, withXmlActions = [], jobManagement = null) {
26+
ScmContext(boolean multiEnabled, List<WithXmlAction> withXmlActions, JobManagement jobManagement) {
2727
this.multiEnabled = multiEnabled
2828
this.withXmlActions = withXmlActions
2929
this.jobManagement = jobManagement
3030
}
3131

32-
// Package scope
33-
ScmContext(Node singleNode, multiEnabled = false) {
34-
this.multiEnabled = multiEnabled
35-
scmNodes << singleNode // Safe since this is the constructor
36-
}
37-
3832
/**
3933
* Helper method for dealing with a single scm node
4034
*/

job-dsl-core/src/main/groovy/javaposse/jobdsl/dsl/helpers/step/StepContext.groovy

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ import static javaposse.jobdsl.dsl.helpers.common.MavenContext.LocalRepositoryLo
1515
class StepContext implements Context {
1616
private static final List<String> VALID_CONTINUATION_CONDITIONS = ['SUCCESSFUL', 'UNSTABLE', 'COMPLETED']
1717

18-
List<Node> stepNodes = []
19-
JobManagement jobManagement
18+
final List<Node> stepNodes = []
19+
private final JobManagement jobManagement
2020

21-
StepContext(List<Node> stepNodes = [], JobManagement jobManagement) {
22-
this.stepNodes = stepNodes
21+
StepContext(JobManagement jobManagement) {
2322
this.jobManagement = jobManagement
2423
}
2524

0 commit comments

Comments
 (0)