The StructsGenerator class assumes that the field order reported through reflection is the source code order. But the Java API explicitly states that "The elements in the array returned are not sorted and are not in any particular order." http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#getDeclaredFields%28%29 The fix is to write an annotation processor (which, when running on source code, receives the fields in source code order), or inspect the class file, require debugging information, and sort the fields by line number.
Reported upstream: https://github.com/fusesource/hawtjni/issues/6
This bug appears to have been reported against 'rawhide' during the Fedora 20 development cycle. Changing version to '20'. More information and reason for this action is here: https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora20
It looks like generated code does not really depend on field order. Both upstream and original reporter confirm that. Closing as NOTABUG.