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

[Fmt-Ch] ChoiceFormat claims impossible and unimplemented functionality

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 21, 22
    • core-libs
    • None
    • behavioral
    • minimal
    • There is no compatibility risk, as only unimplemented documentation is removed.
    • Java API
    • SE

      Summary

      Remove unimplemented functionality from parameter description of "formats" in "ChoiceFormat.setChoices(double[] limits, String[] formats)".

      Problem

      setChoices() is currently worded so that formats takes an array of Object that accepts either Format objects or Strings. This is not true as formats takes an array of String. Because of this, the claimed functionality of taking either Format objects or Strings is impossible and unimplemented but exists in the specification.

      Solution

      Remove the unimplemented claim from the parameter description of formats.

      Specification

      --- a/src/java.base/share/classes/java/text/ChoiceFormat.java
      +++ b/src/java.base/share/classes/java/text/ChoiceFormat.java
            * @param formats are the formats you want to use for each limit.
      -     * They can be either Format objects or Strings.
      -     * When formatting with object Y,
      -     * if the object is a NumberFormat, then ((NumberFormat) Y).format(X)
      -     * is called. Otherwise Y.toString() is called.
            * @throws    NullPointerException if {@code limits} or
            *            {@code formats} is {@code null}
            */

            jlu Justin Lu
            webbuggrp Webbug Group
            Lance Andersen, Naoto Sato
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: