Skip to content

Commit

Permalink
Fixes #1625 issue by caching the field list and validation state in a…
Browse files Browse the repository at this point in the history
…ddition to the existing layoutInfo and fieldOrder caches.
  • Loading branch information
brettwooldridge committed Sep 20, 2024
1 parent f38cabe commit cbd1dcd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/com/sun/jna/Structure.java
Original file line number Diff line number Diff line change
Expand Up @@ -1018,10 +1018,10 @@ protected void sortFields(List<Field> fields, List<String> names) {
*/
protected List<Field> getFieldList() {
synchronized (fieldList) {
return fieldList.computeIfAbsent(getClass(), (c) -> {
return fieldList.computeIfAbsent(getClass(), (clazz) -> {
List<Field> flist = new ArrayList<>();
List<Field> classFields = new ArrayList<>();
for (Class<?> cls = getClass();
for (Class<?> cls = clazz;
!cls.equals(Structure.class);
cls = cls.getSuperclass()) {
for (Field field : cls.getDeclaredFields()) {
Expand Down

0 comments on commit cbd1dcd

Please sign in to comment.