https://kotlinlang.org logo
#getting-started
Title
# getting-started
t

TwoClocks

04/02/2022, 9:36 PM
is there some magic to use JDK modules / incubator code from kotlin? I can write the code, and idea understands it, but I get
Unresolved reference
when building (either in idea, or gradle)
I'm passing
-Xjvm-enable-preview
to the kotlin compiler. But I think that just passes it though to the JVM compiler (maybe?)
it ended up needing a few things. Create java module and add depencies :
Copy code
module ForFuncTest.main {
    requires jdk.incubator.foreign;
    requires kotlin.stdlib;
}
and add
--add-modules=jdk.incubator.foreign
to both compiler and run-time vm args.
You also need to have java 18 as your version of java, as there seems to be no way to specific to gradle whatJDK it should be using.
then gradle works. Intellij is still broken. can't figure it out.
70 Views