-
CSR
-
Resolution: Approved
-
P4
-
None
-
behavioral
-
minimal
-
The proposed change updates the javadoc to declare an exception with the @throws tag.
-
Java API
-
SE
Summary
Update the javadoc of java.util.Date.parse(String)
and java.util.Date(String)
to document an IllegalArgumentException
.
Problem
java.util.Date.parse(String)
and java.util.Date(String)
do not declare an IllegalArgumentException
with an @throws tag. Although deprecated, the mentioned method and constructor are apart of the public API, and should be properly documented.
Solution
The javadoc of java.util.Date.parse(String)
and java.util.Date(String)
will be updated to declare the IllegalArgumentException
in the form of a @throws tag.
Specification
--- a/src/java.base/share/classes/java/util/Date.java
+++ b/src/java.base/share/classes/java/util/Date.java
@@ -260,6 +260,8 @@ public class Date
* {@link Date#parse} method.
*
* @param s a string representation of the date.
+ * @throws IllegalArgumentException if {@code s} cannot be interpreted as a
+ * representation of a date and time.
* @see java.text.DateFormat
* @see java.util.Date#parse(java.lang.String)
* @deprecated As of JDK version 1.1,
@@ -441,6 +443,8 @@ public class Date
* @param s a string to be parsed as a date.
* @return the number of milliseconds since January 1, 1970, 00:00:00 GMT
* represented by the string argument.
+ * @throws IllegalArgumentException if {@code s} cannot be interpreted as a
+ * representation of a date and time.
* @see java.text.DateFormat
* @deprecated As of JDK version 1.1,
* replaced by {@code DateFormat.parse(String s)}.
- csr of
-
JDK-8303232 java.util.Date.parse(String) and java.util.Date(String) don't declare thrown IllegalArgumentException
-
- Resolved
-