Not sure if there’s a simple way to disable the “A...
# scripting
m
Not sure if there’s a simple way to disable the “An illegal reflective access operation has occurred” warnings. Is there a way of disabling this warnings? Kotlin Scripts seems great but this warnings are pouting the std out. Not sure how they manage to disable this but last time I use kscript this warnings were not present:
Copy code
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.intellij.util.ReflectionUtil (file:/Users/some-user/.sdkman/candidates/kotlin/1.4.21/lib/kotlin-compiler.jar) to method java.util.ResourceBundle.setParent(java.util.ResourceBundle)
WARNING: Please consider reporting this to the maintainers of com.intellij.util.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Kotlin version 1.4.21-release-351 (JRE 11.0.9.1+1)
this is for kotlin main kts
v
At least you could use
--add-opens
to open up the classes and make the warning go away.
m
can you tell me how to had this option to a kts file?
everything works fine besides that pesky warnings 🙂
v
However you give JVM parameters
Typical would be
-J--add-opens=....
but I don't know whether Kotlin follows that pattern
m
for kscript I think it’s easy
Copy code
@file:KotlinOpts("-J-Xmx5g")
@file:KotlinOpts("-J-server")
@file:CompilerOpts("-jvm-target 1.8")
for kotlin main kts I’m trying to discover because it’s different
KotlinOpts doesn’t seem to be working
I end up switching the shebang from
Copy code
#!/usr/bin/env kotlin
to
Copy code
#!/usr/bin/env kotlinc -J--add-opens=java.base/java.util=ALL-UNNAMED -script
it works but it would be great to add that in a proper way if possible
v
If it's just for you it is fine. If it should be shared and should be as compatible as possible this could be a problem as she-bangs are not really standardized and there are two common interpretations. One works like you wrote it, the other will not
m
you are correct, fortunately this one is just for me 🙂