Skip to content

Commit

Permalink
Fix Sysinfo FieldOrder
Browse files Browse the repository at this point in the history
Fixes: #1027
  • Loading branch information
dbwiddis authored and matthiasblaesing committed Oct 16, 2018
1 parent 41d5123 commit 475ae60
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Features
Bug Fixes
---------
* [#1025](https://github.com/java-native-access/jna/pull/1025): Restore java 6 compatibility and introduce animal-sniffer to prevent regressions - [@matthiasblaesing](https://github.com/matthiasblaesing).
* [#1028](https://github.com/java-native-access/jna/pull/1028): Fix Linux LibC.Sysinfo FieldOrder - [@dbwiddis](https://github.com/dbwiddis).

Release 5.0.0
=============
Expand Down
4 changes: 2 additions & 2 deletions contrib/platform/src/com/sun/jna/platform/linux/LibC.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ protected List<Field> getFieldList() {
@Override
protected List<String> getFieldOrder() {
List<String> fieldOrder = new ArrayList<String>(super.getFieldOrder());
if (PADDING_SIZE > 0) {
fieldOrder.add("_f");
if (PADDING_SIZE == 0) {
fieldOrder.remove("_f");
}
return fieldOrder;
}
Expand Down
5 changes: 4 additions & 1 deletion src/com/sun/jna/Structure.java
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,10 @@ protected List<Field> getFields(boolean force) {
if (fieldOrder.size() != flist.size() && flist.size() > 1) {
if (force) {
throw new Error("Structure.getFieldOrder() on " + getClass()
+ " does not provide enough names [" + fieldOrder.size()
+ (fieldOrder.size() < flist.size()
? " does not provide enough"
: " provides too many")
+ " names [" + fieldOrder.size()
+ "] ("
+ sort(fieldOrder)
+ ") to match declared fields [" + flist.size()
Expand Down

0 comments on commit 475ae60

Please sign in to comment.