Hi, I’m porting a fairly large Kotlin codebase to ...
# getting-started
c
Hi, I’m porting a fairly large Kotlin codebase to run under Java 9/10/11 (in a first instance just being compatible with Java 9 modules using classpath/UNNAMED-MODULE), but am hitting some fairly basic obstacles with the Kotlin compiler. Please reply if you have any experience in this area.
i
I think it's better just to describe the problem.
c
Hi, I am trying to compile some Kotlin code under Java 11 which is using an internal JDK api (eg. com.sun). I am therefore required to inform the compiler (Java) that I need to use this internal API by specifying:
--add-exports java.base/sun.security.x509=UNNAMED-MODULE
. How does one coax the Kotlin compiler to process/pass this directive? PS: I am trying to get this working in both Gradle & IntelliJ (using CE 2019.1 with JBR11)
s
does it help that Kotlin 1.3.30 supports JVM bytecode targets 9, 10, 11, 12? https://youtrack.jetbrains.com/issue/KT-26240
But of course that's just the byte-code and not modularity.
so it seems you just have to include a normal module-info.java into your kotlin project. Here the whole thread: https://discuss.kotlinlang.org/t/kotlin-support-for-java-9-module-system/2499
c
Thanks for the pointers. Unfortunately the above does not deal with my use case problem (eg. Using a JDK internal api within a kotlin source file)
i
@colljos
--add-exports
is not supported yet. You can vote or follow this issue to track progress: https://youtrack.jetbrains.com/issue/KT-20740