Skip to content

Commit bf237a4

Browse files
committed
Enable -XprintProcessorInfo and -XprintRounds when .verbose(true) on ECJ compilers
1 parent 90cc0f9 commit bf237a4

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

java-compiler-testing/src/main/java/io/github/ascopes/jct/compilers/ecj/EcjJctFlagBuilderImpl.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
public final class EcjJctFlagBuilderImpl implements JctFlagBuilder {
3434

3535
private static final String VERBOSE = "-verbose";
36+
private static final String PRINT_ANNOTATION_PROCESSOR_INFO = "-XprintProcessorInfo";
37+
private static final String PRINT_ANNOTATION_PROCESSOR_ROUNDS = "-XprintRounds";
3638
private static final String ENABLE_PREVIEW = "--enable-preview";
3739
private static final String NOWARN = "-nowarn";
3840
private static final String FAIL_ON_WARNING = "--failOnWarning";
@@ -55,7 +57,9 @@ public EcjJctFlagBuilderImpl() {
5557

5658
@Override
5759
public EcjJctFlagBuilderImpl verbose(boolean enabled) {
58-
return addFlagIfTrue(enabled, VERBOSE);
60+
return addFlagIfTrue(enabled, VERBOSE)
61+
.addFlagIfTrue(enabled, PRINT_ANNOTATION_PROCESSOR_INFO)
62+
.addFlagIfTrue(enabled, PRINT_ANNOTATION_PROCESSOR_ROUNDS);
5963
}
6064

6165
@Override

java-compiler-testing/src/test/java/io/github/ascopes/jct/tests/unit/compilers/ecj/EcjJctFlagBuilderImplTest.java

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,34 @@ void setUp() {
5757
@Nested
5858
class VerboseFlagTest {
5959

60-
@DisplayName("Setting .verbose(true) adds the '-verbose' flag")
61-
@Test
62-
void addsFlagIfTrue() {
60+
@DisplayName("Setting .verbose(true) adds the expected flags")
61+
@ValueSource(strings = {
62+
"-verbose",
63+
"-XprintProcessorInfo",
64+
"-XprintRounds",
65+
})
66+
@ParameterizedTest(name = "for \"{0}\"")
67+
void addsFlagIfTrue(String flag) {
6368
// When
6469
flagBuilder.verbose(true);
6570

6671
// Then
67-
assertThat(flagBuilder.build()).contains("-verbose");
72+
assertThat(flagBuilder.build()).contains(flag);
6873
}
6974

70-
@DisplayName("Setting .verbose(false) does not add the '-verbose' flag")
71-
@Test
72-
void doesNotAddFlagIfFalse() {
75+
@DisplayName("Setting .verbose(false) does not add the expected flags")
76+
@ValueSource(strings = {
77+
"-verbose",
78+
"-XprintProcessorInfo",
79+
"-XprintRounds",
80+
})
81+
@ParameterizedTest(name = "for \"{0}\"")
82+
void doesNotAddFlagIfFalse(String flag) {
7383
// When
7484
flagBuilder.verbose(false);
7585

7686
// Then
77-
assertThat(flagBuilder.build()).doesNotContain("-verbose");
87+
assertThat(flagBuilder.build()).doesNotContain(flag);
7888
}
7989

8090
@DisplayName(".verbose(...) returns the flag builder")

0 commit comments

Comments
 (0)