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

java.util.jar.Attributes:equals() javadoc is not accurate

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 13
    • core-libs
    • None
    • behavioral
    • minimal
    • This is only a javadoc change to match the actual behavior of the implementation.
    • Java API
    • SE

      Summary

      The javadoc for java.util.jar.Attributes::equals does not match the actual implementation.

      Problem

      The javadoc for java.util.jar.Attributes::equals indicates that it checks to see if the given object is an instance of Attributes which it does not and the implementation has not changed since JDK 1.2.

      Solution

      Change the javadoc to match the implementation behavior as changing the implementation could potentially impact applications that expect the actual behavior.

      Specification

      Change the javadoc for the equals method from:

      /**
       * Compares the specified Attributes object with this Map for equality.
       * Returns true if the given object is also an instance of Attributes
       * and the two Attributes objects represent the same mappings.
       *
       * @param o the Object to be compared
       * @return true if the specified Object is equal to this Map
       */

      to

      /**
       * Compares the specified object to the underlying
       * {@linkplain Attributes#map map} for equality.
       * Returns true if the given object is also a Map
       * and the two maps represent the same mappings.
       *
       * @param o the Object to be compared
       * @return true if the specified Object is equal to this Map
       */

            lancea Lance Andersen
            lancea Lance Andersen
            Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: