<i18n dev> Integrated: 8280470: Confusing instanceof check in HijrahChronology.range

Andrey Turbanov aturbanov at openjdk.java.net
Tue Jan 25 08:12:40 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();`.

This pull request has now been integrated.

Changeset: 53804720
Author:    Andrey Turbanov <aturbanov at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/53804720a04b5b314701de82eddf1a55798eba00
Stats:     13 lines in 1 file changed: 0 ins; 4 del; 9 mod

8280470: Confusing instanceof check in HijrahChronology.range

Reviewed-by: rriggs, naoto, dfuchs, iris

-------------

PR: https://git.openjdk.java.net/jdk/pull/7118


More information about the i18n-dev mailing list