RFR: 8177418: NPE is not apparent for methods in java.util.TimeZone API docs [v5]
Justin Lu
jlu at openjdk.org
Wed Jan 25 00:17:26 UTC 2023
> 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`
>
> However this is not documented in the API docs in the form of a _throws:_ section.
>
> This change updates the documentation to make this apparent.
>
> Aditionally, updates the javadoc of SimpleTimeZone.inDaylightTime(Date date) to inherit the _ at throws:_
Justin Lu has updated the pull request incrementally with two additional commits since the last revision:
- Abstract may throw NPE, static will throw, instance use @implspec
- Add ImplNote for non-abstract instance methods
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/11888/files
- new: https://git.openjdk.org/jdk/pull/11888/files/a8059d50..145c5929
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=11888&range=04
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=11888&range=03-04
Stats: 13 lines in 1 file changed: 9 ins; 0 del; 4 mod
Patch: https://git.openjdk.org/jdk/pull/11888.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/11888/head:pull/11888
PR: https://git.openjdk.org/jdk/pull/11888
More information about the core-libs-dev
mailing list