Skip to content

Commit bdde471

Browse files
committed
Enable final field mutation for Maven only on JDK 26 or higher
1 parent fa3e874 commit bdde471

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

platform-tooling-support-tests/src/main/java/platform/tooling/support/ProcessStarters.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,15 @@ public static ProcessStarter maven() {
5555
}
5656

5757
public static ProcessStarter maven(Path javaHome) {
58-
return new ProcessStarter() //
58+
var starter = new ProcessStarter() //
5959
.executable(Path.of(System.getProperty("mavenDistribution")).resolve("bin").resolve(
6060
windowsOrOtherExecutable("mvn.cmd", "mvn")).toAbsolutePath()) //
6161
.putEnvironment("JAVA_HOME", javaHome) //
62-
.putEnvironment("MAVEN_OPTS", "--enable-final-field-mutation=ALL-UNNAMED") //
6362
.addArguments("-Djunit.version=" + Helper.version());
63+
if (Runtime.version().feature() >= 26) {
64+
starter.putEnvironment("MAVEN_OPTS", "--enable-final-field-mutation=ALL-UNNAMED");
65+
}
66+
return starter;
6467
}
6568

6669
private static String windowsOrOtherExecutable(String cmdOrExe, String other) {

0 commit comments

Comments
 (0)