On Thu, 22 Apr 2021 10:13:32 GMT, Patrick Concannon <pconcan...@openjdk.org> 
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 be replaced with pattern variable 
>>             method plus(long, TemporalUnit)   1 warning 
>>                 WARNING Variable 'f' 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 ChronoPeriodImpl   1 warning 
>>             method validateAmount(TemporalAmount)   1 warning 
>>                 WARNING Variable 'period' can be replaced with pattern 
>> variable 
>>         class ChronoZonedDateTimeImpl   1 warning 
>>             method with(TemporalField, long)   1 warning 
>>                 WARNING Variable 'f' can be replaced with pattern variable 
>>         class HijrahDate   1 warning 
>>             method with(TemporalField, long)   1 warning 
>>                 WARNING Variable 'f' can be replaced with pattern variable 
>>         class JapaneseDate   1 warning 
>>             method with(TemporalField, long)   1 warning 
>>                 WARNING Variable 'f' can be replaced with pattern variable 
>>         class MinguoDate   1 warning 
>>             method with(TemporalField, long)   1 warning 
>>                 WARNING Variable 'f' can be replaced with pattern variable 
>>         class ThaiBuddhistDate   1 warning 
>>             method with(TemporalField, long)   1 warning 
>>                 WARNING Variable 'f' can be replaced with pattern variable 
>>     java.time.format   3 warnings 
>>         class DecimalStyle   1 warning 
>>             method equals(Object)   1 warning 
>>                 WARNING Variable 'other' can be replaced with pattern 
>> variable 
>>         class Parsed   2 warnings 
>>             method resolveFields()   2 warnings 
>>                 WARNING Variable 'czdt' can be replaced with pattern 
>> variable 
>>                 WARNING Variable 'cldt' can be replaced with pattern 
>> variable 
>>     java.time.zone   1 warning 
>>         class TzdbZoneRulesProvider   1 warning 
>>             method provideRules(String, boolean)   1 warning 
>>                 WARNING Variable 'bytes' can be replaced with pattern 
>> variable 
>> 
>> Do you have plans to adjust them too?
>
>> Hi @turbanoff, thanks for finding these. Will take a look shortly!
> 
> As this PR is already quite large, I will create a second issue to track 
> these further changes. Thanks again for your help

Hi @pconcannon , good job !

However, is there a reason why you're not using `chronoUnit` in 
`LocalDateTime:1687` ?


    @Override
    public long until(Temporal endExclusive, TemporalUnit unit) {
        LocalDateTime end = LocalDateTime.from(endExclusive);
        if (unit instanceof ChronoUnit chronoUnit) {
            if (unit.isTimeBased()) { <-- HERE
                long amount = date.daysUntil(end.date);

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

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

Reply via email to