From cdbae3556b2ddb910f923b5d83c4c188a9addf2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Fri, 12 Mar 2021 08:55:32 -0800 Subject: [PATCH] Ensure compilation tests will run on JDK 16+. As noted [here](https://github.com/google/compile-testing/issues/222), the change of the default `--illegal-access` from `permit` to `deny` will cause compile-testing tests to fail by default, with messages like this: ``` class com.google.testing.compile.Parser (in unnamed module @0x4114d843) cannot access class com.sun.tools.javac.api.JavacTool (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.api to unnamed module @0x4114d843 ``` We can work around that by supplying the necessary `--add-opens` flag to the JVM that runs the tests. RELNOTES=n/a PiperOrigin-RevId: 362531170 --- factory/pom.xml | 19 +++++++++++++++++++ value/processor/pom.xml | 17 +++++++++++++++++ value/src/it/functional/pom.xml | 17 +++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/factory/pom.xml b/factory/pom.xml index be10d54960..50d9314b29 100644 --- a/factory/pom.xml +++ b/factory/pom.xml @@ -168,6 +168,14 @@ + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + ${test.jvm.flags} + + maven-jar-plugin 3.2.0 @@ -200,4 +208,15 @@ + + + open-modules + + [9,) + + + --add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED + + + diff --git a/value/processor/pom.xml b/value/processor/pom.xml index b0628bb70e..c7dcff5e57 100644 --- a/value/processor/pom.xml +++ b/value/processor/pom.xml @@ -167,6 +167,14 @@ + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + ${test.jvm.flags} + + org.apache.maven.plugins maven-jar-plugin @@ -232,5 +240,14 @@ -Xdoclint:none + + open-modules + + [9,) + + + --add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED + + diff --git a/value/src/it/functional/pom.xml b/value/src/it/functional/pom.xml index 38554ca4bd..e293fc4509 100644 --- a/value/src/it/functional/pom.xml +++ b/value/src/it/functional/pom.xml @@ -149,6 +149,14 @@ true + + org.apache.maven.plugins + maven-surefire-plugin + 2.22.2 + + ${test.jvm.flags} + + @@ -195,5 +203,14 @@ **/AutoValueJava8Test.java + + open-modules + + [9,) + + + --add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED + +