Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v7]

2021-04-22 Thread YassinHajaj
On Thu, 22 Apr 2021 10:13:32 GMT, Patrick Concannon  
wrote:

>> I was able to find (with IntelliJ IDEA help) few more places to improve
>> 
>> java.time   27 warnings 
>> class Clock   2 warnings 
>> class FixedClock   1 warning 
>> method equals(Object)   1 warning 
>> WARNING Variable 'other' can be replaced with pattern 
>> variable 
>> class OffsetClock   1 warning 
>> method equals(Object)   1 warning 
>> WARNING Variable 'other' can be replaced with pattern 
>> variable 
>> class Instant   2 warnings 
>> method until(Temporal, TemporalUnit)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> method with(TemporalField, long)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> class LocalDate   5 warnings 
>> method minus(TemporalAmount)   1 warning 
>> WARNING Variable 'periodToSubtract' can be replaced with 
>> pattern variable 
>> method plus(long, TemporalUnit)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> method plus(TemporalAmount)   1 warning 
>> WARNING Variable 'periodToAdd' can be replaced with pattern 
>> variable 
>> method range(TemporalField)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> method with(TemporalField, long)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> class LocalDateTime   8 warnings 
>> method get(TemporalField)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> method getLong(TemporalField)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> method isSupported(TemporalField)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> method minus(TemporalAmount)   1 warning 
>> WARNING Variable 'periodToSubtract' can be replaced with 
>> pattern variable 
>> method plus(long, TemporalUnit)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> method plus(TemporalAmount)   1 warning 
>> WARNING Variable 'periodToAdd' can be replaced with pattern 
>> variable 
>> method range(TemporalField)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> method with(TemporalField, long)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> class LocalTime   1 warning 
>> method with(TemporalField, long)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> class OffsetDateTime   1 warning 
>> method with(TemporalField, long)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> class Year   1 warning 
>> method with(TemporalField, long)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> class YearMonth   1 warning 
>> method with(TemporalField, long)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> class ZonedDateTime   6 warnings 
>> method equals(Object)   1 warning 
>> WARNING Variable 'other' can be replaced with pattern 
>> variable 
>> method minus(TemporalAmount)   1 warning 
>> WARNING Variable 'periodToSubtract' can be replaced with 
>> pattern variable 
>> method plus(TemporalAmount)   1 warning 
>> WARNING Variable 'periodToAdd' can be replaced with pattern 
>> variable 
>> method with(TemporalAdjuster)   2 warnings 
>> WARNING Variable 'odt' can be replaced with pattern variable 
>> WARNING Variable 'instant' can be replaced with pattern 
>> variable 
>> method with(TemporalField, long)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> java.time.chrono   13 warnings 
>> class ChronoLocalDateImpl   1 warning 
>> method plus(long, TemporalUnit)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> class ChronoLocalDateTimeImpl   6 warnings 
>> method get(TemporalField)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> method getLong(TemporalField)   1 warning 
>> WARNING Variable 'f' can be replaced with pattern variable 
>> method 

Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v7]

2021-04-22 Thread Patrick Concannon
On Wed, 21 Apr 2021 13:02:06 GMT, Andrey Turbanov 
 wrote:

>> Patrick Concannon has updated the pull request with a new target base due to 
>> a merge or a rebase. The incremental webrev excludes the unrelated changes 
>> brought in by the merge/rebase. The pull request contains 10 additional 
>> commits since the last revision:
>> 
>>  - Updated single letter pattern variable name in java/time/Duration
>>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>>  - Updated single letter pattern variable names
>>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>>  - 8263668: Update java.time to use instanceof pattern variable
>
> I was able to find (with IntelliJ IDEA help) few more places to improve
> 
> java.time   27 warnings 
> class Clock   2 warnings 
> class FixedClock   1 warning 
> method equals(Object)   1 warning 
> WARNING Variable 'other' can be replaced with pattern 
> variable 
> class OffsetClock   1 warning 
> method equals(Object)   1 warning 
> WARNING Variable 'other' can be replaced with pattern 
> variable 
> class Instant   2 warnings 
> method until(Temporal, TemporalUnit)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method with(TemporalField, long)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> class LocalDate   5 warnings 
> method minus(TemporalAmount)   1 warning 
> WARNING Variable 'periodToSubtract' can be replaced with 
> pattern variable 
> method plus(long, TemporalUnit)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method plus(TemporalAmount)   1 warning 
> WARNING Variable 'periodToAdd' can be replaced with pattern 
> variable 
> method range(TemporalField)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method with(TemporalField, long)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> class LocalDateTime   8 warnings 
> method get(TemporalField)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method getLong(TemporalField)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method isSupported(TemporalField)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method minus(TemporalAmount)   1 warning 
> WARNING Variable 'periodToSubtract' can be replaced with 
> pattern variable 
> method plus(long, TemporalUnit)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method plus(TemporalAmount)   1 warning 
> WARNING Variable 'periodToAdd' can be replaced with pattern 
> variable 
> method range(TemporalField)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method with(TemporalField, long)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> class LocalTime   1 warning 
> method with(TemporalField, long)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> class OffsetDateTime   1 warning 
> method with(TemporalField, long)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> class Year   1 warning 
> method with(TemporalField, long)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> class YearMonth   1 warning 
> method with(TemporalField, long)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> class ZonedDateTime   6 warnings 
> method equals(Object)   1 warning 
> WARNING Variable 'other' can be replaced with pattern 
> variable 
> method minus(TemporalAmount)   1 warning 
> WARNING Variable 'periodToSubtract' can be replaced with 
> pattern variable 
> method plus(TemporalAmount)   1 warning 
> WARNING Variable 'periodToAdd' can be replaced with pattern 
> variable 
> method with(TemporalAdjuster)   2 warnings 
>

Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v8]

2021-04-22 Thread Patrick Concannon
> 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

Patrick Concannon has updated the pull request with a new target base due to a 
merge or a rebase. The incremental webrev excludes the unrelated changes 
brought in by the merge/rebase. The pull request contains 12 additional commits 
since the last revision:

 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Updated single letter pattern variable name in java/time/Duration
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Updated single letter pattern variable names
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - ... and 2 more: https://git.openjdk.java.net/jdk/compare/88c33d40...db6e9bb7

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3170/files
  - new: https://git.openjdk.java.net/jdk/pull/3170/files/3dc1e075..db6e9bb7

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=3170=07
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=3170=06-07

  Stats: 522 lines in 75 files changed: 254 ins; 160 del; 108 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3170.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3170/head:pull/3170

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v7]

2021-04-21 Thread Chris Hegarty
On Wed, 21 Apr 2021 11:06:16 GMT, Patrick Concannon  
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
>
> Patrick Concannon has updated the pull request with a new target base due to 
> a merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains 10 additional 
> commits since the last revision:
> 
>  - Updated single letter pattern variable name in java/time/Duration
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Updated single letter pattern variable names
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - 8263668: Update java.time to use instanceof pattern variable

Marked as reviewed by chegar (Reviewer).

-

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v7]

2021-04-21 Thread Naoto Sato
On Wed, 21 Apr 2021 11:06:16 GMT, Patrick Concannon  
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
>
> Patrick Concannon has updated the pull request with a new target base due to 
> a merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains 10 additional 
> commits since the last revision:
> 
>  - Updated single letter pattern variable name in java/time/Duration
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Updated single letter pattern variable names
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - 8263668: Update java.time to use instanceof pattern variable

Marked as reviewed by naoto (Reviewer).

-

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v7]

2021-04-21 Thread Stephen Colebourne
On Wed, 21 Apr 2021 11:06:16 GMT, Patrick Concannon  
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
>
> Patrick Concannon has updated the pull request with a new target base due to 
> a merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains 10 additional 
> commits since the last revision:
> 
>  - Updated single letter pattern variable name in java/time/Duration
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Updated single letter pattern variable names
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - 8263668: Update java.time to use instanceof pattern variable

Marked as reviewed by scolebourne (Author).

-

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v7]

2021-04-21 Thread Patrick Concannon
On Wed, 21 Apr 2021 13:02:06 GMT, Andrey Turbanov 
 wrote:

> I was able to find (with IntelliJ IDEA help) few more places to improve
> 
> ```
> java.time   27 warnings 
> class Clock   2 warnings 
> class FixedClock   1 warning 
> method equals(Object)   1 warning 
> WARNING Variable 'other' can be replaced with pattern 
> variable 
> class OffsetClock   1 warning 
> method equals(Object)   1 warning 
> WARNING Variable 'other' can be replaced with pattern 
> variable 
> class Instant   2 warnings 
> method until(Temporal, TemporalUnit)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method with(TemporalField, long)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> class LocalDate   5 warnings 
> method minus(TemporalAmount)   1 warning 
> WARNING Variable 'periodToSubtract' can be replaced with 
> pattern variable 
> method plus(long, TemporalUnit)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method plus(TemporalAmount)   1 warning 
> WARNING Variable 'periodToAdd' can be replaced with pattern 
> variable 
> method range(TemporalField)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method with(TemporalField, long)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> class LocalDateTime   8 warnings 
> method get(TemporalField)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method getLong(TemporalField)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method isSupported(TemporalField)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method minus(TemporalAmount)   1 warning 
> WARNING Variable 'periodToSubtract' can be replaced with 
> pattern variable 
> method plus(long, TemporalUnit)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method plus(TemporalAmount)   1 warning 
> WARNING Variable 'periodToAdd' can be replaced with pattern 
> variable 
> method range(TemporalField)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method with(TemporalField, long)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> class LocalTime   1 warning 
> method with(TemporalField, long)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> class OffsetDateTime   1 warning 
> method with(TemporalField, long)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> class Year   1 warning 
> method with(TemporalField, long)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> class YearMonth   1 warning 
> method with(TemporalField, long)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> class ZonedDateTime   6 warnings 
> method equals(Object)   1 warning 
> WARNING Variable 'other' can be replaced with pattern 
> variable 
> method minus(TemporalAmount)   1 warning 
> WARNING Variable 'periodToSubtract' can be replaced with 
> pattern variable 
> method plus(TemporalAmount)   1 warning 
> WARNING Variable 'periodToAdd' can be replaced with pattern 
> variable 
> method with(TemporalAdjuster)   2 warnings 
> WARNING Variable 'odt' can be replaced with pattern variable 
> WARNING Variable 'instant' can be replaced with pattern 
> variable 
> method with(TemporalField, long)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> java.time.chrono   13 warnings 
> class ChronoLocalDateImpl   1 warning 
> method plus(long, TemporalUnit)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> class ChronoLocalDateTimeImpl   6 warnings 
> method get(TemporalField)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method getLong(TemporalField)   1 warning 
> WARNING Variable 'f' can be replaced with pattern variable 
> method isSupported(TemporalField)   1 warning 
> WARNING Variable 'f' can 

Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v7]

2021-04-21 Thread Roger Riggs
On Wed, 21 Apr 2021 11:06:16 GMT, Patrick Concannon  
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
>
> Patrick Concannon has updated the pull request with a new target base due to 
> a merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains 10 additional 
> commits since the last revision:
> 
>  - Updated single letter pattern variable name in java/time/Duration
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Updated single letter pattern variable names
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - 8263668: Update java.time to use instanceof pattern variable

Marked as reviewed by rriggs (Reviewer).

-

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v7]

2021-04-21 Thread Andrey Turbanov
On Wed, 21 Apr 2021 11:06:16 GMT, Patrick Concannon  
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
>
> Patrick Concannon has updated the pull request with a new target base due to 
> a merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains 10 additional 
> commits since the last revision:
> 
>  - Updated single letter pattern variable name in java/time/Duration
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Updated single letter pattern variable names
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - 8263668: Update java.time to use instanceof pattern variable

I was able to find (with IntelliJ IDEA help) few more places to improve

java.time   27 warnings 
class Clock   2 warnings 
class FixedClock   1 warning 
method equals(Object)   1 warning 
WARNING Variable 'other' can be replaced with pattern 
variable 
class OffsetClock   1 warning 
method equals(Object)   1 warning 
WARNING Variable 'other' can be replaced with pattern 
variable 
class Instant   2 warnings 
method until(Temporal, TemporalUnit)   1 warning 
WARNING Variable 'f' can be replaced with pattern variable 
method with(TemporalField, long)   1 warning 
WARNING Variable 'f' can be replaced with pattern variable 
class LocalDate   5 warnings 
method minus(TemporalAmount)   1 warning 
WARNING Variable 'periodToSubtract' can be replaced with 
pattern variable 
method plus(long, TemporalUnit)   1 warning 
WARNING Variable 'f' can be replaced with pattern variable 
method plus(TemporalAmount)   1 warning 
WARNING Variable 'periodToAdd' can be replaced with pattern 
variable 
method range(TemporalField)   1 warning 
WARNING Variable 'f' can be replaced with pattern variable 
method with(TemporalField, long)   1 warning 
WARNING Variable 'f' can be replaced with pattern variable 
class LocalDateTime   8 warnings 
method get(TemporalField)   1 warning 
WARNING Variable 'f' can be replaced with pattern variable 
method getLong(TemporalField)   1 warning 
WARNING Variable 'f' can be replaced with pattern variable 
method isSupported(TemporalField)   1 warning 
WARNING Variable 'f' can be replaced with pattern variable 
method minus(TemporalAmount)   1 warning 
WARNING Variable 'periodToSubtract' can be replaced with 
pattern variable 
method plus(long, TemporalUnit)   1 warning 
WARNING Variable 'f' can be replaced with pattern variable 
method plus(TemporalAmount)   1 warning 
WARNING Variable 'periodToAdd' can be replaced with pattern 
variable 
method range(TemporalField)   1 warning 
WARNING Variable 'f' can be replaced with pattern variable 
method with(TemporalField, long)   1 warning 
WARNING Variable 'f' can be replaced with pattern variable 
class LocalTime   1 warning 
method with(TemporalField, long)   1 warning 
WARNING Variable 'f' can be replaced with pattern variable 
class OffsetDateTime   1 warning 
method with(TemporalField, long)   1 warning 
WARNING Variable 'f' can be replaced with pattern variable 
class Year   1 warning 
method with(TemporalField, long)   1 warning 
WARNING Variable 'f' can be replaced with pattern variable 
class YearMonth   1 warning 
method with(TemporalField, long)   1 warning 
WARNING Variable 'f' can be replaced with pattern variable 
class ZonedDateTime   6 warnings 
method equals(Object)   1 warning 
WARNING Variable 'other' can be replaced with pattern variable 
method minus(TemporalAmount)   1 warning 
WARNING Variable 'periodToSubtract' can be replaced with 
pattern variable 
method plus(TemporalAmount)   1 warning 
WARNING Variable 'periodToAdd' can be replaced with pattern 
variable 
method with(TemporalAdjuster)   

Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v7]

2021-04-21 Thread Daniel Fuchs
On Wed, 21 Apr 2021 11:06:16 GMT, Patrick Concannon  
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
>
> Patrick Concannon has updated the pull request with a new target base due to 
> a merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains 10 additional 
> commits since the last revision:
> 
>  - Updated single letter pattern variable name in java/time/Duration
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Updated single letter pattern variable names
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - 8263668: Update java.time to use instanceof pattern variable

Marked as reviewed by dfuchs (Reviewer).

-

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v6]

2021-04-21 Thread Patrick Concannon
On Wed, 21 Apr 2021 09:06:45 GMT, Daniel Fuchs  wrote:

>> Patrick Concannon has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Updated single letter pattern variable names
>
> src/java.base/share/classes/java/time/Duration.java line 723:
> 
>> 721: }
>> 722: if (unit instanceof ChronoUnit u) {
>> 723: switch (u) {
> 
> Maybe `u` could be replaced with `chronoUnit` here too

Variable name updated as suggested in 3dc1e07

-

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v7]

2021-04-21 Thread Patrick Concannon
> 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

Patrick Concannon has updated the pull request with a new target base due to a 
merge or a rebase. The incremental webrev excludes the unrelated changes 
brought in by the merge/rebase. The pull request contains 10 additional commits 
since the last revision:

 - Updated single letter pattern variable name in java/time/Duration
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Updated single letter pattern variable names
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - 8263668: Update java.time to use instanceof pattern variable

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3170/files
  - new: https://git.openjdk.java.net/jdk/pull/3170/files/647bd6b1..3dc1e075

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=3170=06
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=3170=05-06

  Stats: 2549 lines in 111 files changed: 1748 ins; 362 del; 439 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3170.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3170/head:pull/3170

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v6]

2021-04-21 Thread Patrick Concannon
On Wed, 24 Mar 2021 11:06:38 GMT, Rémi Forax 
 wrote:

>> Patrick Concannon has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Updated single letter pattern variable names
>
> src/java.base/share/classes/java/time/format/DateTimeFormatterBuilder.java 
> line 168:
> 
>> 166: private static final TemporalQuery 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`

Updated in 647bd6b as suggested by Michael Kuhlmann

-

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v6]

2021-04-21 Thread Daniel Fuchs
On Tue, 20 Apr 2021 17:46:38 GMT, Patrick Concannon  
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
>
> Patrick Concannon has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Updated single letter pattern variable names

src/java.base/share/classes/java/time/Duration.java line 723:

> 721: }
> 722: if (unit instanceof ChronoUnit u) {
> 723: switch (u) {

Maybe `u` could be replaced with `chronoUnit` here too

-

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v6]

2021-04-20 Thread Naoto Sato
On Tue, 20 Apr 2021 17:46:38 GMT, Patrick Concannon  
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
>
> Patrick Concannon has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Updated single letter pattern variable names

Marked as reviewed by naoto (Reviewer).

-

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v6]

2021-04-20 Thread Roger Riggs
On Tue, 20 Apr 2021 17:46:38 GMT, Patrick Concannon  
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
>
> Patrick Concannon has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Updated single letter pattern variable names

Marked as reviewed by rriggs (Reviewer).

-

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v6]

2021-04-20 Thread Patrick Concannon
On Wed, 24 Mar 2021 10:57:11 GMT, Rémi Forax 
 wrote:

>> Patrick Concannon has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Updated single letter pattern variable names
>
> src/java.base/share/classes/java/time/LocalDateTime.java line 1686:
> 
>> 1684: public long until(Temporal endExclusive, TemporalUnit unit) {
>> 1685: LocalDateTime end = LocalDateTime.from(endExclusive);
>> 1686: if (unit instanceof ChronoUnit u) {
> 
> `chronoUnit` is perhaps a better variable name than `u`

Thanks for your comments, @forax, and apologizes for the delay in getting back 
to you. I was waiting for the boot JDK version to be updated to 16. Certain 
files changed in the PR are shared between the build tool and the JDK runtime, 
and were causing build issues.
I've addressed the changes you suggested, and you can find them in commit 
647bd6b

-

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v6]

2021-04-20 Thread Patrick Concannon
> 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

Patrick Concannon has updated the pull request incrementally with one 
additional commit since the last revision:

  Updated single letter pattern variable names

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3170/files
  - new: https://git.openjdk.java.net/jdk/pull/3170/files/2dca4a09..647bd6b1

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=3170=05
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=3170=04-05

  Stats: 51 lines in 14 files changed: 0 ins; 0 del; 51 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3170.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3170/head:pull/3170

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v4]

2021-04-20 Thread Patrick Concannon
On Mon, 19 Apr 2021 15:37:24 GMT, Roger Riggs  wrote:

>> Patrick Concannon has updated the pull request with a new target base due to 
>> a merge or a rebase. The incremental webrev excludes the unrelated changes 
>> brought in by the merge/rebase. The pull request contains six additional 
>> commits since the last revision:
>> 
>>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>>  - 8263668: Update java.time to use instanceof pattern variable
>
> src/java.base/share/classes/java/time/Duration.java line 1435:
> 
>> 1433: && this.seconds == other.seconds
>> 1434: && this.nanos == other.nanos;
>> 1435: }
> 
> Perhaps rename the argument and use `otherDuration` as the refinement.
> Otherwise, an inconsistency across various classes will creep in where the 
> more specific variable has a more general name.  In this case, the argument 
> type is Object, so the argument name `otherDuration` is not strictly true.

Parameter and pattern variable names swapped, as suggested. See 647bd6b

> src/java.base/share/classes/java/time/Instant.java line 1306:
> 
>> 1304: && this.seconds == other.seconds
>> 1305: && this.nanos == other.nanos;
>> 1306: }
> 
> Ditto, `otherInstance` is not strictly always an instant and it would be more 
> consistent to swap the names.
> `(other instanceof Instant otherInstant)`.

Parameter and pattern variable names swapped, as suggested. See 647bd6b

-

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v5]

2021-04-20 Thread Patrick Concannon
On Wed, 24 Mar 2021 13:57:35 GMT, Roger Riggs  wrote:

> In addition to the other suggestions, java.time could use a round of cleanup 
> to use switch expressions.

Hi Roger, I plan to introduce switch expressions in a follow up issue/PR.

-

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v5]

2021-04-20 Thread Patrick Concannon
> 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

Patrick Concannon has updated the pull request with a new target base due to a 
merge or a rebase. The incremental webrev excludes the unrelated changes 
brought in by the merge/rebase. The pull request contains seven additional 
commits since the last revision:

 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - 8263668: Update java.time to use instanceof pattern variable

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3170/files
  - new: https://git.openjdk.java.net/jdk/pull/3170/files/6481346a..2dca4a09

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=3170=04
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=3170=03-04

  Stats: 3821 lines in 79 files changed: 2021 ins; 1604 del; 196 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3170.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3170/head:pull/3170

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v4]

2021-04-19 Thread Roger Riggs
On Mon, 19 Apr 2021 10:38:17 GMT, Patrick Concannon  
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
>
> Patrick Concannon has updated the pull request with a new target base due to 
> a merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains six additional 
> commits since the last revision:
> 
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - Merge remote-tracking branch 'origin/master' into JDK-8263668
>  - 8263668: Update java.time to use instanceof pattern variable

I generally concur with `forax` about avoiding the use of single letter 
variables.

src/java.base/share/classes/java/time/Duration.java line 1435:

> 1433: && this.seconds == other.seconds
> 1434: && this.nanos == other.nanos;
> 1435: }

Perhaps rename the argument and use `otherDuration` as the refinement.
Otherwise, an inconsistency across various classes will creep in where the more 
specific variable has a more general name.  In this case, the argument type is 
Object, so the argument name `otherDuration` is not strictly true.

src/java.base/share/classes/java/time/Instant.java line 1306:

> 1304: && this.seconds == other.seconds
> 1305: && this.nanos == other.nanos;
> 1306: }

Ditto, `otherInstance` is not strictly always an instant and it would be more 
consistent to swap the names.
`(other instanceof Instant otherInstant)`.

-

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v4]

2021-04-19 Thread Patrick Concannon
> 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

Patrick Concannon has updated the pull request with a new target base due to a 
merge or a rebase. The incremental webrev excludes the unrelated changes 
brought in by the merge/rebase. The pull request contains six additional 
commits since the last revision:

 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - 8263668: Update java.time to use instanceof pattern variable

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3170/files
  - new: https://git.openjdk.java.net/jdk/pull/3170/files/d7355049..6481346a

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=3170=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=3170=02-03

  Stats: 69174 lines in 1873 files changed: 32339 ins; 31989 del; 4846 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3170.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3170/head:pull/3170

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v3]

2021-04-08 Thread Patrick Concannon
> 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

Patrick Concannon has updated the pull request with a new target base due to a 
merge or a rebase. The incremental webrev excludes the unrelated changes 
brought in by the merge/rebase. The pull request contains four additional 
commits since the last revision:

 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - 8263668: Update java.time to use instanceof pattern variable

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3170/files
  - new: https://git.openjdk.java.net/jdk/pull/3170/files/b72e658e..d7355049

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=3170=02
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=3170=01-02

  Stats: 37636 lines in 887 files changed: 29080 ins; 4064 del; 4492 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3170.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3170/head:pull/3170

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable [v2]

2021-03-25 Thread Patrick Concannon
> 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

Patrick Concannon has updated the pull request with a new target base due to a 
merge or a rebase. The incremental webrev excludes the unrelated changes 
brought in by the merge/rebase. The pull request contains three additional 
commits since the last revision:

 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - 8263668: Update java.time to use instanceof pattern variable

-

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3170/files
  - new: https://git.openjdk.java.net/jdk/pull/3170/files/43a57378..b72e658e

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk=3170=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk=3170=00-01

  Stats: 4370 lines in 292 files changed: 2129 ins; 651 del; 1590 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3170.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3170/head:pull/3170

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable

2021-03-24 Thread Roger Riggs
On Wed, 24 Mar 2021 09:56:16 GMT, Patrick Concannon  
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

In addition to the other suggestions, java.time could use a round of cleanup to 
use switch expressions.

-

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable

2021-03-24 Thread Naoto Sato
On Wed, 24 Mar 2021 09:56:16 GMT, Patrick Concannon  
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

LGTM. Thanks for the cleanup!

-

Marked as reviewed by naoto (Reviewer).

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable

2021-03-24 Thread Remi Forax
- Mail original -
> De: "Michael Kuhlmann" 
> À: "core-libs-dev" 
> Envoyé: Mercredi 24 Mars 2021 13:23:08
> Objet: Re: RFR: 8263668: Update java.time to use instanceof pattern variable

> On 3/24/21 12:09 PM, Rémi Forax wrote:
>> On Wed, 24 Mar 2021 09:56:16 GMT, Patrick Concannon 
>> 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 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`
> 
> The whole null check is not necessary.
> 
> `return zone instanceof ZoneOffset ? null : zone;`

yes,
you are right !

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

Rémi


Re: RFR: 8263668: Update java.time to use instanceof pattern variable

2021-03-24 Thread Rahul Yadav
On Wed, 24 Mar 2021 09:56:16 GMT, Patrick Concannon  
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

LGTM!

-

Marked as reviewed by ryadav (Committer).

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable

2021-03-24 Thread Michael Kuhlmann




On 3/24/21 12:09 PM, Rémi Forax wrote:

On Wed, 24 Mar 2021 09:56:16 GMT, Patrick Concannon  
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 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`


The whole null check is not necessary.

`return zone instanceof ZoneOffset ? null : zone;`


-

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



Re: RFR: 8263668: Update java.time to use instanceof pattern variable

2021-03-24 Thread Rémi Forax
On Wed, 24 Mar 2021 09:56:16 GMT, Patrick Concannon  
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 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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable

2021-03-24 Thread Rémi Forax
On Wed, 24 Mar 2021 09:56:16 GMT, Patrick Concannon  
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/LocalDateTime.java line 1686:

> 1684: public long until(Temporal endExclusive, TemporalUnit unit) {
> 1685: LocalDateTime end = LocalDateTime.from(endExclusive);
> 1686: if (unit instanceof ChronoUnit u) {

`chronoUnit` is perhaps a better variable name than `u`

src/java.base/share/classes/java/time/LocalTime.java line 1412:

> 1410: if (unit instanceof ChronoUnit u) {
> 1411: long nanosUntil = end.toNanoOfDay() - toNanoOfDay();  // no 
> overflow
> 1412: switch (u) {

same comment as above

src/java.base/share/classes/java/time/MonthDay.java line 448:

> 446: public long getLong(TemporalField field) {
> 447: if (field instanceof ChronoField f) {
> 448: switch (f) {

as above, `chronoField` instead of `f`

src/java.base/share/classes/java/time/OffsetDateTime.java line 599:

> 597: @Override
> 598: public int get(TemporalField field) {
> 599: if (field instanceof ChronoField f) {

see above

src/java.base/share/classes/java/time/OffsetDateTime.java line 636:

> 634: @Override
> 635: public long getLong(TemporalField field) {
> 636: if (field instanceof ChronoField f) {

see above

src/java.base/share/classes/java/time/OffsetTime.java line 1182:

> 1180: OffsetTime end = OffsetTime.from(endExclusive);
> 1181: if (unit instanceof ChronoUnit u) {
> 1182: long nanosUntil = end.toEpochNano() - toEpochNano();  // no 
> overflow

see above

src/java.base/share/classes/java/time/Year.java line 500:

> 498: public long getLong(TemporalField field) {
> 499: if (field instanceof ChronoField f) {
> 500: switch (f) {

see above

src/java.base/share/classes/java/time/Year.java line 711:

> 709: @Override
> 710: public Year plus(long amountToAdd, TemporalUnit unit) {
> 711: if (unit instanceof ChronoUnit u) {

see above

src/java.base/share/classes/java/time/Year.java line 917:

> 915: public long until(Temporal endExclusive, TemporalUnit unit) {
> 916: Year end = Year.from(endExclusive);
> 917: if (unit instanceof ChronoUnit u) {

see above

src/java.base/share/classes/java/time/YearMonth.java line 488:

> 486: @Override
> 487: public long getLong(TemporalField field) {
> 488: if (field instanceof ChronoField f) {

see above

src/java.base/share/classes/java/time/YearMonth.java line 808:

> 806: @Override
> 807: public YearMonth plus(long amountToAdd, TemporalUnit unit) {
> 808: if (unit instanceof ChronoUnit u) {

see above

src/java.base/share/classes/java/time/YearMonth.java line 1049:

> 1047: public long until(Temporal endExclusive, TemporalUnit unit) {
> 1048: YearMonth end = YearMonth.from(endExclusive);
> 1049: if (unit instanceof ChronoUnit u) {

see above

src/java.base/share/classes/java/time/ZonedDateTime.java line 816:

> 814: @Override  // override for Javadoc and performance
> 815: public int get(TemporalField field) {
> 816: if (field instanceof ChronoField f) {

see above

src/java.base/share/classes/java/time/ZonedDateTime.java line 853:

> 851: @Override
> 852: public long getLong(TemporalField field) {
> 853: if (field instanceof ChronoField f) {

see above

src/java.base/share/classes/java/time/chrono/ChronoLocalDateImpl.java line 380:

> 378: Objects.requireNonNull(endExclusive, "endExclusive");
> 379: ChronoLocalDate end = getChronology().date(endExclusive);
> 380: if (unit instanceof ChronoUnit u) {

see above

src/java.base/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java line 
379:

> 377: if (unit.isTimeBased()) {
> 378: long amount = end.getLong(EPOCH_DAY) - 
> date.getLong(EPOCH_DAY);
> 379: switch (u) {

see above

src/java.base/share/classes/java/time/chrono/ChronoZonedDateTime.java line 198:

> 196: @Override
> 197: default int get(TemporalField field) {
> 198: if (field instanceof ChronoField f) {

see above

src/java.base/share/classes/java/time/chrono/ChronoZonedDateTime.java line 212:

> 210: @Override
> 211: default long getLong(TemporalField field) {
> 212: if (field instanceof ChronoField f) {

see above

-

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


Re: RFR: 8263668: Update java.time to use instanceof pattern variable

2021-03-24 Thread Lance Andersen
On Wed, 24 Mar 2021 09:56:16 GMT, Patrick Concannon  
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

Changes look good Patrick.

-

Marked as reviewed by lancea (Reviewer).

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


RFR: 8263668: Update java.time to use instanceof pattern variable

2021-03-24 Thread Patrick Concannon
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

-

Commit messages:
 - Merge remote-tracking branch 'origin/master' into JDK-8263668
 - 8263668: Update java.time to use instanceof pattern variable

Changes: https://git.openjdk.java.net/jdk/pull/3170/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk=3170=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8263668
  Stats: 170 lines in 34 files changed: 0 ins; 47 del; 123 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3170.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3170/head:pull/3170

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