<i18n dev> RFR: 8269124: Update java.time to use switch expressions (part II) [v2]

Patrick Concannon pconcannon at openjdk.java.net
Wed Jun 23 10:42:27 UTC 2021


On Tue, 22 Jun 2021 17:27:58 GMT, Naoto Sato <naoto at openjdk.org> wrote:

>> Patrick Concannon has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8269124: Added missing brace; fixed build issue
>
> src/java.base/share/classes/java/time/Instant.java line 562:
> 
>> 560:     public int get(TemporalField field) {
>> 561:         if (field instanceof ChronoField) {
>> 562:             return switch ((ChronoField) field) {
> 
> Not really comment on the change itself, but Is this a leftover from the `instanceof` pattern variable exercise, or will we have another round for that? I see other locations which could be leftovers.

Hi Naoto, I decided to only introduce the`instanceof` pattern variable where I thought it would add additional value to the code. In situations like this one, I thought there wasn't much point as the cast variable is only used once (in the switch). However, if you think I've overlooked something that would be beneficial to change, I'd be happy to take a look.

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

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


More information about the i18n-dev mailing list