RFR: 8280470: Confusing instanceof check in HijrahChronology.range
Roger Riggs
rriggs at openjdk.java.net
Fri Jan 21 17:19:41 UTC 2022
On Mon, 17 Jan 2022 21:02:35 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:
> Parameter `ChronoField field` is checked by `if (field instanceof ChronoField)`. Such check is confusing, because only one case, when this could be `false` is when `field == null`.
> But if condition is not satisfied we will get immediate NullPointerException anyway in `return field.range();`.
Looks fine; I have no idea how that came to be; there was a lot of copy paste in the initial check-in of java.time.
-------------
Marked as reviewed by rriggs (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/7118
More information about the core-libs-dev
mailing list