Summary
Update the java.text.ChoiceFormat class description to recommend throwing UnsupportedOperationException
for unused inherited methods.
Problem
java.text.ChoiceFormat inherits many methods from java.text.NumberFormat that it does not use. While it would have been ideal that
1) ChoiceFormat did not extend NumberFormat in the first place to not have these unused methods
2) ChoiceFormat throws UnsupportedOperationException
for such methods
Both solutions should not be done due to compatibility concerns. However, the problem still persists that these methods are inherited, but unused.
Solution
In the class description, recommend via the existing apiNote
tag that subclasses of ChoiceFormat themselves throw a UnsupportedOperationException
for these unused methods. This wording is kept general/broad, as listing every method in question while precise, would simply add unneeded noise and take away from the other text in the class description.
Specification
In the class description, add to the apiNote
tag,
* @apiNote A subclass could perform more consistent pattern validation by
* throwing an {@code IllegalArgumentException} for all incorrect cases.
+ * <p>This class inherits instance methods from {@code NumberFormat} it does
+ * not utilize; a subclass could override and throw {@code
+ * UnsupportedOperationException} for such methods.
- csr of
-
JDK-8327875 ChoiceFormat should advise throwing UnsupportedOperationException for unused methods
-
- Resolved
-