RFR: 8329222: java.text.NumberFormat (and subclasses) spec updates [v2]

Naoto Sato naoto at openjdk.org
Tue Apr 16 23:02:00 UTC 2024


On Tue, 16 Apr 2024 22:30:47 GMT, Justin Lu <jlu at openjdk.org> wrote:

>> src/java.base/share/classes/java/text/CompactNumberFormat.java line 78:
>> 
>>> 76:  * installed. Thus, to use an instance method defined by {@code CompactNumberFormat},
>>> 77:  * the {@code NumberFormat} returned by the factory method should first be type
>>> 78:  * checked before cast to {@code CompactNumberFormat}. If the installed locale-sensitive
>> 
>> Since `CompactNumberFormat` does not provide its own instance methods (i.e., instance methods are exactly the same as the parent NumberFormat), "instance methods defined by CompactNF" does not make much sense, which is different for `DecimalFormat`.
>
> `CompactNumberFormat` does define its own instance methods such as `setParseBigDecimal`, `setGroupingSize`, etc, so I think that this wording should still be included.

My bad, you're correct. The confusion I had was probably this wording: "These factory methods may not always return a CompactNumberFormat". I believe it *does* return a CNF (in terms of `instanceof`), because as the factory methods names imply. However, in the case of DecimalFormat, the factory methods are simply, for example, "NumberFormat.getInstance()" and the implementation may return a different class instance, which does not even offer methods on DecimalFormat class. The difference needs to be described somehow IMO.

>> src/java.base/share/classes/java/text/NumberFormat.java line 235:
>> 
>>> 233:  * @see          ChoiceFormat
>>> 234:  * @see          CompactNumberFormat
>>> 235:  * @see          Locale
>> 
>> Could be removed as the link is now gone
>
> As this is a localized class, and the class description mentions `Locale` in various places, I feel like `Locale` should still be included as a `see` tag, (even though I removed the locale link). I am fine either way, what do you think?

OK, let's keep them then

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18731#discussion_r1568018900
PR Review Comment: https://git.openjdk.org/jdk/pull/18731#discussion_r1568020362


More information about the core-libs-dev mailing list