Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8303232

java.util.Date.parse(String) and java.util.Date(String) don't declare thrown IllegalArgumentException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • 20, 21
    • core-libs

      I've noticed that method 'long java.util.Date.parse(String)' doesn't
      have a reference to an IllegalArgumentException in its javadoc.
      https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/util/Date.html#parse(java.lang.String)
      But this exception is thrown in implementation - https://github.com/openjdk/jdk/blob/fbc036e7454720b589d99a8cae30369a10471528/src/java.base/share/classes/java/util/Date.java#L612

      While this method is deprecated, it's still part of public API and should be properly documented.
      Also it's still is used within JDK code itself. (see JDK-4097762).

      Additionally, for consistency, the java.util.Date(String) constructor should also have a reference.

            jlu Justin Lu
            aturbanov Andrey Turbanov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: