https://kotlinlang.org logo
Title
s

suresh

01/18/2021, 5:10 AM
I tried to set this option for kotlin compile task - https://youtrack.jetbrains.com/issue/KT-43704#focus=Comments-27-4625141.0-0 , but still not working.
t

Ting-Yuan Huang

01/18/2021, 5:27 AM
Does it work without KSP, namely, in pure Kotlin compilation? Also, have you tried to set the environment variable, e.g.,
export JAVA_OPTS=...
before calling Gradle? It may also worth trying stopping Gradle and Kotlin daemon, e.g.,
./gradlew --stop && pkill -f KotlinCompileDaemon
and try again.
s

suresh

01/18/2021, 7:27 AM
Thanks., yeah
compileKotlin
task is also failing with the same error.
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.util.ResourceBundle.setParent(java.util.ResourceBundle) accessible: module java.base does not "opens java.util" to unnamed module @358e9d30
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
        at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
        at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
        at org.jetbrains.kotlin.com.intellij.util.ReflectionUtil.makeAccessible(ReflectionUtil.java:252)
        at org.jetbrains.kotlin.com.intellij.util.ReflectionUtil.getDeclaredMethod(ReflectionUtil.java:269)
        at org.jetbrains.kotlin.com.intellij.DynamicBundle.<clinit>(DynamicBundle.java:22)
        ... 38 more


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileKotlin'.
I tried all the options like setting JAVA_OPTS, kotlin compile javac args etc
"-Xjavac-arguments=" + listOf(
                    "--add-opens",
                    "java.base/java.util=ALL-UNNAMED"
                ).joinToString(separator = ",")
Nothing worked. Seems like i need to check with kotlin team . Thanks!