From 773226a0ae6a2088b4f7c24ff57058623b152794 Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Sun, 5 Jun 2022 14:59:15 +0200 Subject: [PATCH] Drop the dependency on `com.google.errorprone:javac` This new setup matches the upstream Error Prone build configuration and simplifies development against JDK 11+ internal APIs. --- .mvn/jvm.config | 2 +- error-prone-contrib/README.md | 16 ++++++++--- error-prone-contrib/pom.xml | 5 ---- pom.xml | 50 ++++++----------------------------- refaster-compiler/pom.xml | 5 ---- refaster-runner/pom.xml | 5 ---- refaster-support/pom.xml | 5 ---- refaster-test-support/pom.xml | 5 ---- 8 files changed, 21 insertions(+), 72 deletions(-) diff --git a/.mvn/jvm.config b/.mvn/jvm.config index 58e147c35d..b79f9a2384 100644 --- a/.mvn/jvm.config +++ b/.mvn/jvm.config @@ -2,6 +2,7 @@ -XX:SoftRefLRUPolicyMSPerMB=10 -XX:+UseParallelGC --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED +--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED @@ -9,5 +10,4 @@ --add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED ---add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED diff --git a/error-prone-contrib/README.md b/error-prone-contrib/README.md index d1aabd3adc..976abb050b 100644 --- a/error-prone-contrib/README.md +++ b/error-prone-contrib/README.md @@ -33,9 +33,16 @@ Two other goals that one may find relevant: `target/pit-reports/index.html` files. For more information check the [PIT Maven plugin][pitest-maven]. -When loading the project in IntelliJ IDEA (and perhaps other IDEs) errors about -the inaccessibility of `com.sun.tools.javac.*` classes may be reported. If this -happens, configure your IDE to enable the `add-exports` profile. +When running the project's tests in IntelliJ IDEA, you might see the following +error: +``` +java: exporting a package from system module jdk.compiler is not allowed with --release +``` + +If this happens, go to _Settings -> Build, Execution, Deployment -> Compiler -> +Java Compiler_ and deselect the option _Use '--release' option for +cross-compilation (Java 9 and later)_. See [IDEA-288052][idea-288052] for +details. ### Contribution guidelines @@ -335,8 +342,9 @@ Refaster's expressiveness: [forbidden-apis]: https://github.com/policeman-tools/forbidden-apis [fossa]: https://fossa.io [google-java-format]: https://github.com/google/google-java-format +[idea-288052]: https://youtrack.jetbrains.com/issue/IDEA-288052 [maven]: https://maven.apache.org [modernizer-maven-plugin]: https://github.com/gaul/modernizer-maven-plugin -[sonarcloud]: https://sonarcloud.io [pitest]: https://pitest.org [pitest-maven]: https://pitest.org/quickstart/maven +[sonarcloud]: https://sonarcloud.io diff --git a/error-prone-contrib/pom.xml b/error-prone-contrib/pom.xml index 172e1ce548..6e08f611e9 100644 --- a/error-prone-contrib/pom.xml +++ b/error-prone-contrib/pom.xml @@ -69,11 +69,6 @@ jsr305 provided - - com.google.errorprone - javac - provided - com.google.googlejavaformat google-java-format diff --git a/pom.xml b/pom.xml index 3f97c59e47..18c519a12f 100644 --- a/pom.xml +++ b/pom.xml @@ -87,6 +87,7 @@ -XX:SoftRefLRUPolicyMSPerMB=10 -XX:+UseParallelGC --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED + --add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED @@ -94,7 +95,6 @@ --add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED - --add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED @@ -252,11 +252,6 @@ jsr305 3.0.2 - - com.google.errorprone - javac - 9+181-r4173-1 - com.google.googlejavaformat google-java-format @@ -846,13 +841,19 @@ + --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED + --add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED + --add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED + --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED + --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -Xmaxerrs 10000 -Xmaxwarns 10000 true - ${version.jdk} + ${version.jdk} + ${version.jdk} false @@ -1717,41 +1718,6 @@ - - - add-exports - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - --add-exports - jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED - --add-exports - jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED - --add-exports - jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED - --add-exports - jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED - --add-exports - jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED - - - - - - - release diff --git a/refaster-compiler/pom.xml b/refaster-compiler/pom.xml index 08d70253c4..c42c48bfce 100644 --- a/refaster-compiler/pom.xml +++ b/refaster-compiler/pom.xml @@ -37,11 +37,6 @@ jsr305 provided - - com.google.errorprone - javac - provided - com.google.guava guava diff --git a/refaster-runner/pom.xml b/refaster-runner/pom.xml index b605092264..3cb573a17b 100644 --- a/refaster-runner/pom.xml +++ b/refaster-runner/pom.xml @@ -47,11 +47,6 @@ jsr305 provided - - com.google.errorprone - javac - provided - com.google.guava guava diff --git a/refaster-support/pom.xml b/refaster-support/pom.xml index acb83ebf04..3399091920 100644 --- a/refaster-support/pom.xml +++ b/refaster-support/pom.xml @@ -51,11 +51,6 @@ jsr305 provided - - com.google.errorprone - javac - provided - org.junit.jupiter junit-jupiter-api diff --git a/refaster-test-support/pom.xml b/refaster-test-support/pom.xml index 54a014e087..e3de5a80ff 100644 --- a/refaster-test-support/pom.xml +++ b/refaster-test-support/pom.xml @@ -50,11 +50,6 @@ jsr305 provided - - com.google.errorprone - javac - provided - com.google.guava guava