Kotlin-reflect seems to be causing problems for GraalVM!

Updated: Fixed by removing the library but then got other errors.
Hello everyone,

have any of you heard of GraalVM (https://www.graalvm.org/), the new technology that is said to be able to compile Java/Kotlin jar into native code and increase the performance significantly? I have also given it a try and unfortunately got an error, which seems to be because of kotlin-reflect (or so said in [native-image] MalformedParameterizedTypeException when using Kotlin · Issue #374 · oracle/graal · GitHub). I wonder if there is any way to bypass this error? I badly want to see how much GraalVM can improve Kotlin bytecode performance.

Thank you very much.

1 Like

You can turn off reflections, because they could be messing with AOT compilation, and try without them, but if you expect increased performance, you will be disappointed. While AOT could somewhat increase startup time, it won’t greatly affect overall performance. JVM is already very fast.
The main feature of Graal is that it is written in Java and provides runtime compiler interface, which will allow a tremendous amount of possibilities for scripting and embedding.

Yes, you are right, I just figure it out after I posted but then it seems that GraalVM cannot works with JavaFX, either :v (or maybe threading in general) . And I got my hopes up for no reason :frowning:

JavaFX will be separated from JDK in Java 11, so it will be available as a stand-alone component. Then it will work.

I am looking forward to it, but from my experience with Oracle (Java), after something works, something else will fail :smiley: , I doubt that it would ever be as out-of-the-box like Kotlin.

For reference, here’s the related issue: https://youtrack.jetbrains.com/issue/KT-23962

Hello @udalov

Kotlin reflection still does not work with GraalVM native-image. It seems that this is due to an issue on ProGuard that you report to them (ProGuard Java Optimizer and Obfuscator / Bugs / #482 Signature attribute lost in some classes despite -keepattributes Signature).

Do you think there’s a chance that ProGuard fix this issue?

Hi @julien.piccaluga, please report this problem at https://kotl.in/issue and I’ll take a look. I’m not sure if the ProGuard issue is even being looked at, and I guess the best way to see it fixed would be to add a comment there explaining that you’ve met this problem too and are looking for the solution.