8023763: Rename ChronoDateImpl
Rename ChronoDateImpl to ChronoLocalDateImpl Reviewed-by: sherman
This commit is contained in:
parent
c762984485
commit
75fb106fec
@ -428,7 +428,7 @@ public interface ChronoLocalDate
|
||||
*/
|
||||
@Override
|
||||
default ChronoLocalDate with(TemporalAdjuster adjuster) {
|
||||
return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.with(adjuster));
|
||||
return ChronoLocalDateImpl.ensureValid(getChronology(), Temporal.super.with(adjuster));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -442,7 +442,7 @@ public interface ChronoLocalDate
|
||||
if (field instanceof ChronoField) {
|
||||
throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
|
||||
}
|
||||
return ChronoDateImpl.ensureValid(getChronology(), field.adjustInto(this, newValue));
|
||||
return ChronoLocalDateImpl.ensureValid(getChronology(), field.adjustInto(this, newValue));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -452,7 +452,7 @@ public interface ChronoLocalDate
|
||||
*/
|
||||
@Override
|
||||
default ChronoLocalDate plus(TemporalAmount amount) {
|
||||
return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.plus(amount));
|
||||
return ChronoLocalDateImpl.ensureValid(getChronology(), Temporal.super.plus(amount));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -465,7 +465,7 @@ public interface ChronoLocalDate
|
||||
if (unit instanceof ChronoUnit) {
|
||||
throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
|
||||
}
|
||||
return ChronoDateImpl.ensureValid(getChronology(), unit.addTo(this, amountToAdd));
|
||||
return ChronoLocalDateImpl.ensureValid(getChronology(), unit.addTo(this, amountToAdd));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -475,7 +475,7 @@ public interface ChronoLocalDate
|
||||
*/
|
||||
@Override
|
||||
default ChronoLocalDate minus(TemporalAmount amount) {
|
||||
return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.minus(amount));
|
||||
return ChronoLocalDateImpl.ensureValid(getChronology(), Temporal.super.minus(amount));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -486,7 +486,7 @@ public interface ChronoLocalDate
|
||||
*/
|
||||
@Override
|
||||
default ChronoLocalDate minus(long amountToSubtract, TemporalUnit unit) {
|
||||
return ChronoDateImpl.ensureValid(getChronology(), Temporal.super.minus(amountToSubtract, unit));
|
||||
return ChronoLocalDateImpl.ensureValid(getChronology(), Temporal.super.minus(amountToSubtract, unit));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -140,7 +140,7 @@ import java.util.Objects;
|
||||
* @param <D> the ChronoLocalDate of this date-time
|
||||
* @since 1.8
|
||||
*/
|
||||
abstract class ChronoDateImpl<D extends ChronoLocalDate>
|
||||
abstract class ChronoLocalDateImpl<D extends ChronoLocalDate>
|
||||
implements ChronoLocalDate, Temporal, TemporalAdjuster, Serializable {
|
||||
|
||||
/**
|
||||
@ -170,7 +170,7 @@ abstract class ChronoDateImpl<D extends ChronoLocalDate>
|
||||
/**
|
||||
* Creates an instance.
|
||||
*/
|
||||
ChronoDateImpl() {
|
||||
ChronoLocalDateImpl() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -309,7 +309,7 @@ abstract class ChronoDateImpl<D extends ChronoLocalDate>
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
D minusYears(long yearsToSubtract) {
|
||||
return (yearsToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl<D>)plusYears(Long.MAX_VALUE)).plusYears(1) : plusYears(-yearsToSubtract));
|
||||
return (yearsToSubtract == Long.MIN_VALUE ? ((ChronoLocalDateImpl<D>)plusYears(Long.MAX_VALUE)).plusYears(1) : plusYears(-yearsToSubtract));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -330,7 +330,7 @@ abstract class ChronoDateImpl<D extends ChronoLocalDate>
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
D minusMonths(long monthsToSubtract) {
|
||||
return (monthsToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl<D>)plusMonths(Long.MAX_VALUE)).plusMonths(1) : plusMonths(-monthsToSubtract));
|
||||
return (monthsToSubtract == Long.MIN_VALUE ? ((ChronoLocalDateImpl<D>)plusMonths(Long.MAX_VALUE)).plusMonths(1) : plusMonths(-monthsToSubtract));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -350,7 +350,7 @@ abstract class ChronoDateImpl<D extends ChronoLocalDate>
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
D minusWeeks(long weeksToSubtract) {
|
||||
return (weeksToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl<D>)plusWeeks(Long.MAX_VALUE)).plusWeeks(1) : plusWeeks(-weeksToSubtract));
|
||||
return (weeksToSubtract == Long.MIN_VALUE ? ((ChronoLocalDateImpl<D>)plusWeeks(Long.MAX_VALUE)).plusWeeks(1) : plusWeeks(-weeksToSubtract));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -368,7 +368,7 @@ abstract class ChronoDateImpl<D extends ChronoLocalDate>
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
D minusDays(long daysToSubtract) {
|
||||
return (daysToSubtract == Long.MIN_VALUE ? ((ChronoDateImpl<D>)plusDays(Long.MAX_VALUE)).plusDays(1) : plusDays(-daysToSubtract));
|
||||
return (daysToSubtract == Long.MIN_VALUE ? ((ChronoLocalDateImpl<D>)plusDays(Long.MAX_VALUE)).plusDays(1) : plusDays(-daysToSubtract));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@ -411,7 +411,7 @@ abstract class ChronoDateImpl<D extends ChronoLocalDate>
|
||||
private long monthsUntil(ChronoLocalDate end) {
|
||||
ValueRange range = getChronology().range(MONTH_OF_YEAR);
|
||||
if (range.getMaximum() != 12) {
|
||||
throw new IllegalStateException("ChronoDateImpl only supports Chronologies with 12 months per year");
|
||||
throw new IllegalStateException("ChronoLocalDateImpl only supports Chronologies with 12 months per year");
|
||||
}
|
||||
long packed1 = getLong(PROLEPTIC_MONTH) * 32L + get(DAY_OF_MONTH); // no overflow
|
||||
long packed2 = end.getLong(PROLEPTIC_MONTH) * 32L + end.get(DAY_OF_MONTH); // no overflow
|
@ -220,7 +220,7 @@ final class ChronoLocalDateTimeImpl<D extends ChronoLocalDate>
|
||||
return this;
|
||||
}
|
||||
// Validate that the new Temporal is a ChronoLocalDate (and not something else)
|
||||
D cd = ChronoDateImpl.ensureValid(date.getChronology(), newDate);
|
||||
D cd = ChronoLocalDateImpl.ensureValid(date.getChronology(), newDate);
|
||||
return new ChronoLocalDateTimeImpl<>(cd, newTime);
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ import java.time.temporal.ValueRange;
|
||||
* @since 1.8
|
||||
*/
|
||||
public final class HijrahDate
|
||||
extends ChronoDateImpl<HijrahDate>
|
||||
extends ChronoLocalDateImpl<HijrahDate>
|
||||
implements ChronoLocalDate, Serializable {
|
||||
|
||||
/**
|
||||
|
@ -61,10 +61,8 @@ import static java.time.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR;
|
||||
import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_MONTH;
|
||||
import static java.time.temporal.ChronoField.ALIGNED_WEEK_OF_YEAR;
|
||||
import static java.time.temporal.ChronoField.DAY_OF_MONTH;
|
||||
import static java.time.temporal.ChronoField.DAY_OF_YEAR;
|
||||
import static java.time.temporal.ChronoField.MONTH_OF_YEAR;
|
||||
import static java.time.temporal.ChronoField.YEAR;
|
||||
import static java.time.temporal.ChronoField.YEAR_OF_ERA;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
@ -76,7 +74,6 @@ import java.time.DateTimeException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.time.Period;
|
||||
import java.time.Year;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoField;
|
||||
import java.time.temporal.TemporalAccessor;
|
||||
@ -119,7 +116,7 @@ import sun.util.calendar.LocalGregorianCalendar;
|
||||
* @since 1.8
|
||||
*/
|
||||
public final class JapaneseDate
|
||||
extends ChronoDateImpl<JapaneseDate>
|
||||
extends ChronoLocalDateImpl<JapaneseDate>
|
||||
implements ChronoLocalDate, Serializable {
|
||||
|
||||
/**
|
||||
|
@ -96,7 +96,7 @@ import java.util.Objects;
|
||||
* @since 1.8
|
||||
*/
|
||||
public final class MinguoDate
|
||||
extends ChronoDateImpl<MinguoDate>
|
||||
extends ChronoLocalDateImpl<MinguoDate>
|
||||
implements ChronoLocalDate, Serializable {
|
||||
|
||||
/**
|
||||
|
@ -96,7 +96,7 @@ import java.util.Objects;
|
||||
* @since 1.8
|
||||
*/
|
||||
public final class ThaiBuddhistDate
|
||||
extends ChronoDateImpl<ThaiBuddhistDate>
|
||||
extends ChronoLocalDateImpl<ThaiBuddhistDate>
|
||||
implements ChronoLocalDate, Serializable {
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user