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

[Fmt] format() method in java.text.Format requires new FieldPosition object each time

    Details

    • Type: CSR
    • Status: Finalized
    • Priority: P5
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      Hide
      Format.format(Object) is a final method, so subclasses may not be able to override it. Also, DontCareFieldPosition defines a dummy Format.FieldDelegate class and its operations, so any operation invoked on DontCareFieldPosition.INSTANCE is ignored. Considering this, compatibility risk due to the change is minimal
      Show
      Format.format(Object) is a final method, so subclasses may not be able to override it. Also, DontCareFieldPosition defines a dummy Format.FieldDelegate class and its operations, so any operation invoked on DontCareFieldPosition.INSTANCE is ignored. Considering this, compatibility risk due to the change is minimal
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Remove the explanation about the usage of "new FieldPosition(0)" in the Format.format(Object) spec description

      Problem

      The specification for Format.format(Object) gives the implementation detail about the usage of "new FieldPostion(0)", which would be incorrect when the implementation is updated to use DontCareFieldPosition.INSTANCE instead of "new FieldPosition(0)"

      Solution

      Specification of Format.format(Object) should be updated by removing the explanation about the usage of "new FieldPosition(0)"

      Specification

      Updating Format.format(Object)

      from:

      * Formats an object to produce a string. This is equivalent to
      * <blockquote>
      * {@link #format(Object, StringBuffer, FieldPosition) format}<code>(obj,
      *         new StringBuffer(), new FieldPosition(0)).toString();</code>
      * </blockquote>
      *
      * @param obj    The object to format

      to:

      /**
       * Formats an object to produce a string.
       *
       * @param obj    The object to format

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                nishjain Nishit Jain
                Reporter:
                ndcosta Nelson Dcosta
                Reviewed By:
                Naoto Sato
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: