Is there any way to get a classes declared fields (and methods) in the order of declaration using reflection? According to the documentation, the ordering of Methods and Fie
You won't be able to get the information from the class file. As Adam said in an answer to the refrenced other question:
The elements in the array returned are not sorted and are not in any particular order.
And "no order" includes "no declaration order".
I once used a Java source file parser to get input data for code generators. And this way you'll have fields and methods in declaration order.