Issue with Java modules - missing parameter add-exports

I need to use not exported java classes from sun package. It’s not a general task rather required hack, I need to use these classes on predefined and fixed JVM version on a concrete platform.

With plain java it’s pretty trivial to make them visible - I only need to export them manually with --add-exports parameter. However with Kotlin I got into trouble:

I saw a similar topic with relevant example. So for simplicity let’s assume that I need the same sun.awt.image class.

Is there any way to export these classes with kotlin? Other solutions are also welcome.

3 Likes

Write on the first line of the file @file:Suppress("JAVA_MODULE_DOES_NOT_EXPORT_PACKAGE")

1 Like