Skip to content

Commit f960cf8

Browse files
committed
Avoid mutating final fields
1 parent 19557e4 commit f960cf8

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ junit4 = { module = "junit:junit", version = { require = "[4.12,)", prefer = "4.
5353
kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.10.2" }
5454
log4j-core = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" }
5555
log4j-jul = { module = "org.apache.logging.log4j:log4j-jul", version.ref = "log4j" }
56-
maven = { module = "org.apache.maven:apache-maven", version = "3.9.11" }
56+
maven = { module = "org.apache.maven:apache-maven", version = "4.0.0-rc-5" }
5757
mavenSurefirePlugin = { module = "org.apache.maven.plugins:maven-surefire-plugin", version.ref = "surefire" }
5858
memoryfilesystem = { module = "com.github.marschall:memoryfilesystem", version = "2.8.2" }
5959
mockito-bom = { module = "org.mockito:mockito-bom", version = "5.20.0" }

junit-platform-console/src/main/java/org/junit/platform/console/options/TestDiscoveryOptionsMixin.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -68,55 +68,55 @@ public static class SelectorOptions {
6868

6969
@Option(names = { "-u",
7070
"--select-uri" }, paramLabel = "URI", arity = "1..*", converter = SelectorConverter.Uri.class, description = "Select a URI for test discovery. This option can be repeated.")
71-
private final List<UriSelector> selectedUris = new ArrayList<>();
71+
private List<UriSelector> selectedUris = new ArrayList<>();
7272

7373
@Option(names = { "-f",
7474
"--select-file" }, paramLabel = "FILE", arity = "1..*", converter = SelectorConverter.File.class, //
7575
description = "Select a file for test discovery. "
7676
+ "The line and column numbers can be provided as URI query parameters (e.g. foo.txt?line=12&column=34). "
7777
+ "This option can be repeated.")
78-
private final List<FileSelector> selectedFiles = new ArrayList<>();
78+
private List<FileSelector> selectedFiles = new ArrayList<>();
7979

8080
@Option(names = { "-d",
8181
"--select-directory" }, paramLabel = "DIR", arity = "1..*", converter = SelectorConverter.Directory.class, description = "Select a directory for test discovery. This option can be repeated.")
82-
private final List<DirectorySelector> selectedDirectories = new ArrayList<>();
82+
private List<DirectorySelector> selectedDirectories = new ArrayList<>();
8383

8484
@Option(names = { "-o",
8585
"--select-module" }, paramLabel = "NAME", arity = "1..*", converter = SelectorConverter.Module.class, description = "Select single module for test discovery. This option can be repeated.")
86-
private final List<ModuleSelector> selectedModules = new ArrayList<>();
86+
private List<ModuleSelector> selectedModules = new ArrayList<>();
8787

8888
@Option(names = { "-p",
8989
"--select-package" }, paramLabel = "PKG", arity = "1..*", converter = SelectorConverter.Package.class, description = "Select a package for test discovery. This option can be repeated.")
90-
private final List<PackageSelector> selectedPackages = new ArrayList<>();
90+
private List<PackageSelector> selectedPackages = new ArrayList<>();
9191

9292
@Option(names = { "-c",
9393
"--select-class" }, paramLabel = "CLASS", arity = "1..*", converter = SelectorConverter.Class.class, description = "Select a class for test discovery. This option can be repeated.")
94-
private final List<ClassSelector> selectedClasses = new ArrayList<>();
94+
private List<ClassSelector> selectedClasses = new ArrayList<>();
9595

9696
@Option(names = { "-m",
9797
"--select-method" }, paramLabel = "NAME", arity = "1..*", converter = SelectorConverter.Method.class, description = "Select a method for test discovery. This option can be repeated.")
98-
private final List<MethodSelector> selectedMethods = new ArrayList<>();
98+
private List<MethodSelector> selectedMethods = new ArrayList<>();
9999

100100
@Option(names = { "-r",
101101
"--select-resource" }, paramLabel = "RESOURCE", arity = "1..*", converter = SelectorConverter.ClasspathResource.class, description = "Select a classpath resource for test discovery. This option can be repeated.")
102-
private final List<ClasspathResourceSelector> selectedClasspathResources = new ArrayList<>();
102+
private List<ClasspathResourceSelector> selectedClasspathResources = new ArrayList<>();
103103

104104
@Option(names = { "-i",
105105
"--select-iteration" }, paramLabel = "PREFIX:VALUE[INDEX(..INDEX)?(,INDEX(..INDEX)?)*]", arity = "1..*", converter = SelectorConverter.Iteration.class, //
106106
description = "Select iterations for test discovery via a prefixed identifier and a list of indexes or index ranges "
107107
+ "(e.g. method:com.acme.Foo#m()[1..2] selects the first and second iteration of the m() method in the com.acme.Foo class). "
108108
+ "This option can be repeated.")
109-
private final List<IterationSelector> selectedIterations = new ArrayList<>();
109+
private List<IterationSelector> selectedIterations = new ArrayList<>();
110110

111111
@Option(names = { "--select-unique-id",
112112
"--uid" }, paramLabel = "UNIQUE-ID", arity = "1..*", converter = SelectorConverter.UniqueId.class, //
113113
description = "Select a unique id for test discovery. This option can be repeated.")
114-
private final List<UniqueIdSelector> selectedUniqueIds = new ArrayList<>();
114+
private List<UniqueIdSelector> selectedUniqueIds = new ArrayList<>();
115115

116116
@Option(names = "--select", paramLabel = "PREFIX:VALUE", arity = "1..*", converter = SelectorConverter.Identifier.class, //
117117
description = "Select via a prefixed identifier (e.g. method:com.acme.Foo#m selects the m() method in the com.acme.Foo class). "
118118
+ "This option can be repeated.")
119-
private final List<DiscoverySelectorIdentifier> selectorIdentifiers = new ArrayList<>();
119+
private List<DiscoverySelectorIdentifier> selectorIdentifiers = new ArrayList<>();
120120

121121
SelectorOptions() {
122122
}
@@ -147,46 +147,46 @@ public static class FilterOptions {
147147
+ "names that begin with \"Test\" or end with \"Test\" or \"Tests\". " //
148148
+ "When this option is repeated, all patterns will be combined using OR semantics. " //
149149
+ "Default: ${DEFAULT-VALUE}")
150-
private final List<String> includeClassNamePatterns = new ArrayList<>();
150+
private List<String> includeClassNamePatterns = new ArrayList<>();
151151

152152
@Option(names = { "-N",
153153
"--exclude-classname" }, paramLabel = "PATTERN", arity = "1", description = "Provide a regular expression to exclude those classes whose fully qualified names match. " //
154154
+ "When this option is repeated, all patterns will be combined using OR semantics.")
155-
private final List<String> excludeClassNamePatterns = new ArrayList<>();
155+
private List<String> excludeClassNamePatterns = new ArrayList<>();
156156

157157
@Option(names = "--include-package", paramLabel = "PKG", arity = "1", description = "?Provide a package to be included in the test run. This option can be repeated.")
158-
private final List<String> includePackages = new ArrayList<>();
158+
private List<String> includePackages = new ArrayList<>();
159159

160160
@Option(names = "--exclude-package", paramLabel = "PKG", arity = "1", description = "Provide a package to be excluded from the test run. This option can be repeated.")
161-
private final List<String> excludePackages = new ArrayList<>();
161+
private List<String> excludePackages = new ArrayList<>();
162162

163163
@Option(names = "--include-methodname", paramLabel = "PATTERN", arity = "1", description = "Provide a regular expression to include only methods whose fully qualified names without parameters match. " //
164164
+ "When this option is repeated, all patterns will be combined using OR semantics.")
165-
private final List<String> includeMethodNamePatterns = new ArrayList<>();
165+
private List<String> includeMethodNamePatterns = new ArrayList<>();
166166

167167
@Option(names = "--exclude-methodname", paramLabel = "PATTERN", arity = "1", description = "Provide a regular expression to exclude those methods whose fully qualified names without parameters match. " //
168168
+ "When this option is repeated, all patterns will be combined using OR semantics.")
169-
private final List<String> excludeMethodNamePatterns = new ArrayList<>();
169+
private List<String> excludeMethodNamePatterns = new ArrayList<>();
170170

171171
@Option(names = { "-t",
172172
"--include-tag" }, paramLabel = "TAG", arity = "1", description = "Provide a tag or tag expression to include only tests whose tags match. "
173173
+ //
174174
"When this option is repeated, all patterns will be combined using OR semantics.")
175-
private final List<String> includedTags = new ArrayList<>();
175+
private List<String> includedTags = new ArrayList<>();
176176

177177
@Option(names = { "-T",
178178
"--exclude-tag" }, paramLabel = "TAG", arity = "1", description = "Provide a tag or tag expression to exclude those tests whose tags match. "
179179
+ //
180180
"When this option is repeated, all patterns will be combined using OR semantics.")
181-
private final List<String> excludedTags = new ArrayList<>();
181+
private List<String> excludedTags = new ArrayList<>();
182182

183183
@Option(names = { "-e",
184184
"--include-engine" }, paramLabel = "ID", arity = "1", description = "Provide the ID of an engine to be included in the test run. This option can be repeated.")
185-
private final List<String> includedEngines = new ArrayList<>();
185+
private List<String> includedEngines = new ArrayList<>();
186186

187187
@Option(names = { "-E",
188188
"--exclude-engine" }, paramLabel = "ID", arity = "1", description = "Provide the ID of an engine to be excluded from the test run. This option can be repeated.")
189-
private final List<String> excludedEngines = new ArrayList<>();
189+
private List<String> excludedEngines = new ArrayList<>();
190190

191191
private void applyTo(TestDiscoveryOptions result) {
192192
result.setIncludedClassNamePatterns(this.includeClassNamePatterns);
@@ -207,10 +207,10 @@ public static class RuntimeConfigurationOptions {
207207
@Option(names = { "-" + CP_OPTION, "--classpath",
208208
"--class-path" }, converter = ClasspathEntriesConverter.class, paramLabel = "PATH", arity = "1", description = "Provide additional classpath entries "
209209
+ "-- for example, for adding engines and their dependencies. This option can be repeated.")
210-
private final List<Path> additionalClasspathEntries = new ArrayList<>();
210+
private List<Path> additionalClasspathEntries = new ArrayList<>();
211211

212212
// Implementation note: the @Option annotation is on a setter method to allow validation.
213-
private final Map<String, String> configurationParameters = new LinkedHashMap<>();
213+
private Map<String, String> configurationParameters = new LinkedHashMap<>();
214214

215215
@Option(names = "--config-resource", paramLabel = "PATH", arity = "1", description = "Set configuration parameters for test discovery and execution via a classpath resource. This option can be repeated.")
216216
private List<String> configurationParametersResources = new ArrayList<>();

0 commit comments

Comments
 (0)