You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The build does something related to a Java compilation
And the executor is used with debugging on
The test will fail with an IllegalAccessError:
Caused by: java.lang.IllegalAccessError: class org.gradle.api.internal.tasks.compile.JdkJavaCompiler (in unnamed module @0x25377fa1) cannot access class com.sun.tools.javac.util.Context (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module @0x25377fa1
at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.<init>(JdkJavaCompiler.java:59)
at org.gradle.api.internal.tasks.compile.DefaultJavaCompilerFactory.createTargetCompiler(DefaultJavaCompilerFactory.java:93)
Expected Behavior
TestKit-driven tests should not fail when debugging is on.
Context
The modifications done in order to extract more structured compiler information (#28281) made it necessary to have new --add-exports flags:
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", // Required by JdkTools and JdkJavaCompiler
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"// Required by JdkTools and JdkJavaCompiler
The modification above made sure that normally executed builds were executed with the correct flags.
We've made a mistake and not expanded the list of JVM flags passed to the test executor set by java-gradle-plugin.
This made the behavior differ:
When debugging is off, the Gradle runner is forked, and our standard mechanism adds the flags to the forked java process.
When debugging is on, the Gradle runner is embedded inside the test JVM (i.e. no forking happens), and this necessitates that you already have a JVM with the correct flags applied; otherwise, the IllegalAccessError presented above will happen.
The text was updated successfully, but these errors were encountered:
Current behavior
When:
The test will fail with an
IllegalAccessError
:Expected Behavior
TestKit-driven tests should not fail when debugging is on.
Context
The modifications done in order to extract more structured compiler information (#28281) made it necessary to have new
--add-exports
flags:gradle/platforms/core-runtime/base-services/src/main/java/org/gradle/internal/jvm/JpmsConfiguration.java
Lines 40 to 41 in b47610e
The modification above made sure that normally executed builds were executed with the correct flags.
We've made a mistake and not expanded the list of JVM flags passed to the test executor set by
java-gradle-plugin
.This made the behavior differ:
java
process.IllegalAccessError
presented above will happen.The text was updated successfully, but these errors were encountered: