Skip to content

Commit 0cb0b5d

Browse files
author
Justin Lu
committed
8327875: ChoiceFormat should advise throwing UnsupportedOperationException for unused methods
Reviewed-by: naoto
1 parent e3588bb commit 0cb0b5d

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

src/java.base/share/classes/java/text/ChoiceFormat.java

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,6 @@
134134
* Use two single quotes in a row to produce a literal single quote. For example,
135135
* {@code new ChoiceFormat("1# ''one'' ").format(1)} returns {@code " 'one' "}.
136136
*
137-
* @apiNote A subclass could perform more consistent pattern validation by
138-
* throwing an {@code IllegalArgumentException} for all incorrect cases.
139-
* @implNote Given an incorrect pattern, this implementation may either
140-
* throw an exception or succeed and discard the incorrect portion. A {@code
141-
* NumberFormatException} is thrown if a {@code limit} can not be
142-
* parsed as a numeric value and an {@code IllegalArgumentException} is thrown
143-
* if a {@code SubPattern} is missing, or the intervals are not ascending.
144-
* Discarding the incorrect portion may result in a ChoiceFormat with
145-
* empty {@code limits} and {@code formats}.
146-
*
147137
* <h2>Usage Information</h2>
148138
*
149139
* <p>
@@ -224,6 +214,21 @@
224214
* If multiple threads access a format concurrently, it must be synchronized
225215
* externally.
226216
*
217+
* @apiNote A subclass could perform more consistent pattern validation by
218+
* throwing an {@code IllegalArgumentException} for all incorrect cases.
219+
* See the {@code Implementation Note} for this implementation's behavior regarding
220+
* incorrect patterns.
221+
* <p>This class inherits instance methods from {@code NumberFormat} it does
222+
* not utilize; a subclass could override and throw {@code
223+
* UnsupportedOperationException} for such methods.
224+
* @implNote Given an incorrect pattern, this implementation may either
225+
* throw an exception or succeed and discard the incorrect portion. A {@code
226+
* NumberFormatException} is thrown if a {@code limit} can not be
227+
* parsed as a numeric value and an {@code IllegalArgumentException} is thrown
228+
* if a {@code SubPattern} is missing, or the intervals are not ascending.
229+
* Discarding the incorrect portion may result in a ChoiceFormat with
230+
* empty {@code limits} and {@code formats}.
231+
*
227232
*
228233
* @see DecimalFormat
229234
* @see MessageFormat

0 commit comments

Comments
 (0)