Advance options should start with -X

This commit is contained in:
Erik C. Thauvin 2025-04-15 10:51:10 -07:00
parent 9c633116dc
commit 574205d548
Signed by: erik
GPG key ID: 776702A6A2DA330E
2 changed files with 13 additions and 9 deletions

View file

@ -388,7 +388,7 @@ public class CompileOptions {
args.add("-verbose"); args.add("-verbose");
} }
// Wwrror // Werror
if (wError_) { if (wError_) {
args.add("-Werror"); args.add("-Werror");
} }
@ -398,9 +398,15 @@ public class CompileOptions {
args.add("-Wextra"); args.add("-Wextra");
} }
// advanced option (X) // advanced options (X)
if (!advancedOptions_.isEmpty()) { if (!advancedOptions_.isEmpty()) {
advancedOptions_.forEach(it -> args.add("-X" + it)); advancedOptions_.forEach(it -> {
if (it.startsWith("-X")) {
args.add(it);
} else {
args.add("-X" + it);
}
});
} }
return args; return args;
@ -691,7 +697,7 @@ public class CompileOptions {
* Limit the API of the JDK in the classpath to the specified Java version. Automatically sets * Limit the API of the JDK in the classpath to the specified Java version. Automatically sets
* {@link #jvmTarget(String) JVM target} version. * {@link #jvmTarget(String) JVM target} version.
* <p> * <p>
* Possible values are 1.8, 9, 10, ..., 22. The default value is 1.8. * Possible values are 1.8, 9, 10, ..., 23. The default value is 1.8.
* *
* @param version the target version * @param version the target version
* @return this operation instance * @return this operation instance
@ -706,8 +712,6 @@ public class CompileOptions {
* <p> * <p>
* Limit the API of the JDK in the classpath to the specified Java version. Automatically sets * Limit the API of the JDK in the classpath to the specified Java version. Automatically sets
* {@link #jvmTarget(String) JVM target} version. * {@link #jvmTarget(String) JVM target} version.
* <p>
* Possible values are 1.8, 9, 10, ..., 22. The default value is 1.8.
* *
* @param version the target version * @param version the target version
* @return this operation instance * @return this operation instance
@ -731,7 +735,7 @@ public class CompileOptions {
/** /**
* Specify the target version of the generated JVM bytecode. * Specify the target version of the generated JVM bytecode.
* <p> * <p>
* Possible values are 1.8, 9, 10, ..., 22. The default value is 1.8. * Possible values are 1.8, 9, 10, ..., 23. The default value is 1.8.
* *
* @param target the target version * @param target the target version
* @return this operation instance * @return this operation instance

View file

@ -112,7 +112,7 @@ class CompileOptionsTest {
@Test @Test
void testArgsCollections() { void testArgsCollections() {
var advanceOptions = List.of("Xoption1", "Xoption2"); var advanceOptions = List.of("-Xoption1", "option=2");
var argFile = List.of(new File("arg1.txt"), new File("arg2.txt")); var argFile = List.of(new File("arg1.txt"), new File("arg2.txt"));
var classpath = List.of(new File("path1"), new File("path2")); var classpath = List.of(new File("path1"), new File("path2"));
var optIn = List.of("opt1", "opt2"); var optIn = List.of("opt1", "opt2");
@ -160,7 +160,7 @@ class CompileOptionsTest {
"-foo", "-bar", "-foo", "-bar",
"-script-templates", "-script-templates",
"temp1,temp2", "temp1,temp2",
"-XXoption1", "-XXoption2", "-Xoption1", "-Xoption=2",
"-P", "plugin:id:name:value", "-P", "plugin:id:name:value",
"-P", "plugin:id2:name2:value2"); "-P", "plugin:id2:name2:value2");