On Wed, 23 Jun 2021 10:39:06 GMT, Patrick Concannon <pconcan...@openjdk.org> 
wrote:

>> 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.

I'd personally replace all the applicable locations, as otherwise, it would 
confuse why there are two idioms. But it is outside of this PR so probably for 
another day.

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

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

Reply via email to