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

Specification of the ListFormat.equals() method can be improved

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P3
    • 22
    • core-libs
    • None
    • behavioral
    • minimal
    • This is a wording change only
    • Java API
    • SE

    Description

      Summary

      Refine the wording of ListFormat.equals() method to avoid ambiguity.

      Problem

      The current wording:

      The comparison is based on the Locale and formatting patterns, given or generated with Locale, Type, and Style.

      could read that Type and Style specified at the instance generation with getInstance(Locale, Type, Style) factory method may contribute to the equality of the instances of ListFormat class.

      Solution

      Refine the wording that Type/Style are irrelevant for equality. Only Locale and patterns that can be returned from getLocale() and getPatterns() methods respectively, are considered.

      Unrelated, the redundant wording in the @param tag which refers to null will be removed. The current wording of @return implies it.

      Specification

      Change the method description for ListFormat.equals() method as:

           /**
      -     * Checks if this {@code ListFormat} is equal to another {@code ListFormat}.
      -     * The comparison is based on the {@code Locale} and formatting patterns, given or
      -     * generated with {@code Locale}, {@code Type}, and {@code Style}.
      -     * @param obj the object to check, {@code null} returns {@code false}
      -     * @return {@code true} if this is equals to the other {@code ListFormat}
      +     * Compares the specified object with this {@code ListFormat} for equality.
      +     * Returns {@code true} if the specified object is also a {@code ListFormat}, and
      +     * {@code locale} and {@code patterns}, returned from {@link #getLocale()}
      +     * and {@link #getPatterns()} respectively, are equal.
      +     * @param obj the object to be compared for equality.
      +     * @return {@code true} if the specified object is equal to this {@code ListFormat}
            */

      Attachments

        Issue Links

          Activity

            People

              naoto Naoto Sato
              kganapureddy Krushnareddy Ganapureddy
              Iris Clark, Joe Wang, Roger Riggs
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: