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:
- koltin compiler doesn’t support
--add-exports
- passing
--add-exports
parameter tojavaCompile
task (Gradle) fails - kotlin compiler checks module accessibility by itself and gives an error.
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.