RFR: JDK-8317612: ChoiceFormat and MessageFormat constructors call non-final public method [v3]

Naoto Sato naoto at openjdk.org
Fri Oct 27 18:04:33 UTC 2023


On Fri, 27 Oct 2023 17:31:43 GMT, Justin Lu <jlu at openjdk.org> wrote:

>> Please review this PR which updates ChoiceFormat and MessageFormat to no longer call overridable methods in their constructors.
>> 
>> The overridable methods called in the constructors are: _ChoiceFormat::applyPattern_, _ChoiceFormat::setChoices_, and _MessageFormat::applyPattern_. The code should be updated so that both the methods and constructors call a separate private method. Some other drive-by cleanup changes were included in the change as well.
>
> Justin Lu has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - additional cleanup/wording changes
>  - replace spec fix with private methods

src/java.base/share/classes/java/text/ChoiceFormat.java line 560:

> 558:      * @see #previousDouble
> 559:      */
> 560:     public static double nextDouble (double d) {

Is removing `final` OK here? Wouldn't this allow defining the static method in the subclass?

src/java.base/share/classes/java/text/ChoiceFormat.java line 575:

> 573:      * @see #nextDouble
> 574:      */
> 575:     public static double previousDouble (double d) {

same here.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16064#discussion_r1374892774
PR Review Comment: https://git.openjdk.org/jdk/pull/16064#discussion_r1374892964


More information about the core-libs-dev mailing list