Skip to content

Commit

Permalink
Update Error Prone to 2.32.0 and only run it on JDK 17+.
Browse files Browse the repository at this point in the history
Error Prone was actually not running on JDK 17+ at all due to profile activation only looking at the first of the JDK version ranges apparently. I don't know if that's a bug, but it seemed to be a valid version range specification according to https://maven.apache.org/enforcer/enforcer-rules/versionRanges.html.

The `-J` flags were also not actually being passed to the compiler, but that wasn't required on JDK 11, so nothing appeared to be broken. `fork` needs to be set to `true` to pass the `-J` flags. See
https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#compilerArgs:
> Note that `-J` options are only passed through if `fork` is set to `true`.

RELNOTES=n/a
PiperOrigin-RevId: 678295410
  • Loading branch information
chaoren authored and Jimfs Team committed Sep 24, 2024
1 parent 694c517 commit 4d4f741
Showing 1 changed file with 7 additions and 23 deletions.
30 changes: 7 additions & 23 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
<auto-common.version>1.2.2</auto-common.version>
<java.version>1.8</java.version>
<guava.version>33.3.1-jre</guava.version>
<errorprone.version>2.31.0</errorprone.version>
<errorprone.version>2.32.0</errorprone.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -282,23 +282,21 @@
<profile>
<id>run-error-prone</id>
<activation>
<!--
Error Prone requires 11+: https://errorprone.info/docs/installation
We skip 12-15 because of https://github.com/google/error-prone/issues/3540.
-->
<jdk>[11,12),[16,)</jdk>
<!-- Error Prone requires 17+: https://errorprone.info/docs/installation. -->
<jdk>[17,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgument>-Xplugin:ErrorProne -Xep:Java8ApiChecker:ERROR</compilerArgument>
<!-- Disable Beta Checker for tests -->
<testCompilerArgument>-Xplugin:ErrorProne -Xep:BetaApi:OFF</testCompilerArgument>
<compilerArgs>
<!-- https://errorprone.info/docs/installation#maven -->
<arg>-XDcompilePolicy=simple</arg>
<arg>-Xplugin:ErrorProne -Xep:Java8ApiChecker:ERROR</arg>
<!-- https://github.com/google/error-prone/blob/f8e33bc460be82ab22256a7ef8b979d7a2cacaba/docs/installation.md#jdk-16 -->
<!-- TODO(cpovirk): Use .mvn/jvm.config instead (per
https://errorprone.info/docs/installation#maven) if it can
be made not to interfere with JDK8 or if we stop building
Expand All @@ -314,22 +312,8 @@
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
</compilerArgs>
<fork>true</fork> <!-- -J options are only passed through if fork is set to true. -->
</configuration>
<executions>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<compilerArgs>
<arg>-XDcompilePolicy=simple</arg>
<arg>-Xplugin:ErrorProne -Xep:BetaApi:OFF</arg> <!-- Disable Beta Checker for tests -->
</compilerArgs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down

0 comments on commit 4d4f741

Please sign in to comment.