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

Andrey Turbanov aturbanov at openjdk.java.net
Fri Jan 21 17:04:58 UTC 2022


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();`.

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

Commit messages:
 - [PATCH] Remove confusing instanceof check in HijrahChronology.range
 - [PATCH] Remove confusing instanceof check in HijrahChronology.range

Changes: https://git.openjdk.java.net/jdk/pull/7118/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7118&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8280470
  Stats: 13 lines in 1 file changed: 0 ins; 4 del; 9 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7118.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7118/head:pull/7118

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


More information about the i18n-dev mailing list