8265746: Update java.time to use instanceof pattern variable (part II)

Reviewed-by: dfuchs, lancea, rriggs, chegar, naoto
This commit is contained in:
Patrick Concannon 2021-04-26 08:32:20 +00:00
parent a85f6cbbaa
commit 45c5da0fd3
20 changed files with 104 additions and 152 deletions

View file

@ -353,12 +353,11 @@ public final class DecimalStyle {
if (this == obj) {
return true;
}
if (obj instanceof DecimalStyle) {
DecimalStyle other = (DecimalStyle) obj;
return (zeroDigit == other.zeroDigit && positiveSign == other.positiveSign &&
negativeSign == other.negativeSign && decimalSeparator == other.decimalSeparator);
}
return false;
return (obj instanceof DecimalStyle other
&& zeroDigit == other.zeroDigit
&& positiveSign == other.positiveSign
&& negativeSign == other.negativeSign
&& decimalSeparator == other.decimalSeparator);
}
/**

View file

@ -282,8 +282,7 @@ final class Parsed implements TemporalAccessor {
TemporalField targetField = entry.getKey();
TemporalAccessor resolvedObject = targetField.resolve(fieldValues, this, resolverStyle);
if (resolvedObject != null) {
if (resolvedObject instanceof ChronoZonedDateTime) {
ChronoZonedDateTime<?> czdt = (ChronoZonedDateTime<?>) resolvedObject;
if (resolvedObject instanceof ChronoZonedDateTime<?> czdt) {
if (zone == null) {
zone = czdt.getZone();
} else if (zone.equals(czdt.getZone()) == false) {
@ -291,8 +290,7 @@ final class Parsed implements TemporalAccessor {
}
resolvedObject = czdt.toLocalDateTime();
}
if (resolvedObject instanceof ChronoLocalDateTime) {
ChronoLocalDateTime<?> cldt = (ChronoLocalDateTime<?>) resolvedObject;
if (resolvedObject instanceof ChronoLocalDateTime<?> cldt) {
updateCheckConflict(cldt.toLocalTime(), Period.ZERO);
updateCheckConflict(cldt.toLocalDate());
changedCount++;