mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8265746: Update java.time to use instanceof pattern variable (part II)
Reviewed-by: dfuchs, lancea, rriggs, chegar, naoto
This commit is contained in:
parent
a85f6cbbaa
commit
45c5da0fd3
20 changed files with 104 additions and 152 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue