How much kotlin runtime depends on JDK runtime?


What subset of JDK default runtime classes kotlin runtime(and reflection maybe) need to be presented in virtual machine? There is a wonderfull project avian, small JVM with reduced classpath, that is capable to create self-contained executables with embedded java bytecode. I want to try it with kotlin, but want know for sure what APIs kotlin can require in runtime.


I guess you would have to look through the kotlin standard library and see which parts of the JDK it uses. I have no idea though whether the compiler adds dependencies to other parts of the JDK.


That can be easily estimated using method count reports we generate for our libraries. We do it to know what impact our libraries could have on android method count limit when being used in an Android application.

But that information could be useful for your case too, because it counts not only those methods that are in the libraries themselves, but also the referenced methods in the external libraries, namely JDK.

You can find these reports in teamcity builds of the libraries, for example here:


Thanks a lot, it is a little bit closer to what I need. Can you point please to a piece of code that generating this report? I want to modify it to expose not only method count, but method names as well.

btw, I tried kotlin with avian - it works well, but andvanced features like reflection or coroutines does not work. But I i build avian with openjdk claspath - everything works fine.


The report is generated by this gradle task:
It’s usage:

The task is implemented with the help of the open source library com.jakewharton.dex:dex-method-list