Bug 957131

Summary: hawtjni: depends on field order reported through reflection
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: hawtjniAssignee: Mikolaj Izdebski <mizdebsk>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: java-sig-commits, mgoldman, mizdebsk
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1009417 (view as bug list) Environment:
Last Closed: 2013-09-26 04:53:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 957130, 1009417    

Description Florian Weimer 2013-04-26 12:21:11 UTC
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.

Comment 1 Mikolaj Izdebski 2013-04-26 12:52:03 UTC
Reported upstream: https://github.com/fusesource/hawtjni/issues/6

Comment 2 Fedora End Of Life 2013-09-16 16:40:12 UTC
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

Comment 3 Mikolaj Izdebski 2013-09-26 04:53:13 UTC
It looks like generated code does not really depend on field order.
Both upstream and original reporter confirm that.
Closing as NOTABUG.