vendredi 18 mars 2016

Does Kotlin compiler always retain parameter names in bytecode?

In kotlin-reflect, class KParameter has nullable name, and its KDoc says:

Name of this parameter as it was declared in the source code, or null if the parameter has no name or its name is not available at runtime. Examples of nameless parameters include this instance for member functions, extension receiver for extension functions or properties, parameters of Java methods compiled without the debug information, and others.

It says about well-known fact that Java doesn't always include parameter names in bytecode, but it says nothing about Kotlin classes, though there are some others.

Can I assume that Kotlin compiler retains parameter names for functions declared in Kotlin sources? (In particular, I need constructor parameter names).





Aucun commentaire:

Enregistrer un commentaire