Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-24521

Update jna from 3.3.0-jenkins to 4.1.0 (or newer)

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • core

      Currently, Jenkins uses a private copy of JNA:

      <dependency>
      <groupId>net.java.dev.jna</groupId>
      <artifactId>jna</artifactId>
      <version>3.3.0-jenkins-3</version>
      </dependency>

      Due to using this private copy of jna, instead of the upstream version,
      Jenkins is not keeping up with the latest fixes that are going into
      JNA. This affects other platforms, such as FreeBSD, and Linux on ARM.

      For example, these bugs are related:

      JENKINS-22425
      JENKINS-21507
      JENKINS-10774

          [JENKINS-24521] Update jna from 3.3.0-jenkins to 4.1.0 (or newer)

          Craig Rodrigues created issue -
          Craig Rodrigues made changes -
          Link New: This issue is related to JENKINS-10774 [ JENKINS-10774 ]
          Craig Rodrigues made changes -
          Link New: This issue is related to JENKINS-22425 [ JENKINS-22425 ]
          Craig Rodrigues made changes -
          Link New: This issue is related to JENKINS-21507 [ JENKINS-21507 ]

          In newer versions of JNA, the com.sun.jna.Structure class has a new abstract method getFieldOrder().
          Third party code which extends com.jna.Structure must define this method, otherwise it will not
          compile against JNA 4.1.0.

          See:

          http://twall.github.io/jna/4.1.0/com/sun/jna/Structure.html#getFieldOrder%28%29

          protected abstract java.util.List getFieldOrder()

          Return this Structure's field names in their proper order. For example,

          protected List getFieldOrder() {
          return Arrays.asList(new String[]

          { ... });
          }


          IMPORTANT When deriving from an existing Structure subclass, ensure that you augment the list provided by the superclass, e.g.


          protected List getFieldOrder() {
          List fields = new ArrayList(super.getFieldOrder());
          fields.addAll(Arrays.asList(new String[] { ... }

          ));
          return fields;
          }

          Field order must be explicitly indicated, since the field order as returned by Class.getFields() is not guaranteed to be predictable.

          Craig Rodrigues added a comment - In newer versions of JNA, the com.sun.jna.Structure class has a new abstract method getFieldOrder(). Third party code which extends com.jna.Structure must define this method, otherwise it will not compile against JNA 4.1.0. See: http://twall.github.io/jna/4.1.0/com/sun/jna/Structure.html#getFieldOrder%28%29 protected abstract java.util.List getFieldOrder() Return this Structure's field names in their proper order. For example, protected List getFieldOrder() { return Arrays.asList(new String[] { ... }); } IMPORTANT When deriving from an existing Structure subclass, ensure that you augment the list provided by the superclass, e.g. protected List getFieldOrder() { List fields = new ArrayList(super.getFieldOrder()); fields.addAll(Arrays.asList(new String[] { ... } )); return fields; } Field order must be explicitly indicated, since the field order as returned by Class.getFields() is not guaranteed to be predictable.

          Craig Rodrigues added a comment - I submitted this pull request to update Jenkins to JNA 4.1.0: https://github.com/jenkinsci/jenkins/pull/1387 It is similar to: https://github.com/jenkinsci/jenkins/pull/1181 but follows the pattern here: http://twall.github.io/jna/4.1.0/com/sun/jna/Structure.html#getFieldOrder%28%29
          Craig Rodrigues made changes -
          Link New: This issue is related to JENKINS-24523 [ JENKINS-24523 ]
          Craig Rodrigues made changes -
          Link New: This issue is related to JENKINS-24524 [ JENKINS-24524 ]
          Craig Rodrigues made changes -
          Link New: This issue is related to JENKINS-24526 [ JENKINS-24526 ]
          Craig Rodrigues made changes -
          Link New: This issue is related to JENKINS-24526 [ JENKINS-24526 ]

            Unassigned Unassigned
            rodrigc Craig Rodrigues
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: