From c2229a9f71259d0573d8c20e93dc1b9bfb470c0d Mon Sep 17 00:00:00 2001 From: cpovirk Date: Thu, 27 Oct 2022 11:05:11 -0700 Subject: [PATCH] Update Error Prone, which requires dropping support for older JDKs, and make builds work with newer JDKs. This should fix the error reported in https://github.com/google/guava/issues/6217#issuecomment-1287990845. I'm not sure if the Error Prone update was necessary for that or if only the `pom.xml` changes were. Still, it seems inevitable that we'll be forced to upgrade Error Prone eventually, and it's rarely a bad idea to update a plugin. This change is progress toward building and testing under Java 17 (https://github.com/google/guava/issues/5801)... ...which we apparently regressed at when we enabled Error Prone (https://github.com/google/guava/issues/2484). I've set this change up in a way that lets builds continue to work under JDK8 (which is potentially useful for https://github.com/google/guava/issues/3990 or for anyone building Guava manually with an old JDK), albeit with Error Prone disabled. RELNOTES=n/a PiperOrigin-RevId: 484299394 --- android/pom.xml | 79 +++++++++++++++++++++++++++++++++++++++++++++---- pom.xml | 79 +++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 146 insertions(+), 12 deletions(-) diff --git a/android/pom.xml b/android/pom.xml index c4c5d7baa2f8..bdeb5c35fa58 100644 --- a/android/pom.xml +++ b/android/pom.xml @@ -135,16 +135,22 @@ doesnotexist -XDcompilePolicy=simple - -Xplugin:ErrorProne + com.google.errorprone error_prone_core - - 2.10.0 + 2.16 + + true @@ -439,9 +445,8 @@ - - jdk8 + javac9-for-jdk8 1.8 @@ -451,7 +456,26 @@ org.apache.maven.plugins maven-compiler-plugin - true + -J-Xbootclasspath/p:${settings.localRepository}/com/google/errorprone/javac/${javac.version}/javac-${javac.version}.jar @@ -460,5 +484,48 @@ + + new-enough-for-error-prone + + [9,) + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + + -Xplugin:ErrorProne -Xep:NullArgumentForNonNullParameter:OFF + + + -J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED + + + + + + diff --git a/pom.xml b/pom.xml index 826f05864dd2..ab84d3f8cd39 100644 --- a/pom.xml +++ b/pom.xml @@ -136,16 +136,22 @@ doesnotexist -XDcompilePolicy=simple - -Xplugin:ErrorProne + com.google.errorprone error_prone_core - - 2.10.0 + 2.16 + + true @@ -446,9 +452,8 @@ - - jdk8 + javac9-for-jdk8 1.8 @@ -458,7 +463,26 @@ org.apache.maven.plugins maven-compiler-plugin - true + -J-Xbootclasspath/p:${settings.localRepository}/com/google/errorprone/javac/${javac.version}/javac-${javac.version}.jar @@ -467,5 +491,48 @@ + + new-enough-for-error-prone + + [9,) + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + + -Xplugin:ErrorProne -Xep:NullArgumentForNonNullParameter:OFF + + + -J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED + -J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED + -J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED + + + + + +