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

ChoiceFormat and MessageFormat constructors call non-final public method

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P4
    • 22
    • core-libs
    • None
    • behavioral
    • low
    • Hide
      A behavioral change that will potentially affect classes that subclass either ChoiceFormat or MessageFormat. Specifically, this would only cause impact on any subclasses that were depending on behavior of the overridden methods in question to also be reflected in the constructors.

      In practice, these classes are very rarely sub-classed, and this is supported by our internal analysis that was performed. The impact should be minimal. Thus a direct fix can be done as opposed to a specification fix.
      Show
      A behavioral change that will potentially affect classes that subclass either ChoiceFormat or MessageFormat. Specifically, this would only cause impact on any subclasses that were depending on behavior of the overridden methods in question to also be reflected in the constructors. In practice, these classes are very rarely sub-classed, and this is supported by our internal analysis that was performed. The impact should be minimal. Thus a direct fix can be done as opposed to a specification fix.
    • Java API
    • SE

    Description

      Summary

      Ensure the overridable methods ChoiceFormat::applyPattern, ChoiceFormat::setChoices, and MessageFormat::applyPattern are no longer invoked in the constructors of their respective classes.

      Problem

      ChoiceFormat::applyPattern, ChoiceFormat::setChoices, and MessageFormat::applyPattern are overridable methods that are invoked by the constructors of their respective classes. Subclasses that override these methods may also inadvertently cause changes in the constructors as well, since it is not specified anywhere that the constructors call these methods directly.

      Solution

      Create additional private visibility methods that both the methods in question and the constructors can call. This ensures that subclasses overriding these methods will not have potential side effects in the constructor as well.

      Specification

      N/A (There is behavioral impact)

      Attachments

        Issue Links

          Activity

            People

              jlu Justin Lu
              jlu Justin Lu
              Naoto Sato
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: