Reading Kotlin source for builtins


#1

Looking through the source for Numbers.kt, I see no function bodies. It looks similar to java native methods, but there is no special annotation. I assume these are implemented natively.  Is the source for these and other builtin functions avaiable in the repo? Where might I find it?


#2

"Methods" of primitive classes are implemented as so-called "intrinsics": i.e. compiled directly to corresponding byte-code instructions.

Other classes from built-ins are implemented in Java in the “runtime” module, although we are in the process of migrating them to Kotlin.


#3

Where then might I look to modify the source for types like Char? specifically I am looking to do something for issue http://youtrack.jetbrains.com/issue/KT-4371


#4

To fix this issue you don't need to modify any intrinsics: a simple extension function in the standard library would do.