Summary
Make IllegalArgumentException apparent for the DateFormat factory methods in the specification.
Problem
The DateFormat static factory methods throw an IllegalArgumentException if the style parameter is less than 0 (FULL) or greater than 3 (SHORT). This is not specified in the class description or method descriptions.
Solution
There are a number of static factory methods that take the style parameter. To avoid redundancy, introduce a sentence in the class description to make this behavior apparent (as opposed to each method).
Specification
In the class description,
- * <p>{@code DateFormat} provides many class methods for obtaining default date/time
+ * <p>{@code DateFormat} provides static factory methods for obtaining default date/time
* formatters based on the default or a given locale and a number of formatting
- * styles. The formatting styles include {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, and {@link #SHORT}. More
- * detail and examples of using these styles are provided in the method
+ * styles. The formatting styles include {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, and {@link #SHORT}.
+ * For any of the factory methods with the parameter <i>style</i>, an {@code
+ * IllegalArgumentException} will be thrown if <i>style</i> is not equal to any
+ * of the defined formatting styles. More detail and examples of using these styles are provided in the method
* descriptions.
*
- csr of
-
JDK-8319628 DateFormat does not mention IllegalArgumentException for invalid style args
- Resolved