Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8234810

javadoc of java.util.Arrays.compare(T[] a, T[] b) misses the word "less"

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 14
    • core-libs
    • None
    • behavioral
    • minimal
    • No behavioral change. Minor fix of method-level documentation. The behavior being clarified is confirmed in test/jdk/java/util/Arrays/ArraysEqCmpTest.testNullElementsInObjectArray().
    • Java API
    • SE

      Summary

      The word 'less' is missing in the method-level javadoc of java.util.Arrays.compare(compare(T[] a, T[] b).

      Problem

      The current version of this javadoc is erroneous:

      * A {@code null} array element is considered lexicographically than a
      * non-{@code null} array element. Two {@code null} array elements are
      * considered equal. 

      Solution

      Change to:

      * A {@code null} array element is considered lexicographically less than a
      * non-{@code null} array element. Two {@code null} array elements are
      * considered equal. 

      Specification

      --- old/src/java.base/share/classes/java/util/Arrays.java   2019-11-26 10:25:29.000000000 +0000
      +++ new/src/java.base/share/classes/java/util/Arrays.java   2019-11-26 10:25:29.000000000 +0000
      @@ -7117,10 +7117,10 @@
      -     * A {@code null} array element is considered lexicographically than a
      -     * non-{@code null} array element.  Two {@code null} array elements are
      +     * A {@code null} array element is considered lexicographically less than a
      +     * non-{@code null} array element. Two {@code null} array elements are
            * considered equal.

            jboes Julia Boes (Inactive)
            jboes Julia Boes (Inactive)
            Daniel Fuchs, Lance Andersen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: