<i18n dev> RFR: 8263668: Update java.time to use instanceof pattern variable

Rémi Forax github.com+828220+forax at openjdk.java.net
Wed Mar 24 11:09:42 UTC 2021


On Wed, 24 Mar 2021 09:56:16 GMT, Patrick Concannon <pconcannon at openjdk.org> wrote:

> Hi,
> 
> Could someone please review my code for updating the code in the `java.time` package to make use of the `instanceof` pattern variable?
> 
> Kind regards,
> Patrick

src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java line 168:

> 166:     private static final TemporalQuery<ZoneId> QUERY_REGION_ONLY = (temporal) -> {
> 167:         ZoneId zone = temporal.query(TemporalQueries.zoneId());
> 168:         return (zone != null && (!(zone instanceof ZoneOffset)) ? zone : null);

i find this code hard to read
`return (zone != null && (!(zone instanceof ZoneOffset))) ? zone : null;`
seems better`

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

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


More information about the i18n-dev mailing list