On Wed, 25 Jan 2023 18:12:10 GMT, Justin Lu <j...@openjdk.org> wrote:
>> When their input is null, the following methods in java.util.TimeZone throw >> a NullPointerException: >> >> _TimeZone.getTimeZone(String ID) >> TimeZone.setID(String ID) >> TimeZone.inDaylightTime(Date date)_ >> >> For example, >> >> >> String someID = null; >> TimeZone tz1 = TimeZone.getTimeZone(someID); >> ``` >> >> throws a `NullPointerException` >> >> >> This PR adds the missing _@throws:_ for the mentioned methods. The wording >> and specification is also adjusted for the overridable methods in TZ to use >> "_may throw_" over "_will throw_" because of the possibility of external >> sub-classes that may override the method. > > Justin Lu has updated the pull request incrementally with one additional > commit since the last revision: > > Adjust ImplSpec positioning and wording src/java.base/share/classes/java/util/TimeZone.java line 300: > 298: * @param ID the new time zone ID. > 299: * @throws NullPointerException This method may throw a > 300: * {@code NullPointerException} if {@code ID} is {@code null} Is this needed given it is covered in the implSpec as it seems redundant src/java.base/share/classes/java/util/TimeZone.java line 409: > 407: * {@code IllegalArgumentException} if {@code style} is invalid. > 408: * @throws NullPointerException This method may throw a > 409: * {@code NullPointerException} if {@code ID} is {@code null} Same comment as above ------------- PR: https://git.openjdk.org/jdk/pull/11888