Reflection to get function parameter names?


Java 8 now has an API to give you the names of parameters, but you need to call javac with -parameters to put the info in the .class files. Is there a way to get Kotlin to do this? Or is there another way I can get parameter names in Kotlin? I'm using reflection to make some functions callable via HTTP requests.  Otherwise I can workaround by repeating the names in an annotation.  

In Java…
String name = obj.getClass().getMethods()[0].getParameters()[0].getName()



Currently there's jet.runtime.typeinfo.JetValueParameter annotation which is written on all Kotlin parameters. You can use it for now, though it is deprecated, but we will drop it only when we provide some other means to retrieve this information (through Kotlin-specific reflection).


Great, thanks!