-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Access to compiler internal APIs will fail starting with JDK 16 #222
Comments
As noted [here](google/compile-testing#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: 362396186
As noted [here](google/compile-testing#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: 362396186
As noted [here](google/compile-testing#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
…internal APIs on Java 16
Just mentioning that the |
…internal APIs on Java 16
…ompiler internal APIs on Java 16" This reverts commit 008a719.
…ompiler internal APIs on Java 16" This reverts commit 008a719.
Consider deprecating methods |
@h908714124 is right, but as a workaround: test {
jvmArgs "--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"
useJUnitPlatform()
} would work |
Additional `--add-exports` JVM args were needed for testing. See: google/compile-testing#222
@almogtavor Here's an updated workaround for Gradle: test {
useJUnitPlatform()
// See: https://github.com/google/compile-testing/issues/222
jvmArgs '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED'
jvmArgs '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED'
jvmArgs '--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED'
} Notes:
|
looks like I just hit this
|
Here's the kotlin dsl (which is now the default) equivalent of the above tasks.test.configure {
useJUnitPlatform()
// See: https://github.com/google/compile-testing/issues/222
jvmArgs =listOf(
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"
) |
@xenoterracide This is not the same! By assigning the jvmArgs via the jvmArgs("--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED")
jvmArgs("--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED")
jvmArgs("--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED") |
When trying to run the test with Java 17, there was an issue with assertion accessing internal API. As reported in: google/compile-testing#222. As a fix, replaced asserts with plain text asserts, inspired by google/auto#1004 To be running the test on Java 17. Need to update the processor test to
When trying to run the test with Java 17, there was an issue with assertion accessing internal API. As reported in: google/compile-testing#222. As a fix, replaced asserts with plain text asserts, inspired by google/auto#1004 To be running the test on Java 17. Need to update the processor test to
The `--add-exports=` flags are required after https://openjdk.org/jeps/396 Related to #222 RELNOTES=n/a PiperOrigin-RevId: 592669579
The `--add-exports=` flags are required after https://openjdk.org/jeps/396 Related to #222 RELNOTES=n/a PiperOrigin-RevId: 592675658
As noted [here](google/compile-testing#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
JDK 16 will change the default for the
--illegal-access
flag frompermit
todeny
. This means that, by default, compile-testing tests will fail with messages like this:That can be worked around either by explicitly specifying, on the command line of the JVM running the tests, either
--illegal-access=permit
or--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
. We should document that, and perhaps later find a way to make it unnecessary.The text was updated successfully, but these errors were encountered: