Why cant we see the implementation of kotlin native methods?


When using Kotlin (JVM) in Intellij, I sometimes are wondering how some buildin methods are implemented.
However when I go to their defintion I only get this “compiled code” thing:

Why is this? As kotlin has no native (e.g. x64 machine code) components why cant the source code be shown here?

NOTE: It seems like the go to definition jumps to a library version of a transitive dependency. But still, why cant the decompiler show me the code?


Try downloading the source code, by doing one of the following:

  • Click the Download Sources button in the yellow message on the top.
  • Go to File | Settings | Build, Execution, Deployment | Build Tools | Maven | Importing and check Automatically download Sources.
  • Go to the pom.xml and select Maven | Download Sources.

EDIT: In the case you are using Gradle the process should be very similar.


Those functions are provided as compiler intrinsics, generally because it is actually impossible to implement them without compiler magic.