Thank you very much. Task was: fill the data class with data and obtain instance of it. I did it via kclazz.primaryConstructor!!.call(*constructorArgsList.toTypedArray()) - but If there is no guarantee of order so I used
kclazz.primaryConstructor!!.callBy(constructorArgsMap) and natural ordered paramaters come now from kclazz.primaryConstructor!!.parameters.
I’m not 100% sure but I think if you would use kapt to process the fields of a class you can get the fields in declaration order. You could then create some extension methods giving you the fields by index or something else depending on your need. I can’t however remember how exactly to achieve this.
Found it. If you use kapt you can get a TypeElement of the class you annotate. getEnclosedElements returns all elements (fields, constructors, nested classes, methods, etc) in native (source code) order.