Skip to content

Commit 39f69dc

Browse files
committed
Stop passing --ojf from the benchmarks and the Gradle plugin's native step
2.98.0.2 took the style flags out of the CLI, and such a flag now only prints a warning. 894f4a5 removed --ojf from the two formatter services; two more places still passed it. The Spotless step that runs the native binary ignores stderr when the exit code is 0, so its warning went unseen, and the benchmarks, which inherit the formatter's output, printed it on every run. The formatted output is the same with and without the flag.
1 parent 9182725 commit 39f69dc

2 files changed

Lines changed: 4 additions & 6 deletions

File tree

‎gradle-open-java-format/src/main/java/com/palantir/javaformat/gradle/spotless/NativePalantirJavaFormatStep.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ String format(ProcessRunner runner, String input) throws IOException, Interrupte
6262
logger.info("Using native-image at {}", execFile);
6363
execSignature = FileSignature.signAsSet(execFile);
6464
List<String> argumentsWithPathToExe =
65-
List.of(execSignature.getOnlyFile().getAbsolutePath(), "--ojf", "-");
65+
List.of(execSignature.getOnlyFile().getAbsolutePath(), "-");
6666
return runner.exec(input.getBytes(StandardCharsets.UTF_8), argumentsWithPathToExe)
6767
.assertExitZero(StandardCharsets.UTF_8);
6868
}

‎open-java-format-benchmarks/src/jmh/java/com/palantir/javaformat/BenchmarkMultiFiles.java‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public final void runNativeImage(BenchmarkState state) throws InterruptedExcepti
8686
ProcessBuilder p = new ProcessBuilder();
8787
p.command(Stream.concat(
8888
Stream.of(
89-
Path.of(System.getenv("NATIVE_IMAGE_CLASSPATH")).toString(), "-i", "--ojf"),
89+
Path.of(System.getenv("NATIVE_IMAGE_CLASSPATH")).toString(), "-i"),
9090
state.filesToFormat.stream())
9191
.collect(Collectors.toList()));
9292
Process process = p.inheritIO().start();
@@ -98,8 +98,7 @@ public final void runNativeImage(BenchmarkState state) throws InterruptedExcepti
9898
@OutputTimeUnit(TimeUnit.SECONDS)
9999
public final void runNestedLevel(MultiLevelStates state) throws InterruptedException, IOException {
100100
ProcessBuilder p = new ProcessBuilder();
101-
p.command(List.of(
102-
Path.of(System.getenv("NATIVE_IMAGE_CLASSPATH")).toString(), "-i", "--ojf", state.fileToFormat));
101+
p.command(List.of(Path.of(System.getenv("NATIVE_IMAGE_CLASSPATH")).toString(), "-i", state.fileToFormat));
103102
Process process = p.inheritIO().start();
104103
assertThat(process.waitFor()).isEqualTo(0);
105104
}
@@ -120,8 +119,7 @@ public final void runJar(BenchmarkState state) throws InterruptedException, IOEx
120119
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
121120
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
122121
"com.palantir.javaformat.java.Main",
123-
"-i",
124-
"--ojf"),
122+
"-i"),
125123
state.filesToFormat.stream())
126124
.collect(Collectors.toList()));
127125
Process process = p.inheritIO().start();

0 commit comments

Comments
 (0)