JinwooHwang commented on code in PR #7930:
URL: https://github.com/apache/geode/pull/7930#discussion_r2392516154


##########
gradle.properties:
##########
@@ -64,18 +64,18 @@ geodeDockerImageName = geode:develop
 
 #JAVA_HOME to be used for compilation
 compileJVM=
-compileJVMVer=8
+compileJVMVer=17
 
 #JAVA_HOME to be used by tests
 testJVM=
-testJVMVer=8
+testJVMVer=17
 
 repeat = 100
 
 org.gradle.caching = true
 org.gradle.configureondemand = false
 org.gradle.daemon = true
-org.gradle.jvmargs = -Xmx3g
+org.gradle.jvmargs = -Xmx3g 
--add-exports=java.base/sun.security.x509=ALL-UNNAMED 
--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.parser=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-exports=java.management/com.sun.jmx.remote.security=ALL-UNNAMED

Review Comment:
   Thanks for looking into this! 
   
   Common error stack traces are:
   1. InaccessibleObjectException
   > Task :spotlessJavaCheck FAILED
   Caused by: java.lang.reflect.InaccessibleObjectException:
   Unable to make field private 
com.sun.tools.javac.tree.JCTree$JCModifiers.flags
   accessible: module jdk.compiler does not "opens com.sun.tools.javac.tree"
   to unnamed module @<hash>
   
   2. IllegalAccessError
   > Task :spotlessJavaApply FAILED
   java.lang.IllegalAccessError: class 
com.google.googlejavaformat.java.JavaFormatter
   tried to access class com.sun.tools.javac.tree.JCTree from module 
jdk.compiler
   
   3. Compilation failed due to restricted access
   
   Sometimes Spotless (via google-java-format) just fails silently with:
   
   Execution failed for task ':spotlessJava'.
   > javax.lang.model.type.MirroredTypesException
   
   
   **Spotless configuration** (commit c3c9322647) - resolved with the 
`--add-exports` 
   
   **Regarding the Spotless exports:**
   The PR already includes the necessary configuration in `gradle.properties`:
   - `jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED`
   - `jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED` 
   - `jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED`
   - `jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED`
   - `jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED`
   
   These are the minimum required modules for Google Java Format (used by 
Spotless) to access compiler internals, and they're correctly scoped to 
`ALL-UNNAMED` which limits exposure to unnamed modules only.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to