Mercurial > hg > openjdk > lambda > jdk
changeset 10212:087c8c1d2631
8025722: TemporalAdjusters and TemporalQueries
Summary: Move static from interfaces methods to supporting classes
Reviewed-by: sherman
line wrap: on
line diff
--- a/src/share/classes/java/time/DayOfWeek.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/DayOfWeek.java Tue Oct 15 13:14:03 2013 -0400 @@ -71,6 +71,7 @@ import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.UnsupportedTemporalTypeException; import java.time.temporal.ValueRange; @@ -403,7 +404,7 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.precision()) { + if (query == TemporalQueries.precision()) { return (R) DAYS; } return TemporalAccessor.super.query(query);
--- a/src/share/classes/java/time/Instant.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/Instant.java Tue Oct 15 13:14:03 2013 -0400 @@ -76,7 +76,6 @@ import java.io.DataOutput; import java.io.IOException; import java.io.InvalidObjectException; -import java.io.InvalidObjectException; import java.io.Serializable; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; @@ -87,6 +86,7 @@ import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; @@ -1050,12 +1050,12 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.precision()) { + if (query == TemporalQueries.precision()) { return (R) NANOS; } // inline TemporalAccessor.super.query(query) as an optimization - if (query == TemporalQuery.chronology() || query == TemporalQuery.zoneId() || - query == TemporalQuery.zone() || query == TemporalQuery.offset()) { + if (query == TemporalQueries.chronology() || query == TemporalQueries.zoneId() || + query == TemporalQueries.zone() || query == TemporalQueries.offset()) { return null; } return query.queryFrom(this);
--- a/src/share/classes/java/time/LocalDate.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/LocalDate.java Tue Oct 15 13:14:03 2013 -0400 @@ -78,7 +78,6 @@ import java.io.DataOutput; import java.io.IOException; import java.io.InvalidObjectException; -import java.io.InvalidObjectException; import java.io.Serializable; import java.time.chrono.ChronoLocalDate; import java.time.chrono.Era; @@ -92,6 +91,7 @@ import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; @@ -342,7 +342,7 @@ * A {@code TemporalAccessor} represents an arbitrary set of date and time information, * which this factory converts to an instance of {@code LocalDate}. * <p> - * The conversion uses the {@link TemporalQuery#localDate()} query, which relies + * The conversion uses the {@link TemporalQueries#localDate()} query, which relies * on extracting the {@link ChronoField#EPOCH_DAY EPOCH_DAY} field. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} @@ -354,7 +354,7 @@ */ public static LocalDate from(TemporalAccessor temporal) { Objects.requireNonNull(temporal, "temporal"); - LocalDate date = temporal.query(TemporalQuery.localDate()); + LocalDate date = temporal.query(TemporalQueries.localDate()); if (date == null) { throw new DateTimeException("Unable to obtain LocalDate from TemporalAccessor: " + temporal + " of type " + temporal.getClass().getName()); @@ -1501,7 +1501,7 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.localDate()) { + if (query == TemporalQueries.localDate()) { return (R) this; } return ChronoLocalDate.super.query(query);
--- a/src/share/classes/java/time/LocalDateTime.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/LocalDateTime.java Tue Oct 15 13:14:03 2013 -0400 @@ -76,7 +76,6 @@ import java.io.DataOutput; import java.io.IOException; import java.io.InvalidObjectException; -import java.io.InvalidObjectException; import java.io.Serializable; import java.time.chrono.ChronoLocalDateTime; import java.time.format.DateTimeFormatter; @@ -88,6 +87,7 @@ import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; @@ -1579,7 +1579,7 @@ @SuppressWarnings("unchecked") @Override // override for Javadoc public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.localDate()) { + if (query == TemporalQueries.localDate()) { return (R) date; } return ChronoLocalDateTime.super.query(query);
--- a/src/share/classes/java/time/LocalTime.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/LocalTime.java Tue Oct 15 13:14:03 2013 -0400 @@ -74,7 +74,6 @@ import java.io.DataOutput; import java.io.IOException; import java.io.InvalidObjectException; -import java.io.InvalidObjectException; import java.io.Serializable; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; @@ -85,6 +84,7 @@ import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; @@ -383,7 +383,7 @@ * A {@code TemporalAccessor} represents an arbitrary set of date and time information, * which this factory converts to an instance of {@code LocalTime}. * <p> - * The conversion uses the {@link TemporalQuery#localTime()} query, which relies + * The conversion uses the {@link TemporalQueries#localTime()} query, which relies * on extracting the {@link ChronoField#NANO_OF_DAY NANO_OF_DAY} field. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} @@ -395,7 +395,7 @@ */ public static LocalTime from(TemporalAccessor temporal) { Objects.requireNonNull(temporal, "temporal"); - LocalTime time = temporal.query(TemporalQuery.localTime()); + LocalTime time = temporal.query(TemporalQueries.localTime()); if (time == null) { throw new DateTimeException("Unable to obtain LocalTime from TemporalAccessor: " + temporal + " of type " + temporal.getClass().getName()); @@ -1281,14 +1281,14 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.chronology() || query == TemporalQuery.zoneId() || - query == TemporalQuery.zone() || query == TemporalQuery.offset()) { + if (query == TemporalQueries.chronology() || query == TemporalQueries.zoneId() || + query == TemporalQueries.zone() || query == TemporalQueries.offset()) { return null; - } else if (query == TemporalQuery.localTime()) { + } else if (query == TemporalQueries.localTime()) { return (R) this; - } else if (query == TemporalQuery.localDate()) { + } else if (query == TemporalQueries.localDate()) { return null; - } else if (query == TemporalQuery.precision()) { + } else if (query == TemporalQueries.precision()) { return (R) NANOS; } // inline TemporalAccessor.super.query(query) as an optimization
--- a/src/share/classes/java/time/Month.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/Month.java Tue Oct 15 13:14:03 2013 -0400 @@ -73,6 +73,7 @@ import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.UnsupportedTemporalTypeException; import java.time.temporal.ValueRange; @@ -560,9 +561,9 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.chronology()) { + if (query == TemporalQueries.chronology()) { return (R) IsoChronology.INSTANCE; - } else if (query == TemporalQuery.precision()) { + } else if (query == TemporalQueries.precision()) { return (R) MONTHS; } return TemporalAccessor.super.query(query);
--- a/src/share/classes/java/time/MonthDay.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/MonthDay.java Tue Oct 15 13:14:03 2013 -0400 @@ -68,7 +68,6 @@ import java.io.DataOutput; import java.io.IOException; import java.io.InvalidObjectException; -import java.io.InvalidObjectException; import java.io.Serializable; import java.time.chrono.Chronology; import java.time.chrono.IsoChronology; @@ -80,6 +79,7 @@ import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.UnsupportedTemporalTypeException; import java.time.temporal.ValueRange; @@ -582,7 +582,7 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.chronology()) { + if (query == TemporalQueries.chronology()) { return (R) IsoChronology.INSTANCE; } return TemporalAccessor.super.query(query);
--- a/src/share/classes/java/time/OffsetDateTime.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/OffsetDateTime.java Tue Oct 15 13:14:03 2013 -0400 @@ -69,7 +69,6 @@ import static java.time.temporal.ChronoUnit.NANOS; import java.io.IOException; -import java.io.InvalidObjectException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.InvalidObjectException; @@ -84,6 +83,7 @@ import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; @@ -1527,17 +1527,17 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.offset() || query == TemporalQuery.zone()) { + if (query == TemporalQueries.offset() || query == TemporalQueries.zone()) { return (R) getOffset(); - } else if (query == TemporalQuery.zoneId()) { + } else if (query == TemporalQueries.zoneId()) { return null; - } else if (query == TemporalQuery.localDate()) { + } else if (query == TemporalQueries.localDate()) { return (R) toLocalDate(); - } else if (query == TemporalQuery.localTime()) { + } else if (query == TemporalQueries.localTime()) { return (R) toLocalTime(); - } else if (query == TemporalQuery.chronology()) { + } else if (query == TemporalQueries.chronology()) { return (R) IsoChronology.INSTANCE; - } else if (query == TemporalQuery.precision()) { + } else if (query == TemporalQueries.precision()) { return (R) NANOS; } // inline TemporalAccessor.super.query(query) as an optimization
--- a/src/share/classes/java/time/OffsetTime.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/OffsetTime.java Tue Oct 15 13:14:03 2013 -0400 @@ -70,7 +70,6 @@ import static java.time.temporal.ChronoUnit.NANOS; import java.io.IOException; -import java.io.InvalidObjectException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.InvalidObjectException; @@ -84,6 +83,7 @@ import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; @@ -1068,13 +1068,13 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.offset() || query == TemporalQuery.zone()) { + if (query == TemporalQueries.offset() || query == TemporalQueries.zone()) { return (R) offset; - } else if (query == TemporalQuery.zoneId() | query == TemporalQuery.chronology() || query == TemporalQuery.localDate()) { + } else if (query == TemporalQueries.zoneId() | query == TemporalQueries.chronology() || query == TemporalQueries.localDate()) { return null; - } else if (query == TemporalQuery.localTime()) { + } else if (query == TemporalQueries.localTime()) { return (R) time; - } else if (query == TemporalQuery.precision()) { + } else if (query == TemporalQueries.precision()) { return (R) NANOS; } // inline TemporalAccessor.super.query(query) as an optimization
--- a/src/share/classes/java/time/Period.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/Period.java Tue Oct 15 13:14:03 2013 -0400 @@ -79,7 +79,7 @@ import java.time.temporal.Temporal; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAmount; -import java.time.temporal.TemporalQuery; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; import java.util.Arrays; @@ -958,7 +958,7 @@ */ private void validateChrono(TemporalAccessor temporal) { Objects.requireNonNull(temporal, "temporal"); - Chronology temporalChrono = temporal.query(TemporalQuery.chronology()); + Chronology temporalChrono = temporal.query(TemporalQueries.chronology()); if (temporalChrono != null && IsoChronology.INSTANCE.equals(temporalChrono) == false) { throw new DateTimeException("Chronology mismatch, expected: ISO, actual: " + temporalChrono.getId()); }
--- a/src/share/classes/java/time/Year.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/Year.java Tue Oct 15 13:14:03 2013 -0400 @@ -74,7 +74,6 @@ import java.io.DataOutput; import java.io.IOException; import java.io.InvalidObjectException; -import java.io.InvalidObjectException; import java.io.Serializable; import java.time.chrono.Chronology; import java.time.chrono.IsoChronology; @@ -89,6 +88,7 @@ import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; @@ -812,9 +812,9 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.chronology()) { + if (query == TemporalQueries.chronology()) { return (R) IsoChronology.INSTANCE; - } else if (query == TemporalQuery.precision()) { + } else if (query == TemporalQueries.precision()) { return (R) YEARS; } return Temporal.super.query(query);
--- a/src/share/classes/java/time/YearMonth.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/YearMonth.java Tue Oct 15 13:14:03 2013 -0400 @@ -77,7 +77,6 @@ import java.io.DataOutput; import java.io.IOException; import java.io.InvalidObjectException; -import java.io.InvalidObjectException; import java.io.Serializable; import java.time.chrono.Chronology; import java.time.chrono.IsoChronology; @@ -92,6 +91,7 @@ import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; @@ -945,9 +945,9 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.chronology()) { + if (query == TemporalQueries.chronology()) { return (R) IsoChronology.INSTANCE; - } else if (query == TemporalQuery.precision()) { + } else if (query == TemporalQueries.precision()) { return (R) MONTHS; } return Temporal.super.query(query);
--- a/src/share/classes/java/time/ZoneId.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/ZoneId.java Tue Oct 15 13:14:03 2013 -0400 @@ -69,6 +69,7 @@ import java.time.format.TextStyle; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.UnsupportedTemporalTypeException; import java.time.zone.ZoneRules; @@ -492,7 +493,7 @@ * This factory converts the arbitrary temporal object to an instance of {@code ZoneId}. * <p> * The conversion will try to obtain the zone in a way that favours region-based - * zones over offset-based zones using {@link TemporalQuery#zone()}. + * zones over offset-based zones using {@link TemporalQueries#zone()}. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} * allowing it to be used in queries via method reference, {@code ZoneId::from}. @@ -502,7 +503,7 @@ * @throws DateTimeException if unable to convert to a {@code ZoneId} */ public static ZoneId from(TemporalAccessor temporal) { - ZoneId obj = temporal.query(TemporalQuery.zone()); + ZoneId obj = temporal.query(TemporalQueries.zone()); if (obj == null) { throw new DateTimeException("Unable to obtain ZoneId from TemporalAccessor: " + temporal + " of type " + temporal.getClass().getName()); @@ -558,7 +559,7 @@ * methods on the interface have no meaning to {@code ZoneId}. * <p> * The returned temporal has no supported fields, with the query method - * supporting the return of the zone using {@link TemporalQuery#zoneId()}. + * supporting the return of the zone using {@link TemporalQueries#zoneId()}. * * @return a temporal equivalent to this zone, not null */ @@ -575,7 +576,7 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.zoneId()) { + if (query == TemporalQueries.zoneId()) { return (R) ZoneId.this; } return TemporalAccessor.super.query(query);
--- a/src/share/classes/java/time/ZoneOffset.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/ZoneOffset.java Tue Oct 15 13:14:03 2013 -0400 @@ -70,13 +70,13 @@ import java.io.DataOutput; import java.io.IOException; import java.io.InvalidObjectException; -import java.io.InvalidObjectException; import java.io.Serializable; import java.time.temporal.ChronoField; import java.time.temporal.Temporal; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.UnsupportedTemporalTypeException; import java.time.temporal.ValueRange; @@ -322,7 +322,7 @@ * A {@code TemporalAccessor} represents some form of date and time information. * This factory converts the arbitrary temporal object to an instance of {@code ZoneOffset}. * <p> - * The conversion uses the {@link TemporalQuery#offset()} query, which relies + * The conversion uses the {@link TemporalQueries#offset()} query, which relies * on extracting the {@link ChronoField#OFFSET_SECONDS OFFSET_SECONDS} field. * <p> * This method matches the signature of the functional interface {@link TemporalQuery} @@ -334,7 +334,7 @@ */ public static ZoneOffset from(TemporalAccessor temporal) { Objects.requireNonNull(temporal, "temporal"); - ZoneOffset offset = temporal.query(TemporalQuery.offset()); + ZoneOffset offset = temporal.query(TemporalQueries.offset()); if (offset == null) { throw new DateTimeException("Unable to obtain ZoneOffset from TemporalAccessor: " + temporal + " of type " + temporal.getClass().getName()); @@ -642,7 +642,7 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.offset() || query == TemporalQuery.zone()) { + if (query == TemporalQueries.offset() || query == TemporalQueries.zone()) { return (R) this; } return TemporalAccessor.super.query(query);
--- a/src/share/classes/java/time/chrono/AbstractChronology.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/chrono/AbstractChronology.java Tue Oct 15 13:14:03 2013 -0400 @@ -77,7 +77,7 @@ import static java.time.temporal.ChronoUnit.DAYS; import static java.time.temporal.ChronoUnit.MONTHS; import static java.time.temporal.ChronoUnit.WEEKS; -import static java.time.temporal.TemporalAdjuster.nextOrSame; +import static java.time.temporal.TemporalAdjusters.nextOrSame; import java.io.DataInput; import java.io.DataOutput; @@ -89,7 +89,7 @@ import java.time.DayOfWeek; import java.time.format.ResolverStyle; import java.time.temporal.ChronoField; -import java.time.temporal.TemporalAdjuster; +import java.time.temporal.TemporalAdjusters; import java.time.temporal.TemporalField; import java.time.temporal.ValueRange; import java.util.Comparator; @@ -561,7 +561,7 @@ try { return date(y, moy, dom); } catch (DateTimeException ex) { - return date(y, moy, 1).with(TemporalAdjuster.lastDayOfMonth()); + return date(y, moy, 1).with(TemporalAdjusters.lastDayOfMonth()); } } return date(y, moy, dom);
--- a/src/share/classes/java/time/chrono/ChronoLocalDate.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/chrono/ChronoLocalDate.java Tue Oct 15 13:14:03 2013 -0400 @@ -77,6 +77,7 @@ import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; @@ -292,7 +293,7 @@ return (ChronoLocalDate) temporal; } Objects.requireNonNull(temporal, "temporal"); - Chronology chrono = temporal.query(TemporalQuery.chronology()); + Chronology chrono = temporal.query(TemporalQueries.chronology()); if (chrono == null) { throw new DateTimeException("Unable to obtain ChronoLocalDate from TemporalAccessor: " + temporal.getClass()); } @@ -511,13 +512,13 @@ @SuppressWarnings("unchecked") @Override default <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.zoneId() || query == TemporalQuery.zone() || query == TemporalQuery.offset()) { + if (query == TemporalQueries.zoneId() || query == TemporalQueries.zone() || query == TemporalQueries.offset()) { return null; - } else if (query == TemporalQuery.localTime()) { + } else if (query == TemporalQueries.localTime()) { return null; - } else if (query == TemporalQuery.chronology()) { + } else if (query == TemporalQueries.chronology()) { return (R) getChronology(); - } else if (query == TemporalQuery.precision()) { + } else if (query == TemporalQueries.precision()) { return (R) DAYS; } // inline TemporalAccessor.super.query(query) as an optimization
--- a/src/share/classes/java/time/chrono/ChronoLocalDateTime.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/chrono/ChronoLocalDateTime.java Tue Oct 15 13:14:03 2013 -0400 @@ -80,6 +80,7 @@ import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.zone.ZoneRules; @@ -166,7 +167,7 @@ return (ChronoLocalDateTime<?>) temporal; } Objects.requireNonNull(temporal, "temporal"); - Chronology chrono = temporal.query(TemporalQuery.chronology()); + Chronology chrono = temporal.query(TemporalQueries.chronology()); if (chrono == null) { throw new DateTimeException("Unable to obtain ChronoLocalDateTime from TemporalAccessor: " + temporal.getClass()); } @@ -334,13 +335,13 @@ @SuppressWarnings("unchecked") @Override default <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.zoneId() || query == TemporalQuery.zone() || query == TemporalQuery.offset()) { + if (query == TemporalQueries.zoneId() || query == TemporalQueries.zone() || query == TemporalQueries.offset()) { return null; - } else if (query == TemporalQuery.localTime()) { + } else if (query == TemporalQueries.localTime()) { return (R) toLocalTime(); - } else if (query == TemporalQuery.chronology()) { + } else if (query == TemporalQueries.chronology()) { return (R) getChronology(); - } else if (query == TemporalQuery.precision()) { + } else if (query == TemporalQueries.precision()) { return (R) NANOS; } // inline TemporalAccessor.super.query(query) as an optimization
--- a/src/share/classes/java/time/chrono/ChronoPeriodImpl.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/chrono/ChronoPeriodImpl.java Tue Oct 15 13:14:03 2013 -0400 @@ -72,7 +72,7 @@ import java.time.temporal.Temporal; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAmount; -import java.time.temporal.TemporalQuery; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; import java.time.temporal.ValueRange; @@ -308,7 +308,7 @@ */ private void validateChrono(TemporalAccessor temporal) { Objects.requireNonNull(temporal, "temporal"); - Chronology temporalChrono = temporal.query(TemporalQuery.chronology()); + Chronology temporalChrono = temporal.query(TemporalQueries.chronology()); if (temporalChrono != null && chrono.equals(temporalChrono) == false) { throw new DateTimeException("Chronology mismatch, expected: " + chrono.getId() + ", actual: " + temporalChrono.getId()); }
--- a/src/share/classes/java/time/chrono/ChronoZonedDateTime.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/chrono/ChronoZonedDateTime.java Tue Oct 15 13:14:03 2013 -0400 @@ -80,6 +80,7 @@ import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; @@ -167,7 +168,7 @@ return (ChronoZonedDateTime<?>) temporal; } Objects.requireNonNull(temporal, "temporal"); - Chronology chrono = temporal.query(TemporalQuery.chronology()); + Chronology chrono = temporal.query(TemporalQueries.chronology()); if (chrono == null) { throw new DateTimeException("Unable to obtain ChronoZonedDateTime from TemporalAccessor: " + temporal.getClass()); } @@ -481,15 +482,15 @@ @SuppressWarnings("unchecked") @Override default <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.zone() || query == TemporalQuery.zoneId()) { + if (query == TemporalQueries.zone() || query == TemporalQueries.zoneId()) { return (R) getZone(); - } else if (query == TemporalQuery.offset()) { + } else if (query == TemporalQueries.offset()) { return (R) getOffset(); - } else if (query == TemporalQuery.localTime()) { + } else if (query == TemporalQueries.localTime()) { return (R) toLocalTime(); - } else if (query == TemporalQuery.chronology()) { + } else if (query == TemporalQueries.chronology()) { return (R) getChronology(); - } else if (query == TemporalQuery.precision()) { + } else if (query == TemporalQueries.precision()) { return (R) NANOS; } // inline TemporalAccessor.super.query(query) as an optimization
--- a/src/share/classes/java/time/chrono/Chronology.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/chrono/Chronology.java Tue Oct 15 13:14:03 2013 -0400 @@ -73,6 +73,7 @@ import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.UnsupportedTemporalTypeException; import java.time.temporal.ValueRange; @@ -162,10 +163,10 @@ * A {@code TemporalAccessor} represents an arbitrary set of date and time information, * which this factory converts to an instance of {@code Chronology}. * <p> - * The conversion will obtain the chronology using {@link TemporalQuery#chronology()}. + * The conversion will obtain the chronology using {@link TemporalQueries.chronology()}. * If the specified temporal object does not have a chronology, {@link IsoChronology} is returned. * <p> - * This method matches the signature of the functional interface {@link TemporalQuery} + * This method matches the signature of the functional interface {@link TemporalQueries. * allowing it to be used in queries via method reference, {@code Chronology::from}. * * @param temporal the temporal to convert, not null @@ -174,7 +175,7 @@ */ static Chronology from(TemporalAccessor temporal) { Objects.requireNonNull(temporal, "temporal"); - Chronology obj = temporal.query(TemporalQuery.chronology()); + Chronology obj = temporal.query(TemporalQueries.chronology()); return (obj != null ? obj : IsoChronology.INSTANCE); } @@ -434,7 +435,7 @@ * The conversion typically uses the {@link ChronoField#EPOCH_DAY EPOCH_DAY} * field, which is standardized across calendar systems. * <p> - * This method matches the signature of the functional interface {@link TemporalQuery} + * This method matches the signature of the functional interface {@link TemporalQueries. * allowing it to be used as a query via method reference, {@code aChronology::date}. * * @param temporal the temporal object to convert, not null @@ -457,7 +458,7 @@ * those fields that are equivalent to the relevant objects. * The result uses this chronology. * <p> - * This method matches the signature of the functional interface {@link TemporalQuery} + * This method matches the signature of the functional interface {@link TemporalQueries. * allowing it to be used as a query via method reference, {@code aChronology::localDateTime}. * * @param temporal the temporal object to convert, not null @@ -489,7 +490,7 @@ * those fields that are equivalent to the relevant objects. * The result uses this chronology. * <p> - * This method matches the signature of the functional interface {@link TemporalQuery} + * This method matches the signature of the functional interface {@link TemporalQueries. * allowing it to be used as a query via method reference, {@code aChronology::zonedDateTime}. * * @param temporal the temporal object to convert, not null @@ -641,7 +642,7 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.chronology()) { + if (query == TemporalQueries.chronology()) { return (R) Chronology.this; } return TemporalAccessor.super.query(query);
--- a/src/share/classes/java/time/chrono/Era.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/chrono/Era.java Tue Oct 15 13:14:03 2013 -0400 @@ -73,6 +73,7 @@ import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.ValueRange; import java.util.Locale; @@ -265,7 +266,7 @@ @SuppressWarnings("unchecked") @Override default <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.precision()) { + if (query == TemporalQueries.precision()) { return (R) ERAS; } return TemporalAccessor.super.query(query);
--- a/src/share/classes/java/time/chrono/JapaneseChronology.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/chrono/JapaneseChronology.java Tue Oct 15 13:14:03 2013 -0400 @@ -56,8 +56,6 @@ */ package java.time.chrono; -import java.io.InvalidObjectException; -import java.io.ObjectStreamException; import static java.time.temporal.ChronoField.DAY_OF_MONTH; import static java.time.temporal.ChronoField.DAY_OF_YEAR; import static java.time.temporal.ChronoField.ERA; @@ -67,6 +65,7 @@ import static java.time.temporal.ChronoUnit.DAYS; import static java.time.temporal.ChronoUnit.MONTHS; +import java.io.InvalidObjectException; import java.io.Serializable; import java.time.Clock; import java.time.DateTimeException; @@ -77,7 +76,7 @@ import java.time.format.ResolverStyle; import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; -import java.time.temporal.TemporalAdjuster; +import java.time.temporal.TemporalAdjusters; import java.time.temporal.TemporalField; import java.time.temporal.UnsupportedTemporalTypeException; import java.time.temporal.ValueRange; @@ -480,7 +479,7 @@ try { result = date(y, moy, dom); } catch (DateTimeException ex) { - result = date(y, moy, 1).with(TemporalAdjuster.lastDayOfMonth()); + result = date(y, moy, 1).with(TemporalAdjusters.lastDayOfMonth()); } // handle the era being changed // only allow if the new date is in the same Jan-Dec as the era change
--- a/src/share/classes/java/time/format/DateTimeFormatterBuilder.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/format/DateTimeFormatterBuilder.java Tue Oct 15 13:14:03 2013 -0400 @@ -90,6 +90,7 @@ import java.time.temporal.IsoFields; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.ValueRange; import java.time.temporal.WeekFields; @@ -155,7 +156,7 @@ * Query for a time-zone that is region-only. */ private static final TemporalQuery<ZoneId> QUERY_REGION_ONLY = (temporal) -> { - ZoneId zone = temporal.query(TemporalQuery.zoneId()); + ZoneId zone = temporal.query(TemporalQueries.zoneId()); return (zone != null && zone instanceof ZoneOffset == false ? zone : null); }; @@ -877,7 +878,7 @@ * This appends an instruction to format/parse the offset ID to the builder. * <p> * During formatting, the offset is obtained using a mechanism equivalent - * to querying the temporal with {@link TemporalQuery#offset()}. + * to querying the temporal with {@link TemporalQueries#offset()}. * It will be printed using the format defined below. * If the offset cannot be obtained then an exception is thrown unless the * section of the formatter is optional. @@ -930,7 +931,7 @@ * </ul><p> * <p> * During formatting, the offset is obtained using a mechanism equivalent - * to querying the temporal with {@link TemporalQuery#offset()}. + * to querying the temporal with {@link TemporalQueries#offset()}. * If the offset cannot be obtained then an exception is thrown unless the * section of the formatter is optional. * <p> @@ -962,7 +963,7 @@ * for use with this method, see {@link #appendZoneOrOffsetId()}. * <p> * During formatting, the zone is obtained using a mechanism equivalent - * to querying the temporal with {@link TemporalQuery#zoneId()}. + * to querying the temporal with {@link TemporalQueries#zoneId()}. * It will be printed using the result of {@link ZoneId#getId()}. * If the zone cannot be obtained then an exception is thrown unless the * section of the formatter is optional. @@ -1000,7 +1001,7 @@ * @see #appendZoneRegionId() */ public DateTimeFormatterBuilder appendZoneId() { - appendInternal(new ZoneIdPrinterParser(TemporalQuery.zoneId(), "ZoneId()")); + appendInternal(new ZoneIdPrinterParser(TemporalQueries.zoneId(), "ZoneId()")); return this; } @@ -1012,7 +1013,7 @@ * only if it is a region-based ID. * <p> * During formatting, the zone is obtained using a mechanism equivalent - * to querying the temporal with {@link TemporalQuery#zoneId()}. + * to querying the temporal with {@link TemporalQueries#zoneId()}. * If the zone is a {@code ZoneOffset} or it cannot be obtained then * an exception is thrown unless the section of the formatter is optional. * If the zone is not an offset, then the zone will be printed using @@ -1071,7 +1072,7 @@ * then attempts to find an offset, such as that on {@code OffsetDateTime}. * <p> * During formatting, the zone is obtained using a mechanism equivalent - * to querying the temporal with {@link TemporalQuery#zone()}. + * to querying the temporal with {@link TemporalQueries#zone()}. * It will be printed using the result of {@link ZoneId#getId()}. * If the zone cannot be obtained then an exception is thrown unless the * section of the formatter is optional. @@ -1112,7 +1113,7 @@ * @see #appendZoneId() */ public DateTimeFormatterBuilder appendZoneOrOffsetId() { - appendInternal(new ZoneIdPrinterParser(TemporalQuery.zone(), "ZoneOrOffsetId()")); + appendInternal(new ZoneIdPrinterParser(TemporalQueries.zone(), "ZoneOrOffsetId()")); return this; } @@ -1123,7 +1124,7 @@ * the builder. * <p> * During formatting, the zone is obtained using a mechanism equivalent - * to querying the temporal with {@link TemporalQuery#zoneId()}. + * to querying the temporal with {@link TemporalQueries#zoneId()}. * If the zone is a {@code ZoneOffset} it will be printed using the * result of {@link ZoneOffset#getId()}. * If the zone is not an offset, the textual name will be looked up @@ -1159,7 +1160,7 @@ * the builder. * <p> * During formatting, the zone is obtained using a mechanism equivalent - * to querying the temporal with {@link TemporalQuery#zoneId()}. + * to querying the temporal with {@link TemporalQueries#zoneId()}. * If the zone is a {@code ZoneOffset} it will be printed using the * result of {@link ZoneOffset#getId()}. * If the zone is not an offset, the textual name will be looked up @@ -1202,7 +1203,7 @@ * This appends an instruction to format/parse the chronology ID to the builder. * <p> * During formatting, the chronology is obtained using a mechanism equivalent - * to querying the temporal with {@link TemporalQuery#chronology()}. + * to querying the temporal with {@link TemporalQueries#chronology()}. * It will be printed using the result of {@link Chronology#getId()}. * If the chronology cannot be obtained then an exception is thrown unless the * section of the formatter is optional. @@ -3062,7 +3063,7 @@ return false; } String text; - Chronology chrono = context.getTemporal().query(TemporalQuery.chronology()); + Chronology chrono = context.getTemporal().query(TemporalQueries.chronology()); if (chrono == null || chrono == IsoChronology.INSTANCE) { text = provider.getText(field, value, textStyle, context.getLocale()); } else { @@ -3590,7 +3591,7 @@ private Set<String> preferredZones; ZoneTextPrinterParser(TextStyle textStyle, Set<ZoneId> preferredZones) { - super(TemporalQuery.zone(), "ZoneText(" + textStyle + ")"); + super(TemporalQueries.zone(), "ZoneText(" + textStyle + ")"); this.textStyle = Objects.requireNonNull(textStyle, "textStyle"); if (preferredZones != null && preferredZones.size() != 0) { this.preferredZones = new HashSet<>(); @@ -3647,7 +3648,7 @@ @Override public boolean format(DateTimePrintContext context, StringBuilder buf) { - ZoneId zone = context.getValue(TemporalQuery.zoneId()); + ZoneId zone = context.getValue(TemporalQueries.zoneId()); if (zone == null) { return false; } @@ -4228,7 +4229,7 @@ @Override public boolean format(DateTimePrintContext context, StringBuilder buf) { - Chronology chrono = context.getValue(TemporalQuery.chronology()); + Chronology chrono = context.getValue(TemporalQueries.chronology()); if (chrono == null) { return false; }
--- a/src/share/classes/java/time/format/DateTimePrintContext.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/format/DateTimePrintContext.java Tue Oct 15 13:14:03 2013 -0400 @@ -75,6 +75,7 @@ import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.ValueRange; import java.util.Locale; @@ -128,8 +129,8 @@ } // ensure minimal change (early return is an optimization) - Chronology temporalChrono = temporal.query(TemporalQuery.chronology()); - ZoneId temporalZone = temporal.query(TemporalQuery.zoneId()); + Chronology temporalChrono = temporal.query(TemporalQueries.chronology()); + ZoneId temporalZone = temporal.query(TemporalQueries.zoneId()); if (Objects.equals(overrideChrono, temporalChrono)) { overrideChrono = null; } @@ -206,13 +207,13 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.chronology()) { + if (query == TemporalQueries.chronology()) { return (R) effectiveChrono; } - if (query == TemporalQuery.zoneId()) { + if (query == TemporalQueries.zoneId()) { return (R) effectiveZone; } - if (query == TemporalQuery.precision()) { + if (query == TemporalQueries.precision()) { return temporal.query(query); } return query.queryFrom(this);
--- a/src/share/classes/java/time/format/Parsed.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/format/Parsed.java Tue Oct 15 13:14:03 2013 -0400 @@ -89,6 +89,7 @@ import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.UnsupportedTemporalTypeException; import java.util.HashMap; @@ -207,17 +208,17 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.zoneId()) { + if (query == TemporalQueries.zoneId()) { return (R) zone; - } else if (query == TemporalQuery.chronology()) { + } else if (query == TemporalQueries.chronology()) { return (R) chrono; - } else if (query == TemporalQuery.localDate()) { + } else if (query == TemporalQueries.localDate()) { return (R) (date != null ? LocalDate.from(date) : null); - } else if (query == TemporalQuery.localTime()) { + } else if (query == TemporalQueries.localTime()) { return (R) time; - } else if (query == TemporalQuery.zone() || query == TemporalQuery.offset()) { + } else if (query == TemporalQueries.zone() || query == TemporalQueries.offset()) { return query.queryFrom(this); - } else if (query == TemporalQuery.precision()) { + } else if (query == TemporalQueries.precision()) { return null; // not a complete date/time } // inline TemporalAccessor.super.query(query) as an optimization
--- a/src/share/classes/java/time/temporal/TemporalAccessor.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/temporal/TemporalAccessor.java Tue Oct 15 13:14:03 2013 -0400 @@ -272,8 +272,8 @@ * @implSpec * The default implementation must behave equivalent to this code: * <pre> - * if (query == TemporalQuery.zoneId() || - * query == TemporalQuery.chronology() || query == TemporalQuery.precision()) { + * if (query == TemporalQueries.zoneId() || + * query == TemporalQueries.chronology() || query == TemporalQueries.precision()) { * return null; * } * return query.queryFrom(this); @@ -290,7 +290,7 @@ * For example, an application-defined {@code HourMin} class storing the hour * and minute must override this method as follows: * <pre> - * if (query == TemporalQuery.precision()) { + * if (query == TemporalQueries.precision()) { * return MINUTES; * } * return TemporalAccessor.super.query(query); @@ -306,7 +306,9 @@ * @throws ArithmeticException if numeric overflow occurs */ default <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.zoneId() || query == TemporalQuery.chronology() || query == TemporalQuery.precision()) { + if (query == TemporalQueries.zoneId() + || query == TemporalQueries.chronology() + || query == TemporalQueries.precision()) { return null; } return query.queryFrom(this);
--- a/src/share/classes/java/time/temporal/TemporalAdjuster.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/temporal/TemporalAdjuster.java Tue Oct 15 13:14:03 2013 -0400 @@ -62,9 +62,6 @@ package java.time.temporal; import java.time.DateTimeException; -import java.time.DayOfWeek; -import java.time.LocalDate; -import java.util.function.UnaryOperator; /** * Strategy for adjusting a temporal object. @@ -86,7 +83,8 @@ * It is recommended to use the second approach, {@code with(TemporalAdjuster)}, * as it is a lot clearer to read in code. * <p> - * This class also contains a standard set of adjusters, available as static methods. + * The {@link TemporalAdjusters} class contains a standard set of adjusters, + * available as static methods. * These include: * <ul> * <li>finding the first or last day of the month @@ -100,9 +98,8 @@ * @implSpec * This interface places no restrictions on the mutability of implementations, * however immutability is strongly recommended. - * <p> - * All the implementations supplied by the static methods on this interface are immutable. * + * @see TemporalAdjusters * @since 1.8 */ @FunctionalInterface @@ -140,7 +137,7 @@ * <p> * The input temporal object may be in a calendar system other than ISO. * Implementations may choose to document compatibility with other calendar systems, - * or reject non-ISO temporal objects by {@link TemporalQuery#chronology() querying the chronology}. + * or reject non-ISO temporal objects by {@link TemporalQueries#chronology() querying the chronology}. * <p> * This method may be called from multiple threads in parallel. * It must be thread-safe when invoked. @@ -152,311 +149,4 @@ */ Temporal adjustInto(Temporal temporal); - //----------------------------------------------------------------------- - /** - * Obtains a {@code TemporalAdjuster} that wraps a date adjuster. - * <p> - * The {@code TemporalAdjuster} is based on the low level {@code Temporal} interface. - * This method allows an adjustment from {@code LocalDate} to {@code LocalDate} - * to be wrapped to match the temporal-based interface. - * This is provided for convenience to make user-written adjusters simpler. - * <p> - * In general, user-written adjusters should be static constants: - * <pre>{@code - * static TemporalAdjuster TWO_DAYS_LATER = TemporalAdjuster.ofDateAdjuster( - * date -> date.plusDays(2)); - * }</pre> - * - * @param dateBasedAdjuster the date-based adjuster, not null - * @return the temporal adjuster wrapping on the date adjuster, not null - */ - static TemporalAdjuster ofDateAdjuster(UnaryOperator<LocalDate> dateBasedAdjuster) { - return TemporalAdjusters.ofDateAdjuster(dateBasedAdjuster); - } - - //----------------------------------------------------------------------- - /** - * Returns the "first day of month" adjuster, which returns a new date set to - * the first day of the current month. - * <p> - * The ISO calendar system behaves as follows:<br> - * The input 2011-01-15 will return 2011-01-01.<br> - * The input 2011-02-15 will return 2011-02-01. - * <p> - * The behavior is suitable for use with most calendar systems. - * It is equivalent to: - * <pre> - * temporal.with(DAY_OF_MONTH, 1); - * </pre> - * - * @return the first day-of-month adjuster, not null - */ - static TemporalAdjuster firstDayOfMonth() { - return TemporalAdjusters.firstDayOfMonth(); - } - - /** - * Returns the "last day of month" adjuster, which returns a new date set to - * the last day of the current month. - * <p> - * The ISO calendar system behaves as follows:<br> - * The input 2011-01-15 will return 2011-01-31.<br> - * The input 2011-02-15 will return 2011-02-28.<br> - * The input 2012-02-15 will return 2012-02-29 (leap year).<br> - * The input 2011-04-15 will return 2011-04-30. - * <p> - * The behavior is suitable for use with most calendar systems. - * It is equivalent to: - * <pre> - * long lastDay = temporal.range(DAY_OF_MONTH).getMaximum(); - * temporal.with(DAY_OF_MONTH, lastDay); - * </pre> - * - * @return the last day-of-month adjuster, not null - */ - static TemporalAdjuster lastDayOfMonth() { - return TemporalAdjusters.lastDayOfMonth(); - } - - /** - * Returns the "first day of next month" adjuster, which returns a new date set to - * the first day of the next month. - * <p> - * The ISO calendar system behaves as follows:<br> - * The input 2011-01-15 will return 2011-02-01.<br> - * The input 2011-02-15 will return 2011-03-01. - * <p> - * The behavior is suitable for use with most calendar systems. - * It is equivalent to: - * <pre> - * temporal.with(DAY_OF_MONTH, 1).plus(1, MONTHS); - * </pre> - * - * @return the first day of next month adjuster, not null - */ - static TemporalAdjuster firstDayOfNextMonth() { - return TemporalAdjusters.firstDayOfNextMonth(); - } - - //----------------------------------------------------------------------- - /** - * Returns the "first day of year" adjuster, which returns a new date set to - * the first day of the current year. - * <p> - * The ISO calendar system behaves as follows:<br> - * The input 2011-01-15 will return 2011-01-01.<br> - * The input 2011-02-15 will return 2011-01-01.<br> - * <p> - * The behavior is suitable for use with most calendar systems. - * It is equivalent to: - * <pre> - * temporal.with(DAY_OF_YEAR, 1); - * </pre> - * - * @return the first day-of-year adjuster, not null - */ - static TemporalAdjuster firstDayOfYear() { - return TemporalAdjusters.firstDayOfYear(); - } - - /** - * Returns the "last day of year" adjuster, which returns a new date set to - * the last day of the current year. - * <p> - * The ISO calendar system behaves as follows:<br> - * The input 2011-01-15 will return 2011-12-31.<br> - * The input 2011-02-15 will return 2011-12-31.<br> - * <p> - * The behavior is suitable for use with most calendar systems. - * It is equivalent to: - * <pre> - * long lastDay = temporal.range(DAY_OF_YEAR).getMaximum(); - * temporal.with(DAY_OF_YEAR, lastDay); - * </pre> - * - * @return the last day-of-year adjuster, not null - */ - static TemporalAdjuster lastDayOfYear() { - return TemporalAdjusters.lastDayOfYear(); - } - - /** - * Returns the "first day of next year" adjuster, which returns a new date set to - * the first day of the next year. - * <p> - * The ISO calendar system behaves as follows:<br> - * The input 2011-01-15 will return 2012-01-01. - * <p> - * The behavior is suitable for use with most calendar systems. - * It is equivalent to: - * <pre> - * temporal.with(DAY_OF_YEAR, 1).plus(1, YEARS); - * </pre> - * - * @return the first day of next month adjuster, not null - */ - static TemporalAdjuster firstDayOfNextYear() { - return TemporalAdjusters.firstDayOfNextYear(); - } - - //----------------------------------------------------------------------- - /** - * Returns the first in month adjuster, which returns a new date - * in the same month with the first matching day-of-week. - * This is used for expressions like 'first Tuesday in March'. - * <p> - * The ISO calendar system behaves as follows:<br> - * The input 2011-12-15 for (MONDAY) will return 2011-12-05.<br> - * The input 2011-12-15 for (FRIDAY) will return 2011-12-02.<br> - * <p> - * The behavior is suitable for use with most calendar systems. - * It uses the {@code DAY_OF_WEEK} and {@code DAY_OF_MONTH} fields - * and the {@code DAYS} unit, and assumes a seven day week. - * - * @param dayOfWeek the day-of-week, not null - * @return the first in month adjuster, not null - */ - static TemporalAdjuster firstInMonth(DayOfWeek dayOfWeek) { - return TemporalAdjuster.dayOfWeekInMonth(1, dayOfWeek); - } - - /** - * Returns the last in month adjuster, which returns a new date - * in the same month with the last matching day-of-week. - * This is used for expressions like 'last Tuesday in March'. - * <p> - * The ISO calendar system behaves as follows:<br> - * The input 2011-12-15 for (MONDAY) will return 2011-12-26.<br> - * The input 2011-12-15 for (FRIDAY) will return 2011-12-30.<br> - * <p> - * The behavior is suitable for use with most calendar systems. - * It uses the {@code DAY_OF_WEEK} and {@code DAY_OF_MONTH} fields - * and the {@code DAYS} unit, and assumes a seven day week. - * - * @param dayOfWeek the day-of-week, not null - * @return the first in month adjuster, not null - */ - static TemporalAdjuster lastInMonth(DayOfWeek dayOfWeek) { - return TemporalAdjuster.dayOfWeekInMonth(-1, dayOfWeek); - } - - /** - * Returns the day-of-week in month adjuster, which returns a new date - * in the same month with the ordinal day-of-week. - * This is used for expressions like the 'second Tuesday in March'. - * <p> - * The ISO calendar system behaves as follows:<br> - * The input 2011-12-15 for (1,TUESDAY) will return 2011-12-06.<br> - * The input 2011-12-15 for (2,TUESDAY) will return 2011-12-13.<br> - * The input 2011-12-15 for (3,TUESDAY) will return 2011-12-20.<br> - * The input 2011-12-15 for (4,TUESDAY) will return 2011-12-27.<br> - * The input 2011-12-15 for (5,TUESDAY) will return 2012-01-03.<br> - * The input 2011-12-15 for (-1,TUESDAY) will return 2011-12-27 (last in month).<br> - * The input 2011-12-15 for (-4,TUESDAY) will return 2011-12-06 (3 weeks before last in month).<br> - * The input 2011-12-15 for (-5,TUESDAY) will return 2011-11-29 (4 weeks before last in month).<br> - * The input 2011-12-15 for (0,TUESDAY) will return 2011-11-29 (last in previous month).<br> - * <p> - * For a positive or zero ordinal, the algorithm is equivalent to finding the first - * day-of-week that matches within the month and then adding a number of weeks to it. - * For a negative ordinal, the algorithm is equivalent to finding the last - * day-of-week that matches within the month and then subtracting a number of weeks to it. - * The ordinal number of weeks is not validated and is interpreted leniently - * according to this algorithm. This definition means that an ordinal of zero finds - * the last matching day-of-week in the previous month. - * <p> - * The behavior is suitable for use with most calendar systems. - * It uses the {@code DAY_OF_WEEK} and {@code DAY_OF_MONTH} fields - * and the {@code DAYS} unit, and assumes a seven day week. - * - * @param ordinal the week within the month, unbounded but typically from -5 to 5 - * @param dayOfWeek the day-of-week, not null - * @return the day-of-week in month adjuster, not null - */ - static TemporalAdjuster dayOfWeekInMonth(final int ordinal, DayOfWeek dayOfWeek) { - return TemporalAdjusters.dayOfWeekInMonth(ordinal, dayOfWeek); - } - - //----------------------------------------------------------------------- - /** - * Returns the next day-of-week adjuster, which adjusts the date to the - * first occurrence of the specified day-of-week after the date being adjusted. - * <p> - * The ISO calendar system behaves as follows:<br> - * The input 2011-01-15 (a Saturday) for parameter (MONDAY) will return 2011-01-17 (two days later).<br> - * The input 2011-01-15 (a Saturday) for parameter (WEDNESDAY) will return 2011-01-19 (four days later).<br> - * The input 2011-01-15 (a Saturday) for parameter (SATURDAY) will return 2011-01-22 (seven days later). - * <p> - * The behavior is suitable for use with most calendar systems. - * It uses the {@code DAY_OF_WEEK} field and the {@code DAYS} unit, - * and assumes a seven day week. - * - * @param dayOfWeek the day-of-week to move the date to, not null - * @return the next day-of-week adjuster, not null - */ - static TemporalAdjuster next(DayOfWeek dayOfWeek) { - return TemporalAdjusters.next(dayOfWeek); - } - - /** - * Returns the next-or-same day-of-week adjuster, which adjusts the date to the - * first occurrence of the specified day-of-week after the date being adjusted - * unless it is already on that day in which case the same object is returned. - * <p> - * The ISO calendar system behaves as follows:<br> - * The input 2011-01-15 (a Saturday) for parameter (MONDAY) will return 2011-01-17 (two days later).<br> - * The input 2011-01-15 (a Saturday) for parameter (WEDNESDAY) will return 2011-01-19 (four days later).<br> - * The input 2011-01-15 (a Saturday) for parameter (SATURDAY) will return 2011-01-15 (same as input). - * <p> - * The behavior is suitable for use with most calendar systems. - * It uses the {@code DAY_OF_WEEK} field and the {@code DAYS} unit, - * and assumes a seven day week. - * - * @param dayOfWeek the day-of-week to check for or move the date to, not null - * @return the next-or-same day-of-week adjuster, not null - */ - static TemporalAdjuster nextOrSame(DayOfWeek dayOfWeek) { - return TemporalAdjusters.nextOrSame(dayOfWeek); - } - - /** - * Returns the previous day-of-week adjuster, which adjusts the date to the - * first occurrence of the specified day-of-week before the date being adjusted. - * <p> - * The ISO calendar system behaves as follows:<br> - * The input 2011-01-15 (a Saturday) for parameter (MONDAY) will return 2011-01-10 (five days earlier).<br> - * The input 2011-01-15 (a Saturday) for parameter (WEDNESDAY) will return 2011-01-12 (three days earlier).<br> - * The input 2011-01-15 (a Saturday) for parameter (SATURDAY) will return 2011-01-08 (seven days earlier). - * <p> - * The behavior is suitable for use with most calendar systems. - * It uses the {@code DAY_OF_WEEK} field and the {@code DAYS} unit, - * and assumes a seven day week. - * - * @param dayOfWeek the day-of-week to move the date to, not null - * @return the previous day-of-week adjuster, not null - */ - static TemporalAdjuster previous(DayOfWeek dayOfWeek) { - return TemporalAdjusters.previous(dayOfWeek); - } - - /** - * Returns the previous-or-same day-of-week adjuster, which adjusts the date to the - * first occurrence of the specified day-of-week before the date being adjusted - * unless it is already on that day in which case the same object is returned. - * <p> - * The ISO calendar system behaves as follows:<br> - * The input 2011-01-15 (a Saturday) for parameter (MONDAY) will return 2011-01-10 (five days earlier).<br> - * The input 2011-01-15 (a Saturday) for parameter (WEDNESDAY) will return 2011-01-12 (three days earlier).<br> - * The input 2011-01-15 (a Saturday) for parameter (SATURDAY) will return 2011-01-15 (same as input). - * <p> - * The behavior is suitable for use with most calendar systems. - * It uses the {@code DAY_OF_WEEK} field and the {@code DAYS} unit, - * and assumes a seven day week. - * - * @param dayOfWeek the day-of-week to check for or move the date to, not null - * @return the previous-or-same day-of-week adjuster, not null - */ - static TemporalAdjuster previousOrSame(DayOfWeek dayOfWeek) { - return TemporalAdjusters.previousOrSame(dayOfWeek); - } - }
--- a/src/share/classes/java/time/temporal/TemporalAdjusters.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/temporal/TemporalAdjusters.java Tue Oct 15 13:14:03 2013 -0400 @@ -74,13 +74,47 @@ import java.util.function.UnaryOperator; /** - * Implementations of the static methods in {@code TemporalAdjuster} + * Common and useful TemporalAdjusters. + * <p> + * Adjusters are a key tool for modifying temporal objects. + * They exist to externalize the process of adjustment, permitting different + * approaches, as per the strategy design pattern. + * Examples might be an adjuster that sets the date avoiding weekends, or one that + * sets the date to the last day of the month. + * <p> + * There are two equivalent ways of using a {@code TemporalAdjuster}. + * The first is to invoke the method on the interface directly. + * The second is to use {@link Temporal#with(TemporalAdjuster)}: + * <pre> + * // these two lines are equivalent, but the second approach is recommended + * temporal = thisAdjuster.adjustInto(temporal); + * temporal = temporal.with(thisAdjuster); + * </pre> + * It is recommended to use the second approach, {@code with(TemporalAdjuster)}, + * as it is a lot clearer to read in code. + * <p> + * This class contains a standard set of adjusters, available as static methods. + * These include: + * <ul> + * <li>finding the first or last day of the month + * <li>finding the first day of next month + * <li>finding the first or last day of the year + * <li>finding the first day of next year + * <li>finding the first or last day-of-week within a month, such as "first Wednesday in June" + * <li>finding the next or previous day-of-week, such as "next Thursday" + * </ul> * + * @implSpec + * All the implementations supplied by the static methods are immutable. + * + * @see TemporalAdjuster * @since 1.8 */ -final class TemporalAdjusters { - // work around compiler bug not allowing lambdas in static methods +public final class TemporalAdjusters { + /** + * Private constructor since this is a utility class. + */ private TemporalAdjusters() { } @@ -94,15 +128,15 @@ * This is provided for convenience to make user-written adjusters simpler. * <p> * In general, user-written adjusters should be static constants: - * <pre> - * public static TemporalAdjuster TWO_DAYS_LATER = TemporalAdjuster.ofDateAdjuster( - * date -> date.plusDays(2)); - * </pre> + * <pre>{@code + * static TemporalAdjuster TWO_DAYS_LATER = + * TemporalAdjusters.ofDateAdjuster(date -> date.plusDays(2)); + * }</pre> * * @param dateBasedAdjuster the date-based adjuster, not null * @return the temporal adjuster wrapping on the date adjuster, not null */ - static TemporalAdjuster ofDateAdjuster(UnaryOperator<LocalDate> dateBasedAdjuster) { + public static TemporalAdjuster ofDateAdjuster(UnaryOperator<LocalDate> dateBasedAdjuster) { Objects.requireNonNull(dateBasedAdjuster, "dateBasedAdjuster"); return (temporal) -> { LocalDate input = LocalDate.from(temporal); @@ -128,7 +162,7 @@ * * @return the first day-of-month adjuster, not null */ - static TemporalAdjuster firstDayOfMonth() { + public static TemporalAdjuster firstDayOfMonth() { return (temporal) -> temporal.with(DAY_OF_MONTH, 1); } @@ -151,7 +185,7 @@ * * @return the last day-of-month adjuster, not null */ - static TemporalAdjuster lastDayOfMonth() { + public static TemporalAdjuster lastDayOfMonth() { return (temporal) -> temporal.with(DAY_OF_MONTH, temporal.range(DAY_OF_MONTH).getMaximum()); } @@ -171,7 +205,7 @@ * * @return the first day of next month adjuster, not null */ - static TemporalAdjuster firstDayOfNextMonth() { + public static TemporalAdjuster firstDayOfNextMonth() { return (temporal) -> temporal.with(DAY_OF_MONTH, 1).plus(1, MONTHS); } @@ -192,7 +226,7 @@ * * @return the first day-of-year adjuster, not null */ - static TemporalAdjuster firstDayOfYear() { + public static TemporalAdjuster firstDayOfYear() { return (temporal) -> temporal.with(DAY_OF_YEAR, 1); } @@ -213,7 +247,7 @@ * * @return the last day-of-year adjuster, not null */ - static TemporalAdjuster lastDayOfYear() { + public static TemporalAdjuster lastDayOfYear() { return (temporal) -> temporal.with(DAY_OF_YEAR, temporal.range(DAY_OF_YEAR).getMaximum()); } @@ -232,7 +266,7 @@ * * @return the first day of next month adjuster, not null */ - static TemporalAdjuster firstDayOfNextYear() { + public static TemporalAdjuster firstDayOfNextYear() { return (temporal) -> temporal.with(DAY_OF_YEAR, 1).plus(1, YEARS); } @@ -253,7 +287,7 @@ * @param dayOfWeek the day-of-week, not null * @return the first in month adjuster, not null */ - static TemporalAdjuster firstInMonth(DayOfWeek dayOfWeek) { + public static TemporalAdjuster firstInMonth(DayOfWeek dayOfWeek) { return TemporalAdjusters.dayOfWeekInMonth(1, dayOfWeek); } @@ -273,7 +307,7 @@ * @param dayOfWeek the day-of-week, not null * @return the first in month adjuster, not null */ - static TemporalAdjuster lastInMonth(DayOfWeek dayOfWeek) { + public static TemporalAdjuster lastInMonth(DayOfWeek dayOfWeek) { return TemporalAdjusters.dayOfWeekInMonth(-1, dayOfWeek); } @@ -309,7 +343,7 @@ * @param dayOfWeek the day-of-week, not null * @return the day-of-week in month adjuster, not null */ - static TemporalAdjuster dayOfWeekInMonth(int ordinal, DayOfWeek dayOfWeek) { + public static TemporalAdjuster dayOfWeekInMonth(int ordinal, DayOfWeek dayOfWeek) { Objects.requireNonNull(dayOfWeek, "dayOfWeek"); int dowValue = dayOfWeek.getValue(); if (ordinal >= 0) { @@ -349,7 +383,7 @@ * @param dayOfWeek the day-of-week to move the date to, not null * @return the next day-of-week adjuster, not null */ - static TemporalAdjuster next(DayOfWeek dayOfWeek) { + public static TemporalAdjuster next(DayOfWeek dayOfWeek) { int dowValue = dayOfWeek.getValue(); return (temporal) -> { int calDow = temporal.get(DAY_OF_WEEK); @@ -375,7 +409,7 @@ * @param dayOfWeek the day-of-week to check for or move the date to, not null * @return the next-or-same day-of-week adjuster, not null */ - static TemporalAdjuster nextOrSame(DayOfWeek dayOfWeek) { + public static TemporalAdjuster nextOrSame(DayOfWeek dayOfWeek) { int dowValue = dayOfWeek.getValue(); return (temporal) -> { int calDow = temporal.get(DAY_OF_WEEK); @@ -403,7 +437,7 @@ * @param dayOfWeek the day-of-week to move the date to, not null * @return the previous day-of-week adjuster, not null */ - static TemporalAdjuster previous(DayOfWeek dayOfWeek) { + public static TemporalAdjuster previous(DayOfWeek dayOfWeek) { int dowValue = dayOfWeek.getValue(); return (temporal) -> { int calDow = temporal.get(DAY_OF_WEEK); @@ -429,7 +463,7 @@ * @param dayOfWeek the day-of-week to check for or move the date to, not null * @return the previous-or-same day-of-week adjuster, not null */ - static TemporalAdjuster previousOrSame(DayOfWeek dayOfWeek) { + public static TemporalAdjuster previousOrSame(DayOfWeek dayOfWeek) { int dowValue = dayOfWeek.getValue(); return (temporal) -> { int calDow = temporal.get(DAY_OF_WEEK);
--- a/src/share/classes/java/time/temporal/TemporalAmount.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/temporal/TemporalAmount.java Tue Oct 15 13:14:03 2013 -0400 @@ -163,7 +163,7 @@ * <p> * The input temporal object may be in a calendar system other than ISO. * Implementations may choose to document compatibility with other calendar systems, - * or reject non-ISO temporal objects by {@link TemporalQuery#chronology() querying the chronology}. + * or reject non-ISO temporal objects by {@link TemporalQueries#chronology() querying the chronology}. * <p> * This method may be called from multiple threads in parallel. * It must be thread-safe when invoked. @@ -205,7 +205,7 @@ * <p> * The input temporal object may be in a calendar system other than ISO. * Implementations may choose to document compatibility with other calendar systems, - * or reject non-ISO temporal objects by {@link TemporalQuery#chronology() querying the chronology}. + * or reject non-ISO temporal objects by {@link TemporalQueries#chronology() querying the chronology}. * <p> * This method may be called from multiple threads in parallel. * It must be thread-safe when invoked.
--- a/src/share/classes/java/time/temporal/TemporalQueries.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/temporal/TemporalQueries.java Tue Oct 15 13:14:03 2013 -0400 @@ -78,10 +78,44 @@ * These are defined here as they must be constants, and the definition * of lambdas does not guarantee that. By assigning them once here, * they become 'normal' Java constants. + * <p> + * Queries are a key tool for extracting information from temporal objects. + * They exist to externalize the process of querying, permitting different + * approaches, as per the strategy design pattern. + * Examples might be a query that checks if the date is the day before February 29th + * in a leap year, or calculates the number of days to your next birthday. + * <p> + * The {@link TemporalField} interface provides another mechanism for querying + * temporal objects. That interface is limited to returning a {@code long}. + * By contrast, queries can return any type. + * <p> + * There are two equivalent ways of using a {@code TemporalQuery}. + * The first is to invoke the method on this interface directly. + * The second is to use {@link TemporalAccessor#query(TemporalQuery)}: + * <pre> + * // these two lines are equivalent, but the second approach is recommended + * temporal = thisQuery.queryFrom(temporal); + * temporal = temporal.query(thisQuery); + * </pre> + * It is recommended to use the second approach, {@code query(TemporalQuery)}, + * as it is a lot clearer to read in code. + * <p> + * The most common implementations are method references, such as + * {@code LocalDate::from} and {@code ZoneId::from}. + * Additional common queries are provided to return: + * <ul> + * <li> a Chronology, + * <li> a LocalDate, + * <li> a LocalTime, + * <li> a ZoneOffset, + * <li> a precision, + * <li> a zone, or + * <li> a zoneId. + * </ul> * * @since 1.8 */ -final class TemporalQueries { +public final class TemporalQueries { // note that it is vital that each method supplies a constant, not a // calculated value, as they will be checked for using == // it is also vital that each constant is different (due to the == checking) @@ -94,6 +128,216 @@ } //----------------------------------------------------------------------- + // special constants should be used to extract information from a TemporalAccessor + // that cannot be derived in other ways + // Javadoc added here, so as to pretend they are more normal than they really are + + /** + * A strict query for the {@code ZoneId}. + * <p> + * This queries a {@code TemporalAccessor} for the zone. + * The zone is only returned if the date-time conceptually contains a {@code ZoneId}. + * It will not be returned if the date-time only conceptually has an {@code ZoneOffset}. + * Thus a {@link java.time.ZonedDateTime} will return the result of {@code getZone()}, + * but an {@link java.time.OffsetDateTime} will return null. + * <p> + * In most cases, applications should use {@link #zone()} as this query is too strict. + * <p> + * The result from JDK classes implementing {@code TemporalAccessor} is as follows:<br> + * {@code LocalDate} returns null<br> + * {@code LocalTime} returns null<br> + * {@code LocalDateTime} returns null<br> + * {@code ZonedDateTime} returns the associated zone<br> + * {@code OffsetTime} returns null<br> + * {@code OffsetDateTime} returns null<br> + * {@code ChronoLocalDate} returns null<br> + * {@code ChronoLocalDateTime} returns null<br> + * {@code ChronoZonedDateTime} returns the associated zone<br> + * {@code Era} returns null<br> + * {@code DayOfWeek} returns null<br> + * {@code Month} returns null<br> + * {@code Year} returns null<br> + * {@code YearMonth} returns null<br> + * {@code MonthDay} returns null<br> + * {@code ZoneOffset} returns null<br> + * {@code Instant} returns null<br> + * + * @return a query that can obtain the zone ID of a temporal, not null + */ + public static TemporalQuery<ZoneId> zoneId() { + return TemporalQueries.ZONE_ID; + } + + /** + * A query for the {@code Chronology}. + * <p> + * This queries a {@code TemporalAccessor} for the chronology. + * If the target {@code TemporalAccessor} represents a date, or part of a date, + * then it should return the chronology that the date is expressed in. + * As a result of this definition, objects only representing time, such as + * {@code LocalTime}, will return null. + * <p> + * The result from JDK classes implementing {@code TemporalAccessor} is as follows:<br> + * {@code LocalDate} returns {@code IsoChronology.INSTANCE}<br> + * {@code LocalTime} returns null (does not represent a date)<br> + * {@code LocalDateTime} returns {@code IsoChronology.INSTANCE}<br> + * {@code ZonedDateTime} returns {@code IsoChronology.INSTANCE}<br> + * {@code OffsetTime} returns null (does not represent a date)<br> + * {@code OffsetDateTime} returns {@code IsoChronology.INSTANCE}<br> + * {@code ChronoLocalDate} returns the associated chronology<br> + * {@code ChronoLocalDateTime} returns the associated chronology<br> + * {@code ChronoZonedDateTime} returns the associated chronology<br> + * {@code Era} returns the associated chronology<br> + * {@code DayOfWeek} returns null (shared across chronologies)<br> + * {@code Month} returns {@code IsoChronology.INSTANCE}<br> + * {@code Year} returns {@code IsoChronology.INSTANCE}<br> + * {@code YearMonth} returns {@code IsoChronology.INSTANCE}<br> + * {@code MonthDay} returns null {@code IsoChronology.INSTANCE}<br> + * {@code ZoneOffset} returns null (does not represent a date)<br> + * {@code Instant} returns null (does not represent a date)<br> + * <p> + * The method {@link java.time.chrono.Chronology#from(TemporalAccessor)} can be used as a + * {@code TemporalQuery} via a method reference, {@code Chronology::from}. + * That method is equivalent to this query, except that it throws an + * exception if a chronology cannot be obtained. + * + * @return a query that can obtain the chronology of a temporal, not null + */ + public static TemporalQuery<Chronology> chronology() { + return TemporalQueries.CHRONO; + } + + /** + * A query for the smallest supported unit. + * <p> + * This queries a {@code TemporalAccessor} for the time precision. + * If the target {@code TemporalAccessor} represents a consistent or complete date-time, + * date or time then this must return the smallest precision actually supported. + * Note that fields such as {@code NANO_OF_DAY} and {@code NANO_OF_SECOND} + * are defined to always return ignoring the precision, thus this is the only + * way to find the actual smallest supported unit. + * For example, were {@code GregorianCalendar} to implement {@code TemporalAccessor} + * it would return a precision of {@code MILLIS}. + * <p> + * The result from JDK classes implementing {@code TemporalAccessor} is as follows:<br> + * {@code LocalDate} returns {@code DAYS}<br> + * {@code LocalTime} returns {@code NANOS}<br> + * {@code LocalDateTime} returns {@code NANOS}<br> + * {@code ZonedDateTime} returns {@code NANOS}<br> + * {@code OffsetTime} returns {@code NANOS}<br> + * {@code OffsetDateTime} returns {@code NANOS}<br> + * {@code ChronoLocalDate} returns {@code DAYS}<br> + * {@code ChronoLocalDateTime} returns {@code NANOS}<br> + * {@code ChronoZonedDateTime} returns {@code NANOS}<br> + * {@code Era} returns {@code ERAS}<br> + * {@code DayOfWeek} returns {@code DAYS}<br> + * {@code Month} returns {@code MONTHS}<br> + * {@code Year} returns {@code YEARS}<br> + * {@code YearMonth} returns {@code MONTHS}<br> + * {@code MonthDay} returns null (does not represent a complete date or time)<br> + * {@code ZoneOffset} returns null (does not represent a date or time)<br> + * {@code Instant} returns {@code NANOS}<br> + * + * @return a query that can obtain the precision of a temporal, not null + */ + public static TemporalQuery<TemporalUnit> precision() { + return TemporalQueries.PRECISION; + } + + //----------------------------------------------------------------------- + // non-special constants are standard queries that derive information from other information + /** + * A lenient query for the {@code ZoneId}, falling back to the {@code ZoneOffset}. + * <p> + * This queries a {@code TemporalAccessor} for the zone. + * It first tries to obtain the zone, using {@link #zoneId()}. + * If that is not found it tries to obtain the {@link #offset()}. + * Thus a {@link java.time.ZonedDateTime} will return the result of {@code getZone()}, + * while an {@link java.time.OffsetDateTime} will return the result of {@code getOffset()}. + * <p> + * In most cases, applications should use this query rather than {@code #zoneId()}. + * <p> + * The method {@link ZoneId#from(TemporalAccessor)} can be used as a + * {@code TemporalQuery} via a method reference, {@code ZoneId::from}. + * That method is equivalent to this query, except that it throws an + * exception if a zone cannot be obtained. + * + * @return a query that can obtain the zone ID or offset of a temporal, not null + */ + public static TemporalQuery<ZoneId> zone() { + return TemporalQueries.ZONE; + } + + /** + * A query for {@code ZoneOffset} returning null if not found. + * <p> + * This returns a {@code TemporalQuery} that can be used to query a temporal + * object for the offset. The query will return null if the temporal + * object cannot supply an offset. + * <p> + * The query implementation examines the {@link ChronoField#OFFSET_SECONDS OFFSET_SECONDS} + * field and uses it to create a {@code ZoneOffset}. + * <p> + * The method {@link java.time.ZoneOffset#from(TemporalAccessor)} can be used as a + * {@code TemporalQuery} via a method reference, {@code ZoneOffset::from}. + * This query and {@code ZoneOffset::from} will return the same result if the + * temporal object contains an offset. If the temporal object does not contain + * an offset, then the method reference will throw an exception, whereas this + * query will return null. + * + * @return a query that can obtain the offset of a temporal, not null + */ + public static TemporalQuery<ZoneOffset> offset() { + return TemporalQueries.OFFSET; + } + + /** + * A query for {@code LocalDate} returning null if not found. + * <p> + * This returns a {@code TemporalQuery} that can be used to query a temporal + * object for the local date. The query will return null if the temporal + * object cannot supply a local date. + * <p> + * The query implementation examines the {@link ChronoField#EPOCH_DAY EPOCH_DAY} + * field and uses it to create a {@code LocalDate}. + * <p> + * The method {@link ZoneOffset#from(TemporalAccessor)} can be used as a + * {@code TemporalQuery} via a method reference, {@code LocalDate::from}. + * This query and {@code LocalDate::from} will return the same result if the + * temporal object contains a date. If the temporal object does not contain + * a date, then the method reference will throw an exception, whereas this + * query will return null. + * + * @return a query that can obtain the date of a temporal, not null + */ + public static TemporalQuery<LocalDate> localDate() { + return TemporalQueries.LOCAL_DATE; + } + + /** + * A query for {@code LocalTime} returning null if not found. + * <p> + * This returns a {@code TemporalQuery} that can be used to query a temporal + * object for the local time. The query will return null if the temporal + * object cannot supply a local time. + * <p> + * The query implementation examines the {@link ChronoField#NANO_OF_DAY NANO_OF_DAY} + * field and uses it to create a {@code LocalTime}. + * <p> + * The method {@link ZoneOffset#from(TemporalAccessor)} can be used as a + * {@code TemporalQuery} via a method reference, {@code LocalTime::from}. + * This query and {@code LocalTime::from} will return the same result if the + * temporal object contains a time. If the temporal object does not contain + * a time, then the method reference will throw an exception, whereas this + * query will return null. + * + * @return a query that can obtain the time of a temporal, not null + */ + public static TemporalQuery<LocalTime> localTime() { + return TemporalQueries.LOCAL_TIME; + } + + //----------------------------------------------------------------------- /** * A strict query for the {@code ZoneId}. */
--- a/src/share/classes/java/time/temporal/TemporalQuery.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/temporal/TemporalQuery.java Tue Oct 15 13:14:03 2013 -0400 @@ -62,11 +62,6 @@ package java.time.temporal; import java.time.DateTimeException; -import java.time.LocalDate; -import java.time.LocalTime; -import java.time.ZoneId; -import java.time.ZoneOffset; -import java.time.chrono.Chronology; /** * Strategy for querying a temporal object. @@ -94,12 +89,14 @@ * <p> * The most common implementations are method references, such as * {@code LocalDate::from} and {@code ZoneId::from}. - * Additional common implementations are provided on this interface as static methods. + * Additional common queries are provided as static methods in {@link TemporalQueries}. * * @implSpec * This interface places no restrictions on the mutability of implementations, * however immutability is strongly recommended. * + * @param <R> the type returned from the query + * * @since 1.8 */ @FunctionalInterface @@ -133,7 +130,7 @@ * <p> * The input temporal object may be in a calendar system other than ISO. * Implementations may choose to document compatibility with other calendar systems, - * or reject non-ISO temporal objects by {@link TemporalQuery#chronology() querying the chronology}. + * or reject non-ISO temporal objects by {@link TemporalQueries#chronology() querying the chronology}. * <p> * This method may be called from multiple threads in parallel. * It must be thread-safe when invoked. @@ -145,214 +142,4 @@ */ R queryFrom(TemporalAccessor temporal); - //----------------------------------------------------------------------- - // special constants should be used to extract information from a TemporalAccessor - // that cannot be derived in other ways - // Javadoc added here, so as to pretend they are more normal than they really are - - /** - * A strict query for the {@code ZoneId}. - * <p> - * This queries a {@code TemporalAccessor} for the zone. - * The zone is only returned if the date-time conceptually contains a {@code ZoneId}. - * It will not be returned if the date-time only conceptually has an {@code ZoneOffset}. - * Thus a {@link java.time.ZonedDateTime} will return the result of {@code getZone()}, - * but an {@link java.time.OffsetDateTime} will return null. - * <p> - * In most cases, applications should use {@link #zone()} as this query is too strict. - * <p> - * The result from JDK classes implementing {@code TemporalAccessor} is as follows:<br> - * {@code LocalDate} returns null<br> - * {@code LocalTime} returns null<br> - * {@code LocalDateTime} returns null<br> - * {@code ZonedDateTime} returns the associated zone<br> - * {@code OffsetTime} returns null<br> - * {@code OffsetDateTime} returns null<br> - * {@code ChronoLocalDate} returns null<br> - * {@code ChronoLocalDateTime} returns null<br> - * {@code ChronoZonedDateTime} returns the associated zone<br> - * {@code Era} returns null<br> - * {@code DayOfWeek} returns null<br> - * {@code Month} returns null<br> - * {@code Year} returns null<br> - * {@code YearMonth} returns null<br> - * {@code MonthDay} returns null<br> - * {@code ZoneOffset} returns null<br> - * {@code Instant} returns null<br> - * - * @return a query that can obtain the zone ID of a temporal, not null - */ - static TemporalQuery<ZoneId> zoneId() { - return TemporalQueries.ZONE_ID; - } - - /** - * A query for the {@code Chronology}. - * <p> - * This queries a {@code TemporalAccessor} for the chronology. - * If the target {@code TemporalAccessor} represents a date, or part of a date, - * then it should return the chronology that the date is expressed in. - * As a result of this definition, objects only representing time, such as - * {@code LocalTime}, will return null. - * <p> - * The result from JDK classes implementing {@code TemporalAccessor} is as follows:<br> - * {@code LocalDate} returns {@code IsoChronology.INSTANCE}<br> - * {@code LocalTime} returns null (does not represent a date)<br> - * {@code LocalDateTime} returns {@code IsoChronology.INSTANCE}<br> - * {@code ZonedDateTime} returns {@code IsoChronology.INSTANCE}<br> - * {@code OffsetTime} returns null (does not represent a date)<br> - * {@code OffsetDateTime} returns {@code IsoChronology.INSTANCE}<br> - * {@code ChronoLocalDate} returns the associated chronology<br> - * {@code ChronoLocalDateTime} returns the associated chronology<br> - * {@code ChronoZonedDateTime} returns the associated chronology<br> - * {@code Era} returns the associated chronology<br> - * {@code DayOfWeek} returns null (shared across chronologies)<br> - * {@code Month} returns {@code IsoChronology.INSTANCE}<br> - * {@code Year} returns {@code IsoChronology.INSTANCE}<br> - * {@code YearMonth} returns {@code IsoChronology.INSTANCE}<br> - * {@code MonthDay} returns null {@code IsoChronology.INSTANCE}<br> - * {@code ZoneOffset} returns null (does not represent a date)<br> - * {@code Instant} returns null (does not represent a date)<br> - * <p> - * The method {@link java.time.chrono.Chronology#from(TemporalAccessor)} can be used as a - * {@code TemporalQuery} via a method reference, {@code Chronology::from}. - * That method is equivalent to this query, except that it throws an - * exception if a chronology cannot be obtained. - * - * @return a query that can obtain the chronology of a temporal, not null - */ - static TemporalQuery<Chronology> chronology() { - return TemporalQueries.CHRONO; - } - - /** - * A query for the smallest supported unit. - * <p> - * This queries a {@code TemporalAccessor} for the time precision. - * If the target {@code TemporalAccessor} represents a consistent or complete date-time, - * date or time then this must return the smallest precision actually supported. - * Note that fields such as {@code NANO_OF_DAY} and {@code NANO_OF_SECOND} - * are defined to always return ignoring the precision, thus this is the only - * way to find the actual smallest supported unit. - * For example, were {@code GregorianCalendar} to implement {@code TemporalAccessor} - * it would return a precision of {@code MILLIS}. - * <p> - * The result from JDK classes implementing {@code TemporalAccessor} is as follows:<br> - * {@code LocalDate} returns {@code DAYS}<br> - * {@code LocalTime} returns {@code NANOS}<br> - * {@code LocalDateTime} returns {@code NANOS}<br> - * {@code ZonedDateTime} returns {@code NANOS}<br> - * {@code OffsetTime} returns {@code NANOS}<br> - * {@code OffsetDateTime} returns {@code NANOS}<br> - * {@code ChronoLocalDate} returns {@code DAYS}<br> - * {@code ChronoLocalDateTime} returns {@code NANOS}<br> - * {@code ChronoZonedDateTime} returns {@code NANOS}<br> - * {@code Era} returns {@code ERAS}<br> - * {@code DayOfWeek} returns {@code DAYS}<br> - * {@code Month} returns {@code MONTHS}<br> - * {@code Year} returns {@code YEARS}<br> - * {@code YearMonth} returns {@code MONTHS}<br> - * {@code MonthDay} returns null (does not represent a complete date or time)<br> - * {@code ZoneOffset} returns null (does not represent a date or time)<br> - * {@code Instant} returns {@code NANOS}<br> - * - * @return a query that can obtain the precision of a temporal, not null - */ - static TemporalQuery<TemporalUnit> precision() { - return TemporalQueries.PRECISION; - } - - //----------------------------------------------------------------------- - // non-special constants are standard queries that derive information from other information - /** - * A lenient query for the {@code ZoneId}, falling back to the {@code ZoneOffset}. - * <p> - * This queries a {@code TemporalAccessor} for the zone. - * It first tries to obtain the zone, using {@link #zoneId()}. - * If that is not found it tries to obtain the {@link #offset()}. - * Thus a {@link java.time.ZonedDateTime} will return the result of {@code getZone()}, - * while an {@link java.time.OffsetDateTime} will return the result of {@code getOffset()}. - * <p> - * In most cases, applications should use this query rather than {@code #zoneId()}. - * <p> - * The method {@link ZoneId#from(TemporalAccessor)} can be used as a - * {@code TemporalQuery} via a method reference, {@code ZoneId::from}. - * That method is equivalent to this query, except that it throws an - * exception if a zone cannot be obtained. - * - * @return a query that can obtain the zone ID or offset of a temporal, not null - */ - static TemporalQuery<ZoneId> zone() { - return TemporalQueries.ZONE; - } - - /** - * A query for {@code ZoneOffset} returning null if not found. - * <p> - * This returns a {@code TemporalQuery} that can be used to query a temporal - * object for the offset. The query will return null if the temporal - * object cannot supply an offset. - * <p> - * The query implementation examines the {@link ChronoField#OFFSET_SECONDS OFFSET_SECONDS} - * field and uses it to create a {@code ZoneOffset}. - * <p> - * The method {@link java.time.ZoneOffset#from(TemporalAccessor)} can be used as a - * {@code TemporalQuery} via a method reference, {@code ZoneOffset::from}. - * This query and {@code ZoneOffset::from} will return the same result if the - * temporal object contains an offset. If the temporal object does not contain - * an offset, then the method reference will throw an exception, whereas this - * query will return null. - * - * @return a query that can obtain the offset of a temporal, not null - */ - static TemporalQuery<ZoneOffset> offset() { - return TemporalQueries.OFFSET; - } - - /** - * A query for {@code LocalDate} returning null if not found. - * <p> - * This returns a {@code TemporalQuery} that can be used to query a temporal - * object for the local date. The query will return null if the temporal - * object cannot supply a local date. - * <p> - * The query implementation examines the {@link ChronoField#EPOCH_DAY EPOCH_DAY} - * field and uses it to create a {@code LocalDate}. - * <p> - * The method {@link ZoneOffset#from(TemporalAccessor)} can be used as a - * {@code TemporalQuery} via a method reference, {@code LocalDate::from}. - * This query and {@code LocalDate::from} will return the same result if the - * temporal object contains a date. If the temporal object does not contain - * a date, then the method reference will throw an exception, whereas this - * query will return null. - * - * @return a query that can obtain the date of a temporal, not null - */ - static TemporalQuery<LocalDate> localDate() { - return TemporalQueries.LOCAL_DATE; - } - - /** - * A query for {@code LocalTime} returning null if not found. - * <p> - * This returns a {@code TemporalQuery} that can be used to query a temporal - * object for the local time. The query will return null if the temporal - * object cannot supply a local time. - * <p> - * The query implementation examines the {@link ChronoField#NANO_OF_DAY NANO_OF_DAY} - * field and uses it to create a {@code LocalTime}. - * <p> - * The method {@link ZoneOffset#from(TemporalAccessor)} can be used as a - * {@code TemporalQuery} via a method reference, {@code LocalTime::from}. - * This query and {@code LocalTime::from} will return the same result if the - * temporal object contains a time. If the temporal object does not contain - * a time, then the method reference will throw an exception, whereas this - * query will return null. - * - * @return a query that can obtain the time of a temporal, not null - */ - static TemporalQuery<LocalTime> localTime() { - return TemporalQueries.LOCAL_TIME; - } - }
--- a/src/share/classes/java/time/temporal/package-info.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/temporal/package-info.java Tue Oct 15 13:14:03 2013 -0400 @@ -81,7 +81,7 @@ * A unit is used to measure an amount of time, such as years, days or minutes. * All units implement {@link java.time.temporal.TemporalUnit}. * The set of well known units is defined in {@link java.time.temporal.ChronoUnit}, such as {@code DAYS}. - * The unit interface is designed to allow applications defined units. + * The unit interface is designed to allow application defined units. * </p> * <p> * A field is used to express part of a larger date-time, such as year, month-of-year or second-of-minute. @@ -89,7 +89,7 @@ * The set of well known fields are defined in {@link java.time.temporal.ChronoField}, such as {@code HOUR_OF_DAY}. * Additional fields are defined by {@link java.time.temporal.JulianFields}, {@link java.time.temporal.WeekFields} * and {@link java.time.temporal.IsoFields}. - * The field interface is designed to allow applications defined fields. + * The field interface is designed to allow application defined fields. * </p> * <p> * This package provides tools that allow the units and fields of date and time to be accessed @@ -112,23 +112,23 @@ * such as the "last day of the month", or "next Wednesday". * These are modeled as functions that adjust a base date-time. * The functions implement {@link java.time.temporal.TemporalAdjuster} and operate on {@code Temporal}. - * A set of common functions are provided in {@code TemporalAdjuster}. + * A set of common functions are provided in {@link java.time.temporal.TemporalAdjusters}. * For example, to find the first occurrence of a day-of-week after a given date, use - * {@link java.time.temporal.TemporalAdjuster#next(DayOfWeek)}, such as + * {@link java.time.temporal.TemporalAdjusters#next(DayOfWeek)}, such as * {@code date.with(next(MONDAY))}. - * Applications can also define adjusters by implementing {@code TemporalAdjuster}. + * Applications can also define adjusters by implementing {@link java.time.temporal.TemporalAdjuster}. * </p> * <p> * The {@link java.time.temporal.TemporalAmount} interface models amounts of relative time. * </p> * <p> - * In addition to adjusting a date-time, an interface is provided to enable querying - + * In addition to adjusting a date-time, an interface is provided to enable querying via * {@link java.time.temporal.TemporalQuery}. * The most common implementations of the query interface are method references. * The {@code from(TemporalAccessor)} methods on major classes can all be used, such as * {@code LocalDate::from} or {@code Month::from}. - * Further implementations are provided in {@code TemporalQuery} as static methods. - * Applications can also define queries by implementing {@code TemporalQuery}. + * Further implementations are provided in {@link java.time.temporal.TemporalQueries} as static methods. + * Applications can also define queries by implementing {@link java.time.temporal.TemporalQuery}. * </p> * * <h3>Weeks</h3>
--- a/src/share/classes/java/time/zone/ZoneOffsetTransitionRule.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/time/zone/ZoneOffsetTransitionRule.java Tue Oct 15 13:14:03 2013 -0400 @@ -61,8 +61,8 @@ */ package java.time.zone; -import static java.time.temporal.TemporalAdjuster.nextOrSame; -import static java.time.temporal.TemporalAdjuster.previousOrSame; +import static java.time.temporal.TemporalAdjusters.nextOrSame; +import static java.time.temporal.TemporalAdjusters.previousOrSame; import java.io.DataInput; import java.io.DataOutput;
--- a/src/share/classes/java/util/Formatter.java Tue Jul 09 21:35:04 2013 +0100 +++ b/src/share/classes/java/util/Formatter.java Tue Oct 15 13:14:03 2013 -0400 @@ -56,7 +56,7 @@ import java.time.ZoneOffset; import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; -import java.time.temporal.TemporalQuery; +import java.time.temporal.TemporalQueries; import sun.misc.DoubleConsts; import sun.misc.FormattedFloatingDecimal; @@ -4153,7 +4153,7 @@ break; } case DateTime.ZONE: { // 'Z' (symbol) - ZoneId zid = t.query(TemporalQuery.zone()); + ZoneId zid = t.query(TemporalQueries.zone()); if (zid == null) { throw new IllegalFormatConversionException(c, t.getClass()); }
--- a/test/java/time/tck/java/time/TCKDayOfWeek.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/TCKDayOfWeek.java Tue Oct 15 13:14:03 2013 -0400 @@ -77,6 +77,7 @@ import java.time.temporal.Temporal; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.util.ArrayList; import java.util.Arrays; @@ -215,13 +216,13 @@ @DataProvider(name="query") Object[][] data_query() { return new Object[][] { - {DayOfWeek.FRIDAY, TemporalQuery.chronology(), null}, - {DayOfWeek.FRIDAY, TemporalQuery.zoneId(), null}, - {DayOfWeek.FRIDAY, TemporalQuery.precision(), ChronoUnit.DAYS}, - {DayOfWeek.FRIDAY, TemporalQuery.zone(), null}, - {DayOfWeek.FRIDAY, TemporalQuery.offset(), null}, - {DayOfWeek.FRIDAY, TemporalQuery.localDate(), null}, - {DayOfWeek.FRIDAY, TemporalQuery.localTime(), null}, + {DayOfWeek.FRIDAY, TemporalQueries.chronology(), null}, + {DayOfWeek.FRIDAY, TemporalQueries.zoneId(), null}, + {DayOfWeek.FRIDAY, TemporalQueries.precision(), ChronoUnit.DAYS}, + {DayOfWeek.FRIDAY, TemporalQueries.zone(), null}, + {DayOfWeek.FRIDAY, TemporalQueries.offset(), null}, + {DayOfWeek.FRIDAY, TemporalQueries.localDate(), null}, + {DayOfWeek.FRIDAY, TemporalQueries.localTime(), null}, }; }
--- a/test/java/time/tck/java/time/TCKInstant.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/TCKInstant.java Tue Oct 15 13:14:03 2013 -0400 @@ -97,6 +97,7 @@ import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; @@ -401,13 +402,13 @@ @DataProvider(name="query") Object[][] data_query() { return new Object[][] { - {TEST_12345_123456789, TemporalQuery.chronology(), null}, - {TEST_12345_123456789, TemporalQuery.zoneId(), null}, - {TEST_12345_123456789, TemporalQuery.precision(), NANOS}, - {TEST_12345_123456789, TemporalQuery.zone(), null}, - {TEST_12345_123456789, TemporalQuery.offset(), null}, - {TEST_12345_123456789, TemporalQuery.localDate(), null}, - {TEST_12345_123456789, TemporalQuery.localTime(), null}, + {TEST_12345_123456789, TemporalQueries.chronology(), null}, + {TEST_12345_123456789, TemporalQueries.zoneId(), null}, + {TEST_12345_123456789, TemporalQueries.precision(), NANOS}, + {TEST_12345_123456789, TemporalQueries.zone(), null}, + {TEST_12345_123456789, TemporalQueries.offset(), null}, + {TEST_12345_123456789, TemporalQueries.localDate(), null}, + {TEST_12345_123456789, TemporalQueries.localTime(), null}, }; }
--- a/test/java/time/tck/java/time/TCKLocalDate.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/TCKLocalDate.java Tue Oct 15 13:14:03 2013 -0400 @@ -113,6 +113,7 @@ import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; @@ -693,13 +694,13 @@ @DataProvider(name="query") Object[][] data_query() { return new Object[][] { - {TEST_2007_07_15, TemporalQuery.chronology(), IsoChronology.INSTANCE}, - {TEST_2007_07_15, TemporalQuery.zoneId(), null}, - {TEST_2007_07_15, TemporalQuery.precision(), ChronoUnit.DAYS}, - {TEST_2007_07_15, TemporalQuery.zone(), null}, - {TEST_2007_07_15, TemporalQuery.offset(), null}, - {TEST_2007_07_15, TemporalQuery.localDate(), TEST_2007_07_15}, - {TEST_2007_07_15, TemporalQuery.localTime(), null}, + {TEST_2007_07_15, TemporalQueries.chronology(), IsoChronology.INSTANCE}, + {TEST_2007_07_15, TemporalQueries.zoneId(), null}, + {TEST_2007_07_15, TemporalQueries.precision(), ChronoUnit.DAYS}, + {TEST_2007_07_15, TemporalQueries.zone(), null}, + {TEST_2007_07_15, TemporalQueries.offset(), null}, + {TEST_2007_07_15, TemporalQueries.localDate(), TEST_2007_07_15}, + {TEST_2007_07_15, TemporalQueries.localTime(), null}, }; }
--- a/test/java/time/tck/java/time/TCKLocalDateTime.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/TCKLocalDateTime.java Tue Oct 15 13:14:03 2013 -0400 @@ -134,6 +134,7 @@ import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.util.ArrayList; @@ -1017,13 +1018,13 @@ @DataProvider(name="query") Object[][] data_query() { return new Object[][] { - {TEST_2007_07_15_12_30_40_987654321, TemporalQuery.chronology(), IsoChronology.INSTANCE}, - {TEST_2007_07_15_12_30_40_987654321, TemporalQuery.zoneId(), null}, - {TEST_2007_07_15_12_30_40_987654321, TemporalQuery.precision(), ChronoUnit.NANOS}, - {TEST_2007_07_15_12_30_40_987654321, TemporalQuery.zone(), null}, - {TEST_2007_07_15_12_30_40_987654321, TemporalQuery.offset(), null}, - {TEST_2007_07_15_12_30_40_987654321, TemporalQuery.localDate(), LocalDate.of(2007, 7, 15)}, - {TEST_2007_07_15_12_30_40_987654321, TemporalQuery.localTime(), LocalTime.of(12, 30, 40, 987654321)}, + {TEST_2007_07_15_12_30_40_987654321, TemporalQueries.chronology(), IsoChronology.INSTANCE}, + {TEST_2007_07_15_12_30_40_987654321, TemporalQueries.zoneId(), null}, + {TEST_2007_07_15_12_30_40_987654321, TemporalQueries.precision(), ChronoUnit.NANOS}, + {TEST_2007_07_15_12_30_40_987654321, TemporalQueries.zone(), null}, + {TEST_2007_07_15_12_30_40_987654321, TemporalQueries.offset(), null}, + {TEST_2007_07_15_12_30_40_987654321, TemporalQueries.localDate(), LocalDate.of(2007, 7, 15)}, + {TEST_2007_07_15_12_30_40_987654321, TemporalQueries.localTime(), LocalTime.of(12, 30, 40, 987654321)}, }; }
--- a/test/java/time/tck/java/time/TCKLocalTime.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/TCKLocalTime.java Tue Oct 15 13:14:03 2013 -0400 @@ -116,6 +116,7 @@ import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; @@ -143,7 +144,7 @@ private static final TemporalUnit[] INVALID_UNITS; static { EnumSet<ChronoUnit> set = EnumSet.range(DAYS, FOREVER); - INVALID_UNITS = (TemporalUnit[]) set.toArray(new TemporalUnit[set.size()]); + INVALID_UNITS = set.toArray(new TemporalUnit[set.size()]); } @BeforeMethod @@ -654,13 +655,13 @@ @DataProvider(name="query") Object[][] data_query() { return new Object[][] { - {TEST_12_30_40_987654321, TemporalQuery.chronology(), null}, - {TEST_12_30_40_987654321, TemporalQuery.zoneId(), null}, - {TEST_12_30_40_987654321, TemporalQuery.precision(), ChronoUnit.NANOS}, - {TEST_12_30_40_987654321, TemporalQuery.zone(), null}, - {TEST_12_30_40_987654321, TemporalQuery.offset(), null}, - {TEST_12_30_40_987654321, TemporalQuery.localDate(), null}, - {TEST_12_30_40_987654321, TemporalQuery.localTime(), TEST_12_30_40_987654321}, + {TEST_12_30_40_987654321, TemporalQueries.chronology(), null}, + {TEST_12_30_40_987654321, TemporalQueries.zoneId(), null}, + {TEST_12_30_40_987654321, TemporalQueries.precision(), ChronoUnit.NANOS}, + {TEST_12_30_40_987654321, TemporalQueries.zone(), null}, + {TEST_12_30_40_987654321, TemporalQueries.offset(), null}, + {TEST_12_30_40_987654321, TemporalQueries.localDate(), null}, + {TEST_12_30_40_987654321, TemporalQueries.localTime(), TEST_12_30_40_987654321}, }; }
--- a/test/java/time/tck/java/time/TCKMonth.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/TCKMonth.java Tue Oct 15 13:14:03 2013 -0400 @@ -73,6 +73,7 @@ import java.time.temporal.JulianFields; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.util.ArrayList; import java.util.Arrays; @@ -207,13 +208,13 @@ @DataProvider(name="query") Object[][] data_query() { return new Object[][] { - {Month.JUNE, TemporalQuery.chronology(), IsoChronology.INSTANCE}, - {Month.JUNE, TemporalQuery.zoneId(), null}, - {Month.JUNE, TemporalQuery.precision(), ChronoUnit.MONTHS}, - {Month.JUNE, TemporalQuery.zone(), null}, - {Month.JUNE, TemporalQuery.offset(), null}, - {Month.JUNE, TemporalQuery.localDate(), null}, - {Month.JUNE, TemporalQuery.localTime(), null}, + {Month.JUNE, TemporalQueries.chronology(), IsoChronology.INSTANCE}, + {Month.JUNE, TemporalQueries.zoneId(), null}, + {Month.JUNE, TemporalQueries.precision(), ChronoUnit.MONTHS}, + {Month.JUNE, TemporalQueries.zone(), null}, + {Month.JUNE, TemporalQueries.offset(), null}, + {Month.JUNE, TemporalQueries.localDate(), null}, + {Month.JUNE, TemporalQueries.localTime(), null}, }; }
--- a/test/java/time/tck/java/time/TCKMonthDay.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/TCKMonthDay.java Tue Oct 15 13:14:03 2013 -0400 @@ -86,6 +86,7 @@ import java.time.temporal.JulianFields; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.util.ArrayList; import java.util.Arrays; @@ -428,13 +429,13 @@ @DataProvider(name="query") Object[][] data_query() { return new Object[][] { - {TEST_07_15, TemporalQuery.chronology(), IsoChronology.INSTANCE}, - {TEST_07_15, TemporalQuery.zoneId(), null}, - {TEST_07_15, TemporalQuery.precision(), null}, - {TEST_07_15, TemporalQuery.zone(), null}, - {TEST_07_15, TemporalQuery.offset(), null}, - {TEST_07_15, TemporalQuery.localDate(), null}, - {TEST_07_15, TemporalQuery.localTime(), null}, + {TEST_07_15, TemporalQueries.chronology(), IsoChronology.INSTANCE}, + {TEST_07_15, TemporalQueries.zoneId(), null}, + {TEST_07_15, TemporalQueries.precision(), null}, + {TEST_07_15, TemporalQueries.zone(), null}, + {TEST_07_15, TemporalQueries.offset(), null}, + {TEST_07_15, TemporalQueries.localDate(), null}, + {TEST_07_15, TemporalQueries.localTime(), null}, }; }
--- a/test/java/time/tck/java/time/TCKOffsetDateTime.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/TCKOffsetDateTime.java Tue Oct 15 13:14:03 2013 -0400 @@ -132,6 +132,7 @@ import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.util.ArrayList; @@ -635,13 +636,13 @@ @DataProvider(name="query") Object[][] data_query() { return new Object[][] { - {TEST_2008_6_30_11_30_59_000000500, TemporalQuery.chronology(), IsoChronology.INSTANCE}, - {TEST_2008_6_30_11_30_59_000000500, TemporalQuery.zoneId(), null}, - {TEST_2008_6_30_11_30_59_000000500, TemporalQuery.precision(), ChronoUnit.NANOS}, - {TEST_2008_6_30_11_30_59_000000500, TemporalQuery.zone(), OFFSET_PONE}, - {TEST_2008_6_30_11_30_59_000000500, TemporalQuery.offset(), OFFSET_PONE}, - {TEST_2008_6_30_11_30_59_000000500, TemporalQuery.localDate(), LocalDate.of(2008, 6, 30)}, - {TEST_2008_6_30_11_30_59_000000500, TemporalQuery.localTime(), LocalTime.of(11, 30, 59, 500)}, + {TEST_2008_6_30_11_30_59_000000500, TemporalQueries.chronology(), IsoChronology.INSTANCE}, + {TEST_2008_6_30_11_30_59_000000500, TemporalQueries.zoneId(), null}, + {TEST_2008_6_30_11_30_59_000000500, TemporalQueries.precision(), ChronoUnit.NANOS}, + {TEST_2008_6_30_11_30_59_000000500, TemporalQueries.zone(), OFFSET_PONE}, + {TEST_2008_6_30_11_30_59_000000500, TemporalQueries.offset(), OFFSET_PONE}, + {TEST_2008_6_30_11_30_59_000000500, TemporalQueries.localDate(), LocalDate.of(2008, 6, 30)}, + {TEST_2008_6_30_11_30_59_000000500, TemporalQueries.localTime(), LocalTime.of(11, 30, 59, 500)}, }; }
--- a/test/java/time/tck/java/time/TCKOffsetTime.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/TCKOffsetTime.java Tue Oct 15 13:14:03 2013 -0400 @@ -115,6 +115,7 @@ import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.util.ArrayList; @@ -605,13 +606,13 @@ @DataProvider(name="query") Object[][] data_query() { return new Object[][] { - {TEST_11_30_59_500_PONE, TemporalQuery.chronology(), null}, - {TEST_11_30_59_500_PONE, TemporalQuery.zoneId(), null}, - {TEST_11_30_59_500_PONE, TemporalQuery.precision(), ChronoUnit.NANOS}, - {TEST_11_30_59_500_PONE, TemporalQuery.zone(), OFFSET_PONE}, - {TEST_11_30_59_500_PONE, TemporalQuery.offset(), OFFSET_PONE}, - {TEST_11_30_59_500_PONE, TemporalQuery.localDate(), null}, - {TEST_11_30_59_500_PONE, TemporalQuery.localTime(), LocalTime.of(11, 30, 59, 500)}, + {TEST_11_30_59_500_PONE, TemporalQueries.chronology(), null}, + {TEST_11_30_59_500_PONE, TemporalQueries.zoneId(), null}, + {TEST_11_30_59_500_PONE, TemporalQueries.precision(), ChronoUnit.NANOS}, + {TEST_11_30_59_500_PONE, TemporalQueries.zone(), OFFSET_PONE}, + {TEST_11_30_59_500_PONE, TemporalQueries.offset(), OFFSET_PONE}, + {TEST_11_30_59_500_PONE, TemporalQueries.localDate(), null}, + {TEST_11_30_59_500_PONE, TemporalQueries.localTime(), LocalTime.of(11, 30, 59, 500)}, }; }
--- a/test/java/time/tck/java/time/TCKYear.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/TCKYear.java Tue Oct 15 13:14:03 2013 -0400 @@ -99,6 +99,7 @@ import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; @@ -411,13 +412,13 @@ @DataProvider(name="query") Object[][] data_query() { return new Object[][] { - {TEST_2008, TemporalQuery.chronology(), IsoChronology.INSTANCE}, - {TEST_2008, TemporalQuery.zoneId(), null}, - {TEST_2008, TemporalQuery.precision(), ChronoUnit.YEARS}, - {TEST_2008, TemporalQuery.zone(), null}, - {TEST_2008, TemporalQuery.offset(), null}, - {TEST_2008, TemporalQuery.localDate(), null}, - {TEST_2008, TemporalQuery.localTime(), null}, + {TEST_2008, TemporalQueries.chronology(), IsoChronology.INSTANCE}, + {TEST_2008, TemporalQueries.zoneId(), null}, + {TEST_2008, TemporalQueries.precision(), ChronoUnit.YEARS}, + {TEST_2008, TemporalQueries.zone(), null}, + {TEST_2008, TemporalQueries.offset(), null}, + {TEST_2008, TemporalQueries.localDate(), null}, + {TEST_2008, TemporalQueries.localTime(), null}, }; } @@ -596,7 +597,7 @@ } @Test(dataProvider="plus_long_TemporalUnit") - public void test_plus_long_TemporalUnit(Year base, long amount, TemporalUnit unit, Year expectedYear, Class expectedEx) { + public void test_plus_long_TemporalUnit(Year base, long amount, TemporalUnit unit, Year expectedYear, Class<?> expectedEx) { if (expectedEx == null) { assertEquals(base.plus(amount, unit), expectedYear); } else { @@ -728,7 +729,7 @@ } @Test(dataProvider="minus_long_TemporalUnit") - public void test_minus_long_TemporalUnit(Year base, long amount, TemporalUnit unit, Year expectedYear, Class expectedEx) { + public void test_minus_long_TemporalUnit(Year base, long amount, TemporalUnit unit, Year expectedYear, Class<?> expectedEx) { if (expectedEx == null) { assertEquals(base.minus(amount, unit), expectedYear); } else {
--- a/test/java/time/tck/java/time/TCKYearMonth.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/TCKYearMonth.java Tue Oct 15 13:14:03 2013 -0400 @@ -100,6 +100,7 @@ import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.time.temporal.UnsupportedTemporalTypeException; @@ -476,13 +477,13 @@ @DataProvider(name="query") Object[][] data_query() { return new Object[][] { - {TEST_2008_06, TemporalQuery.chronology(), IsoChronology.INSTANCE}, - {TEST_2008_06, TemporalQuery.zoneId(), null}, - {TEST_2008_06, TemporalQuery.precision(), ChronoUnit.MONTHS}, - {TEST_2008_06, TemporalQuery.zone(), null}, - {TEST_2008_06, TemporalQuery.offset(), null}, - {TEST_2008_06, TemporalQuery.localDate(), null}, - {TEST_2008_06, TemporalQuery.localTime(), null}, + {TEST_2008_06, TemporalQueries.chronology(), IsoChronology.INSTANCE}, + {TEST_2008_06, TemporalQueries.zoneId(), null}, + {TEST_2008_06, TemporalQueries.precision(), ChronoUnit.MONTHS}, + {TEST_2008_06, TemporalQueries.zone(), null}, + {TEST_2008_06, TemporalQueries.offset(), null}, + {TEST_2008_06, TemporalQueries.localDate(), null}, + {TEST_2008_06, TemporalQueries.localTime(), null}, }; } @@ -768,7 +769,7 @@ } @Test(dataProvider="plus_long_TemporalUnit") - public void test_plus_long_TemporalUnit(YearMonth base, long amount, TemporalUnit unit, YearMonth expectedYearMonth, Class expectedEx) { + public void test_plus_long_TemporalUnit(YearMonth base, long amount, TemporalUnit unit, YearMonth expectedYearMonth, Class<?> expectedEx) { if (expectedEx == null) { assertEquals(base.plus(amount, unit), expectedYearMonth); } else { @@ -820,7 +821,7 @@ } @Test(dataProvider="plus_TemporalAmount") - public void test_plus_TemporalAmount(YearMonth base, TemporalAmount temporalAmount, YearMonth expectedYearMonth, Class expectedEx) { + public void test_plus_TemporalAmount(YearMonth base, TemporalAmount temporalAmount, YearMonth expectedYearMonth, Class<?> expectedEx) { if (expectedEx == null) { assertEquals(base.plus(temporalAmount), expectedYearMonth); } else { @@ -983,7 +984,7 @@ } @Test(dataProvider="minus_long_TemporalUnit") - public void test_minus_long_TemporalUnit(YearMonth base, long amount, TemporalUnit unit, YearMonth expectedYearMonth, Class expectedEx) { + public void test_minus_long_TemporalUnit(YearMonth base, long amount, TemporalUnit unit, YearMonth expectedYearMonth, Class<?> expectedEx) { if (expectedEx == null) { assertEquals(base.minus(amount, unit), expectedYearMonth); } else { @@ -1035,7 +1036,7 @@ } @Test(dataProvider="minus_TemporalAmount") - public void test_minus_TemporalAmount(YearMonth base, TemporalAmount temporalAmount, YearMonth expectedYearMonth, Class expectedEx) { + public void test_minus_TemporalAmount(YearMonth base, TemporalAmount temporalAmount, YearMonth expectedYearMonth, Class<?> expectedEx) { if (expectedEx == null) { assertEquals(base.minus(temporalAmount), expectedYearMonth); } else {
--- a/test/java/time/tck/java/time/TCKZoneId.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/TCKZoneId.java Tue Oct 15 13:14:03 2013 -0400 @@ -76,6 +76,7 @@ import java.time.format.TextStyle; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.zone.ZoneRulesException; import java.util.HashMap; @@ -559,7 +560,7 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.zoneId()) { + if (query == TemporalQueries.zoneId()) { return (R) ZoneId.of("Europe/Paris"); } return TemporalAccessor.super.query(query);
--- a/test/java/time/tck/java/time/TCKZoneOffset.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/TCKZoneOffset.java Tue Oct 15 13:14:03 2013 -0400 @@ -81,6 +81,7 @@ import java.time.temporal.JulianFields; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.util.ArrayList; import java.util.Arrays; @@ -523,13 +524,13 @@ @DataProvider(name="query") Object[][] data_query() { return new Object[][] { - {ZoneOffset.UTC, TemporalQuery.chronology(), null}, - {ZoneOffset.UTC, TemporalQuery.zoneId(), null}, - {ZoneOffset.UTC, TemporalQuery.precision(), null}, - {ZoneOffset.UTC, TemporalQuery.zone(), ZoneOffset.UTC}, - {ZoneOffset.UTC, TemporalQuery.offset(), ZoneOffset.UTC}, - {ZoneOffset.UTC, TemporalQuery.localDate(), null}, - {ZoneOffset.UTC, TemporalQuery.localTime(), null}, + {ZoneOffset.UTC, TemporalQueries.chronology(), null}, + {ZoneOffset.UTC, TemporalQueries.zoneId(), null}, + {ZoneOffset.UTC, TemporalQueries.precision(), null}, + {ZoneOffset.UTC, TemporalQueries.zone(), ZoneOffset.UTC}, + {ZoneOffset.UTC, TemporalQueries.offset(), ZoneOffset.UTC}, + {ZoneOffset.UTC, TemporalQueries.localDate(), null}, + {ZoneOffset.UTC, TemporalQueries.localTime(), null}, }; }
--- a/test/java/time/tck/java/time/TCKZonedDateTime.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/TCKZonedDateTime.java Tue Oct 15 13:14:03 2013 -0400 @@ -126,6 +126,7 @@ import java.time.temporal.TemporalAdjuster; import java.time.temporal.TemporalAmount; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.time.temporal.TemporalUnit; import java.util.ArrayList; @@ -685,7 +686,7 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.zoneId()) { + if (query == TemporalQueries.zoneId()) { return (R) TEST_DATE_TIME_PARIS.getZone(); } return TemporalAccessor.super.query(query); @@ -709,7 +710,7 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.zoneId()) { + if (query == TemporalQueries.zoneId()) { return (R) TEST_DATE_TIME_PARIS.getZone(); } return TemporalAccessor.super.query(query); @@ -964,32 +965,32 @@ //----------------------------------------------------------------------- @Test public void test_query_chrono() { - assertEquals(TEST_DATE_TIME.query(TemporalQuery.chronology()), IsoChronology.INSTANCE); - assertEquals(TemporalQuery.chronology().queryFrom(TEST_DATE_TIME), IsoChronology.INSTANCE); + assertEquals(TEST_DATE_TIME.query(TemporalQueries.chronology()), IsoChronology.INSTANCE); + assertEquals(TemporalQueries.chronology().queryFrom(TEST_DATE_TIME), IsoChronology.INSTANCE); } @Test public void test_query_zoneId() { - assertEquals(TEST_DATE_TIME.query(TemporalQuery.zoneId()), TEST_DATE_TIME.getZone()); - assertEquals(TemporalQuery.zoneId().queryFrom(TEST_DATE_TIME), TEST_DATE_TIME.getZone()); + assertEquals(TEST_DATE_TIME.query(TemporalQueries.zoneId()), TEST_DATE_TIME.getZone()); + assertEquals(TemporalQueries.zoneId().queryFrom(TEST_DATE_TIME), TEST_DATE_TIME.getZone()); } @Test public void test_query_precision() { - assertEquals(TEST_DATE_TIME.query(TemporalQuery.precision()), NANOS); - assertEquals(TemporalQuery.precision().queryFrom(TEST_DATE_TIME), NANOS); + assertEquals(TEST_DATE_TIME.query(TemporalQueries.precision()), NANOS); + assertEquals(TemporalQueries.precision().queryFrom(TEST_DATE_TIME), NANOS); } @Test public void test_query_offset() { - assertEquals(TEST_DATE_TIME.query(TemporalQuery.offset()), TEST_DATE_TIME.getOffset()); - assertEquals(TemporalQuery.offset().queryFrom(TEST_DATE_TIME), TEST_DATE_TIME.getOffset()); + assertEquals(TEST_DATE_TIME.query(TemporalQueries.offset()), TEST_DATE_TIME.getOffset()); + assertEquals(TemporalQueries.offset().queryFrom(TEST_DATE_TIME), TEST_DATE_TIME.getOffset()); } @Test public void test_query_zone() { - assertEquals(TEST_DATE_TIME.query(TemporalQuery.zone()), TEST_DATE_TIME.getZone()); - assertEquals(TemporalQuery.zone().queryFrom(TEST_DATE_TIME), TEST_DATE_TIME.getZone()); + assertEquals(TEST_DATE_TIME.query(TemporalQueries.zone()), TEST_DATE_TIME.getZone()); + assertEquals(TemporalQueries.zone().queryFrom(TEST_DATE_TIME), TEST_DATE_TIME.getZone()); } @Test(expectedExceptions=NullPointerException.class)
--- a/test/java/time/tck/java/time/TestIsoChronology.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/TestIsoChronology.java Tue Oct 15 13:14:03 2013 -0400 @@ -80,7 +80,7 @@ import java.time.chrono.IsoChronology; import java.time.chrono.IsoEra; import java.time.temporal.ChronoField; -import java.time.temporal.TemporalAdjuster; +import java.time.temporal.TemporalAdjusters; import org.testng.Assert; import org.testng.annotations.DataProvider; @@ -208,14 +208,14 @@ @Test public void test_adjust1() { LocalDate base = IsoChronology.INSTANCE.date(1728, 10, 28); - LocalDate test = base.with(TemporalAdjuster.lastDayOfMonth()); + LocalDate test = base.with(TemporalAdjusters.lastDayOfMonth()); assertEquals(test, IsoChronology.INSTANCE.date(1728, 10, 31)); } @Test public void test_adjust2() { LocalDate base = IsoChronology.INSTANCE.date(1728, 12, 2); - LocalDate test = base.with(TemporalAdjuster.lastDayOfMonth()); + LocalDate test = base.with(TemporalAdjusters.lastDayOfMonth()); assertEquals(test, IsoChronology.INSTANCE.date(1728, 12, 31)); }
--- a/test/java/time/tck/java/time/chrono/CopticDate.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/chrono/CopticDate.java Tue Oct 15 13:14:03 2013 -0400 @@ -308,7 +308,7 @@ @Override public Period until(ChronoLocalDate endDate) { // TODO: untested - CopticDate end = (CopticDate) getChronology().date(endDate); + CopticDate end = getChronology().date(endDate); long totalMonths = (end.prolepticYear - this.prolepticYear) * 13 + (end.month - this.month); // safe int days = end.day - this.day; if (totalMonths > 0 && days < 0) {
--- a/test/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java Tue Oct 15 13:14:03 2013 -0400 @@ -346,7 +346,7 @@ //----------------------------------------------------------------------- @Test(dataProvider="calendars") public void test_getChronology(Chronology chrono) { - ChronoLocalDateTime test = chrono.localDateTime(LocalDateTime.of(2010, 6, 30, 11, 30)); + ChronoLocalDateTime<?> test = chrono.localDateTime(LocalDateTime.of(2010, 6, 30, 11, 30)); assertEquals(test.getChronology(), chrono); }
--- a/test/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java Tue Oct 15 13:14:03 2013 -0400 @@ -347,7 +347,7 @@ //----------------------------------------------------------------------- @Test(dataProvider="calendars") public void test_getChronology(Chronology chrono) { - ChronoZonedDateTime test = chrono.zonedDateTime(ZonedDateTime.of(2010, 6, 30, 11, 30, 0, 0, ZoneOffset.UTC)); + ChronoZonedDateTime<?> test = chrono.zonedDateTime(ZonedDateTime.of(2010, 6, 30, 11, 30, 0, 0, ZoneOffset.UTC)); assertEquals(test.getChronology(), chrono); }
--- a/test/java/time/tck/java/time/chrono/TCKIsoChronology.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/chrono/TCKIsoChronology.java Tue Oct 15 13:14:03 2013 -0400 @@ -70,7 +70,9 @@ import java.time.format.ResolverStyle; import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalAdjusters; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.util.HashMap; import java.util.Map; @@ -107,7 +109,7 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.chronology()) { + if (query == TemporalQueries.chronology()) { return (R) IsoChronology.INSTANCE; } throw new UnsupportedOperationException(); @@ -130,7 +132,7 @@ @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.chronology()) { + if (query == TemporalQueries.chronology()) { return null; } throw new UnsupportedOperationException(); @@ -166,7 +168,7 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.localDate()) { + if (query == TemporalQueries.localDate()) { return (R) LocalDate.of(2012, 6, 30); } throw new UnsupportedOperationException(); @@ -205,10 +207,10 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.localDate()) { + if (query == TemporalQueries.localDate()) { return (R) LocalDate.of(2012, 6, 30); } - if (query == TemporalQuery.localTime()) { + if (query == TemporalQueries.localTime()) { return (R) LocalTime.of(12, 30, 40); } throw new UnsupportedOperationException(); @@ -254,13 +256,13 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.localDate()) { + if (query == TemporalQueries.localDate()) { return (R) LocalDate.of(2012, 6, 30); } - if (query == TemporalQuery.localTime()) { + if (query == TemporalQueries.localTime()) { return (R) LocalTime.of(12, 30, 40); } - if (query == TemporalQuery.zoneId() || query == TemporalQuery.zone()) { + if (query == TemporalQueries.zoneId() || query == TemporalQueries.zone()) { return (R) ZoneId.of("Europe/London"); } throw new UnsupportedOperationException();
--- a/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/chrono/TCKJapaneseChronology.java Tue Oct 15 13:14:03 2013 -0400 @@ -92,10 +92,9 @@ import java.time.format.ResolverStyle; import java.time.temporal.ChronoField; import java.time.temporal.ChronoUnit; -import java.time.temporal.Temporal; -import java.time.temporal.TemporalAdjuster; +import java.time.temporal.TemporalAdjusters; import java.time.temporal.TemporalField; -import java.time.temporal.TemporalQuery; +import java.time.temporal.TemporalQueries; import java.time.temporal.ValueRange; import java.util.HashMap; @@ -229,7 +228,7 @@ @Test(dataProvider="createByEra") public void test_createByEra_query(JapaneseEra era, int yoe, int moy, int dom, int doy, LocalDate iso) { JapaneseDate test = JapaneseDate.of(era, yoe, moy, dom); - assertEquals(test.query(TemporalQuery.localDate()), iso); + assertEquals(test.query(TemporalQueries.localDate()), iso); } @Test(dataProvider="createByEra") @@ -297,7 +296,7 @@ @Test(dataProvider="createByProleptic") public void test_createByProleptic_query(int y, int moy, int dom, int doy, LocalDate iso) { JapaneseDate test = JapaneseDate.of(y, moy, dom); - assertEquals(test.query(TemporalQuery.localDate()), iso); + assertEquals(test.query(TemporalQueries.localDate()), iso); } @Test(dataProvider="createByProleptic") @@ -495,14 +494,14 @@ @Test public void test_adjust1() { JapaneseDate base = JapaneseChronology.INSTANCE.date(1928, 10, 29); - JapaneseDate test = base.with(TemporalAdjuster.lastDayOfMonth()); + JapaneseDate test = base.with(TemporalAdjusters.lastDayOfMonth()); assertEquals(test, JapaneseChronology.INSTANCE.date(1928, 10, 31)); } @Test public void test_adjust2() { JapaneseDate base = JapaneseChronology.INSTANCE.date(1928, 12, 2); - JapaneseDate test = base.with(TemporalAdjuster.lastDayOfMonth()); + JapaneseDate test = base.with(TemporalAdjusters.lastDayOfMonth()); assertEquals(test, JapaneseChronology.INSTANCE.date(1928, 12, 31)); }
--- a/test/java/time/tck/java/time/chrono/TCKMinguoChronology.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/chrono/TCKMinguoChronology.java Tue Oct 15 13:14:03 2013 -0400 @@ -82,15 +82,15 @@ import java.time.chrono.IsoChronology; import java.time.chrono.JapaneseDate; import java.time.chrono.MinguoChronology; +import java.time.chrono.MinguoEra; import java.time.chrono.MinguoDate; -import java.time.chrono.MinguoEra; import java.time.chrono.ThaiBuddhistChronology; import java.time.chrono.ThaiBuddhistDate; import java.time.format.ResolverStyle; import java.time.temporal.ChronoField; import java.time.temporal.ChronoUnit; import java.time.temporal.TemporalAccessor; -import java.time.temporal.TemporalAdjuster; +import java.time.temporal.TemporalAdjusters; import java.time.temporal.TemporalField; import java.util.HashMap; import java.util.List; @@ -360,14 +360,14 @@ @Test public void test_adjust1() { MinguoDate base = MinguoChronology.INSTANCE.date(2012, 10, 29); - MinguoDate test = base.with(TemporalAdjuster.lastDayOfMonth()); + MinguoDate test = base.with(TemporalAdjusters.lastDayOfMonth()); assertEquals(test, MinguoChronology.INSTANCE.date(2012, 10, 31)); } @Test public void test_adjust2() { MinguoDate base = MinguoChronology.INSTANCE.date(1728, 12, 2); - MinguoDate test = base.with(TemporalAdjuster.lastDayOfMonth()); + MinguoDate test = base.with(TemporalAdjusters.lastDayOfMonth()); assertEquals(test, MinguoChronology.INSTANCE.date(1728, 12, 31)); }
--- a/test/java/time/tck/java/time/chrono/TCKThaiBuddhistChronology.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/chrono/TCKThaiBuddhistChronology.java Tue Oct 15 13:14:03 2013 -0400 @@ -88,7 +88,7 @@ import java.time.format.ResolverStyle; import java.time.temporal.ChronoField; import java.time.temporal.ChronoUnit; -import java.time.temporal.TemporalAdjuster; +import java.time.temporal.TemporalAdjusters; import java.time.temporal.TemporalField; import java.time.temporal.ValueRange; import java.util.HashMap; @@ -366,14 +366,14 @@ @Test public void test_adjust1() { ThaiBuddhistDate base = ThaiBuddhistChronology.INSTANCE.date(1728, 10, 29); - ThaiBuddhistDate test = base.with(TemporalAdjuster.lastDayOfMonth()); + ThaiBuddhistDate test = base.with(TemporalAdjusters.lastDayOfMonth()); assertEquals(test, ThaiBuddhistChronology.INSTANCE.date(1728, 10, 31)); } @Test public void test_adjust2() { ThaiBuddhistDate base = ThaiBuddhistChronology.INSTANCE.date(1728, 12, 2); - ThaiBuddhistDate test = base.with(TemporalAdjuster.lastDayOfMonth()); + ThaiBuddhistDate test = base.with(TemporalAdjusters.lastDayOfMonth()); assertEquals(test, ThaiBuddhistChronology.INSTANCE.date(1728, 12, 31)); }
--- a/test/java/time/tck/java/time/format/TCKChronoPrinterParser.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/format/TCKChronoPrinterParser.java Tue Oct 15 13:14:03 2013 -0400 @@ -68,6 +68,7 @@ import java.time.chrono.ThaiBuddhistChronology; import java.time.format.DateTimeFormatterBuilder; import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.util.Locale; @@ -122,7 +123,7 @@ TemporalAccessor parsed = builder.toFormatter().parseUnresolved(text, pos); assertEquals(pos.getIndex(), expected.getId().length()); assertEquals(pos.getErrorIndex(), -1); - assertEquals(parsed.query(TemporalQuery.chronology()), expected); + assertEquals(parsed.query(TemporalQueries.chronology()), expected); } @Test(dataProvider="parseValid") @@ -140,7 +141,7 @@ TemporalAccessor parsed = builder.toFormatter().parseUnresolved(text.toLowerCase(Locale.ENGLISH), pos); assertEquals(pos.getIndex(), expected.getId().length()); assertEquals(pos.getErrorIndex(), -1); - assertEquals(parsed.query(TemporalQuery.chronology()), expected); + assertEquals(parsed.query(TemporalQueries.chronology()), expected); } //-----------------------------------------------------------------------
--- a/test/java/time/tck/java/time/format/TCKDateTimeFormatters.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/format/TCKDateTimeFormatters.java Tue Oct 15 13:14:03 2013 -0400 @@ -94,6 +94,7 @@ import java.time.temporal.IsoFields; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalField; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalQuery; import java.util.HashMap; import java.util.Iterator; @@ -1405,8 +1406,8 @@ assertEquals(parsed.isSupported(field), true); parsed.getLong(field); } - assertEquals(parsed.query(TemporalQuery.chronology()), expected.chrono); - assertEquals(parsed.query(TemporalQuery.zoneId()), expected.zone); + assertEquals(parsed.query(TemporalQueries.chronology()), expected.chrono); + assertEquals(parsed.query(TemporalQueries.zoneId()), expected.zone); } //------------------------------------------------------------------------- @@ -1471,7 +1472,7 @@ @SuppressWarnings("unchecked") @Override public <R> R query(TemporalQuery<R> query) { - if (query == TemporalQuery.zoneId()) { + if (query == TemporalQueries.zoneId()) { return (R) zoneId; } return TemporalAccessor.super.query(query);
--- a/test/java/time/tck/java/time/format/TCKDateTimeParseResolver.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/format/TCKDateTimeParseResolver.java Tue Oct 15 13:14:03 2013 -0400 @@ -113,7 +113,7 @@ import java.time.temporal.Temporal; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalField; -import java.time.temporal.TemporalQuery; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalUnit; import java.time.temporal.ValueRange; import java.util.Map; @@ -147,8 +147,8 @@ DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field1).toFormatter(); TemporalAccessor accessor = f.parse(str); - assertEquals(accessor.query(TemporalQuery.localDate()), null); - assertEquals(accessor.query(TemporalQuery.localTime()), null); + assertEquals(accessor.query(TemporalQueries.localDate()), null); + assertEquals(accessor.query(TemporalQueries.localTime()), null); assertEquals(accessor.isSupported(field1), true); assertEquals(accessor.getLong(field1), value1); } @@ -186,8 +186,8 @@ .appendValue(field2).toFormatter(); TemporalAccessor accessor = f.parse(str); - assertEquals(accessor.query(TemporalQuery.localDate()), null); - assertEquals(accessor.query(TemporalQuery.localTime()), null); + assertEquals(accessor.query(TemporalQueries.localDate()), null); + assertEquals(accessor.query(TemporalQueries.localTime()), null); assertEquals(accessor.isSupported(field1), true); assertEquals(accessor.isSupported(field2), true); assertEquals(accessor.getLong(field1), value1); @@ -218,8 +218,8 @@ .appendValue(field3).toFormatter(); TemporalAccessor accessor = f.parse(str); - assertEquals(accessor.query(TemporalQuery.localDate()), null); - assertEquals(accessor.query(TemporalQuery.localTime()), null); + assertEquals(accessor.query(TemporalQueries.localDate()), null); + assertEquals(accessor.query(TemporalQueries.localTime()), null); assertEquals(accessor.isSupported(field1), true); assertEquals(accessor.isSupported(field2), true); assertEquals(accessor.isSupported(field3), true); @@ -252,8 +252,8 @@ DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field1).toFormatter(); TemporalAccessor accessor = f.parse(str); - assertEquals(accessor.query(TemporalQuery.localDate()), null); - assertEquals(accessor.query(TemporalQuery.localTime()), null); + assertEquals(accessor.query(TemporalQueries.localDate()), null); + assertEquals(accessor.query(TemporalQueries.localTime()), null); if (expectedField1 != null) { assertEquals(accessor.isSupported(expectedField1), true); assertEquals(accessor.getLong(expectedField1), expectedValue1.longValue()); @@ -278,8 +278,8 @@ DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field1).toFormatter(); TemporalAccessor accessor = f.parse(str); - assertEquals(accessor.query(TemporalQuery.localDate()), expectedDate); - assertEquals(accessor.query(TemporalQuery.localTime()), null); + assertEquals(accessor.query(TemporalQueries.localDate()), expectedDate); + assertEquals(accessor.query(TemporalQueries.localTime()), null); } //----------------------------------------------------------------------- @@ -303,8 +303,8 @@ DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field1).toFormatter(); TemporalAccessor accessor = f.parse(str); - assertEquals(accessor.query(TemporalQuery.localDate()), null); - assertEquals(accessor.query(TemporalQuery.localTime()), expectedTime); + assertEquals(accessor.query(TemporalQueries.localDate()), null); + assertEquals(accessor.query(TemporalQueries.localTime()), expectedTime); } //----------------------------------------------------------------------- @@ -334,8 +334,8 @@ .appendValue(field2).toFormatter(); TemporalAccessor accessor = f.parse(str); - assertEquals(accessor.query(TemporalQuery.localDate()), null); - assertEquals(accessor.query(TemporalQuery.localTime()), null); + assertEquals(accessor.query(TemporalQueries.localDate()), null); + assertEquals(accessor.query(TemporalQueries.localTime()), null); if (expectedField1 != null) { assertEquals(accessor.isSupported(expectedField1), true); assertEquals(accessor.getLong(expectedField1), expectedValue1.longValue()); @@ -382,8 +382,8 @@ .appendValue(field2).toFormatter(); TemporalAccessor accessor = f.parse(str); - assertEquals(accessor.query(TemporalQuery.localDate()), expectedDate); - assertEquals(accessor.query(TemporalQuery.localTime()), null); + assertEquals(accessor.query(TemporalQueries.localDate()), expectedDate); + assertEquals(accessor.query(TemporalQueries.localTime()), null); } //----------------------------------------------------------------------- @@ -469,8 +469,8 @@ .appendValue(field2).toFormatter(); TemporalAccessor accessor = f.parse(str); - assertEquals(accessor.query(TemporalQuery.localDate()), null); - assertEquals(accessor.query(TemporalQuery.localTime()), expectedTime); + assertEquals(accessor.query(TemporalQueries.localDate()), null); + assertEquals(accessor.query(TemporalQueries.localTime()), expectedTime); } //----------------------------------------------------------------------- @@ -502,8 +502,8 @@ .appendValue(field3).toFormatter(); TemporalAccessor accessor = f.parse(str); - assertEquals(accessor.query(TemporalQuery.localDate()), expectedDate); - assertEquals(accessor.query(TemporalQuery.localTime()), null); + assertEquals(accessor.query(TemporalQueries.localDate()), expectedDate); + assertEquals(accessor.query(TemporalQueries.localTime()), null); } //----------------------------------------------------------------------- @@ -535,8 +535,8 @@ .appendValue(field4).toFormatter(); TemporalAccessor accessor = f.parse(str); - assertEquals(accessor.query(TemporalQuery.localDate()), expectedDate); - assertEquals(accessor.query(TemporalQuery.localTime()), null); + assertEquals(accessor.query(TemporalQueries.localDate()), expectedDate); + assertEquals(accessor.query(TemporalQueries.localTime()), null); } //----------------------------------------------------------------------- @@ -603,8 +603,8 @@ for (ResolverStyle s : styles) { if (expectedTime != null) { TemporalAccessor accessor = f.withResolverStyle(s).parse(""); - assertEquals(accessor.query(TemporalQuery.localDate()), null, "ResolverStyle: " + s); - assertEquals(accessor.query(TemporalQuery.localTime()), expectedTime, "ResolverStyle: " + s); + assertEquals(accessor.query(TemporalQueries.localDate()), null, "ResolverStyle: " + s); + assertEquals(accessor.query(TemporalQueries.localTime()), expectedTime, "ResolverStyle: " + s); assertEquals(accessor.query(DateTimeFormatter.parsedExcessDays()), excessPeriod, "ResolverStyle: " + s); } else { try { @@ -629,8 +629,8 @@ for (ResolverStyle s : styles) { if (expectedTime != null) { TemporalAccessor accessor = f.withResolverStyle(s).parse(""); - assertEquals(accessor.query(TemporalQuery.localDate()), null, "ResolverStyle: " + s); - assertEquals(accessor.query(TemporalQuery.localTime()), expectedTime.minusNanos(nano), "ResolverStyle: " + s); + assertEquals(accessor.query(TemporalQueries.localDate()), null, "ResolverStyle: " + s); + assertEquals(accessor.query(TemporalQueries.localTime()), expectedTime.minusNanos(nano), "ResolverStyle: " + s); assertEquals(accessor.query(DateTimeFormatter.parsedExcessDays()), excessPeriod, "ResolverStyle: " + s); } else { try { @@ -658,8 +658,8 @@ LocalDate expectedDate = LocalDate.of(2012, 6, 30).plus(excessPeriod); for (ResolverStyle s : styles) { TemporalAccessor accessor = f.withResolverStyle(s).parse(""); - assertEquals(accessor.query(TemporalQuery.localDate()), expectedDate, "ResolverStyle: " + s); - assertEquals(accessor.query(TemporalQuery.localTime()), expectedTime, "ResolverStyle: " + s); + assertEquals(accessor.query(TemporalQueries.localDate()), expectedDate, "ResolverStyle: " + s); + assertEquals(accessor.query(TemporalQueries.localTime()), expectedTime, "ResolverStyle: " + s); assertEquals(accessor.query(DateTimeFormatter.parsedExcessDays()), Period.ZERO, "ResolverStyle: " + s); } } @@ -696,8 +696,8 @@ if (expectedSecond != null) { TemporalAccessor accessor = f.withResolverStyle(style).parse(str); - assertEquals(accessor.query(TemporalQuery.localDate()), null); - assertEquals(accessor.query(TemporalQuery.localTime()), LocalTime.ofSecondOfDay(expectedSecond)); + assertEquals(accessor.query(TemporalQueries.localDate()), null); + assertEquals(accessor.query(TemporalQueries.localTime()), LocalTime.ofSecondOfDay(expectedSecond)); assertEquals(accessor.query(DateTimeFormatter.parsedExcessDays()), Period.ofDays(expectedDays)); } else { try { @@ -740,8 +740,8 @@ if (expectedMinute != null) { TemporalAccessor accessor = f.withResolverStyle(style).parse(str); - assertEquals(accessor.query(TemporalQuery.localDate()), null); - assertEquals(accessor.query(TemporalQuery.localTime()), LocalTime.ofSecondOfDay(expectedMinute * 60)); + assertEquals(accessor.query(TemporalQueries.localDate()), null); + assertEquals(accessor.query(TemporalQueries.localTime()), LocalTime.ofSecondOfDay(expectedMinute * 60)); assertEquals(accessor.query(DateTimeFormatter.parsedExcessDays()), Period.ofDays(expectedDays)); } else { try { @@ -784,8 +784,8 @@ if (expectedHour != null) { TemporalAccessor accessor = f.withResolverStyle(style).parse(str); - assertEquals(accessor.query(TemporalQuery.localDate()), null); - assertEquals(accessor.query(TemporalQuery.localTime()), LocalTime.of(expectedHour, 0)); + assertEquals(accessor.query(TemporalQueries.localDate()), null); + assertEquals(accessor.query(TemporalQueries.localTime()), LocalTime.of(expectedHour, 0)); assertEquals(accessor.query(DateTimeFormatter.parsedExcessDays()), Period.ofDays(expectedDays)); } else { try { @@ -828,8 +828,8 @@ if (expectedValue != null) { TemporalAccessor accessor = f.withResolverStyle(style).parse(str); - assertEquals(accessor.query(TemporalQuery.localDate()), null); - assertEquals(accessor.query(TemporalQuery.localTime()), null); + assertEquals(accessor.query(TemporalQueries.localDate()), null); + assertEquals(accessor.query(TemporalQueries.localTime()), null); assertEquals(accessor.isSupported(CLOCK_HOUR_OF_AMPM), false); assertEquals(accessor.isSupported(HOUR_OF_AMPM), true); assertEquals(accessor.getLong(HOUR_OF_AMPM), expectedValue.longValue()); @@ -871,8 +871,8 @@ if (expectedValue != null) { TemporalAccessor accessor = f.withResolverStyle(style).parse(str); - assertEquals(accessor.query(TemporalQuery.localDate()), null); - assertEquals(accessor.query(TemporalQuery.localTime()), null); + assertEquals(accessor.query(TemporalQueries.localDate()), null); + assertEquals(accessor.query(TemporalQueries.localTime()), null); assertEquals(accessor.isSupported(AMPM_OF_DAY), true); assertEquals(accessor.getLong(AMPM_OF_DAY), expectedValue.longValue()); } else { @@ -933,8 +933,8 @@ }; DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter(); TemporalAccessor accessor = f.parse("1234567890"); - assertEquals(accessor.query(TemporalQuery.localDate()), null); - assertEquals(accessor.query(TemporalQuery.localTime()), LocalTime.of(0, 0, 1, 234_567_890)); + assertEquals(accessor.query(TemporalQueries.localDate()), null); + assertEquals(accessor.query(TemporalQueries.localTime()), LocalTime.of(0, 0, 1, 234_567_890)); } @Test @@ -985,8 +985,8 @@ }; DateTimeFormatter f = new DateTimeFormatterBuilder().appendValue(field).toFormatter(); TemporalAccessor accessor = f.parse("1234567890"); - assertEquals(accessor.query(TemporalQuery.localDate()), LocalDate.of(2010, 6, 30)); - assertEquals(accessor.query(TemporalQuery.localTime()), LocalTime.of(12, 30)); + assertEquals(accessor.query(TemporalQueries.localDate()), LocalDate.of(2010, 6, 30)); + assertEquals(accessor.query(TemporalQueries.localTime()), LocalTime.of(12, 30)); } @Test(expectedExceptions = DateTimeParseException.class)
--- a/test/java/time/tck/java/time/format/TCKLocalizedPrinterParser.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/format/TCKLocalizedPrinterParser.java Tue Oct 15 13:14:03 2013 -0400 @@ -123,7 +123,7 @@ }; } - @SuppressWarnings("deprecated") + @SuppressWarnings("deprecation") @Test(dataProvider="date") public void test_date_print(LocalDate date, FormatStyle dateStyle, int dateStyleOld, Locale locale) { DateFormat old = DateFormat.getDateInstance(dateStyleOld, locale); @@ -135,7 +135,7 @@ assertEquals(formatted, text); } - @SuppressWarnings("deprecated") + @SuppressWarnings("deprecation") @Test(dataProvider="date") public void test_date_parse(LocalDate date, FormatStyle dateStyle, int dateStyleOld, Locale locale) { DateFormat old = DateFormat.getDateInstance(dateStyleOld, locale); @@ -176,7 +176,7 @@ }; } - @SuppressWarnings("deprecated") + @SuppressWarnings("deprecation") @Test(dataProvider="time") public void test_time_print(LocalTime time, FormatStyle timeStyle, int timeStyleOld, Locale locale) { DateFormat old = DateFormat.getTimeInstance(timeStyleOld, locale); @@ -188,7 +188,7 @@ assertEquals(formatted, text); } - @SuppressWarnings("deprecated") + @SuppressWarnings("deprecation") @Test(dataProvider="time") public void test_time_parse(LocalTime time, FormatStyle timeStyle, int timeStyleOld, Locale locale) { DateFormat old = DateFormat.getTimeInstance(timeStyleOld, locale);
--- a/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/format/TCKZoneIdPrinterParser.java Tue Oct 15 13:14:03 2013 -0400 @@ -71,7 +71,7 @@ import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatterBuilder; import java.time.temporal.TemporalAccessor; -import java.time.temporal.TemporalQuery; +import java.time.temporal.TemporalQueries; import java.util.Locale; import java.util.Objects; @@ -214,9 +214,9 @@ assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + text); assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + text); if (expected != null) { - assertEquals(parsed.query(TemporalQuery.zoneId()), expected, "Incorrect zoneId parsing: " + text); - assertEquals(parsed.query(TemporalQuery.offset()), null, "Incorrect offset parsing: " + text); - assertEquals(parsed.query(TemporalQuery.zone()), expected, "Incorrect zone parsing: " + text); + assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + text); + assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + text); + assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + text); } else { assertEquals(parsed, null); } @@ -231,9 +231,9 @@ assertEquals(pos.getErrorIndex(), expectedErrorIndex >= 0 ? expectedErrorIndex + 3 : expectedErrorIndex, "Incorrect error index parsing: " + prefixText); assertEquals(pos.getIndex(), expectedIndex + 3, "Incorrect index parsing: " + prefixText); if (expected != null) { - assertEquals(parsed.query(TemporalQuery.zoneId()), expected, "Incorrect zoneId parsing: " + prefixText); - assertEquals(parsed.query(TemporalQuery.offset()), null, "Incorrect offset parsing: " + prefixText); - assertEquals(parsed.query(TemporalQuery.zone()), expected, "Incorrect zone parsing: " + prefixText); + assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + prefixText); + assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + prefixText); + assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + prefixText); } else { assertEquals(parsed, null); } @@ -247,9 +247,9 @@ assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + suffixText); assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + suffixText); if (expected != null) { - assertEquals(parsed.query(TemporalQuery.zoneId()), expected, "Incorrect zoneId parsing: " + suffixText); - assertEquals(parsed.query(TemporalQuery.offset()), null, "Incorrect offset parsing: " + suffixText); - assertEquals(parsed.query(TemporalQuery.zone()), expected, "Incorrect zone parsing: " + suffixText); + assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + suffixText); + assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + suffixText); + assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + suffixText); } else { assertEquals(parsed, null); } @@ -269,9 +269,9 @@ assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + lcText); assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + lcText); if (expected != null) { - assertEquals(parsed.query(TemporalQuery.zoneId()), expected); - assertEquals(parsed.query(TemporalQuery.offset()), null); - assertEquals(parsed.query(TemporalQuery.zone()), expected); + assertEquals(parsed.query(TemporalQueries.zoneId()), expected); + assertEquals(parsed.query(TemporalQueries.offset()), null); + assertEquals(parsed.query(TemporalQueries.zone()), expected); } else { assertEquals(parsed, null); } @@ -286,10 +286,10 @@ assertEquals(pos.getErrorIndex(), expectedErrorIndex, "Incorrect error index parsing: " + lcText); assertEquals(pos.getIndex(), expectedIndex, "Incorrect index parsing: " + lcText); if (expected != null) { - ZoneId zid = parsed.query(TemporalQuery.zoneId()); - assertEquals(parsed.query(TemporalQuery.zoneId()), expected, "Incorrect zoneId parsing: " + lcText); - assertEquals(parsed.query(TemporalQuery.offset()), null, "Incorrect offset parsing: " + lcText); - assertEquals(parsed.query(TemporalQuery.zone()), expected, "Incorrect zone parsing: " + lcText); + ZoneId zid = parsed.query(TemporalQueries.zoneId()); + assertEquals(parsed.query(TemporalQueries.zoneId()), expected, "Incorrect zoneId parsing: " + lcText); + assertEquals(parsed.query(TemporalQueries.offset()), null, "Incorrect offset parsing: " + lcText); + assertEquals(parsed.query(TemporalQueries.zone()), expected, "Incorrect zone parsing: " + lcText); } else { assertEquals(parsed, null); }
--- a/test/java/time/tck/java/time/temporal/TCKTemporalAdjusters.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/tck/java/time/temporal/TCKTemporalAdjusters.java Tue Oct 15 13:14:03 2013 -0400 @@ -73,12 +73,13 @@ import java.time.LocalDate; import java.time.Month; import java.time.temporal.TemporalAdjuster; +import java.time.temporal.TemporalAdjusters; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** - * Test TemporalAdjuster. + * Test TemporalAdjusters. */ @Test public class TCKTemporalAdjusters { @@ -88,13 +89,13 @@ //----------------------------------------------------------------------- @Test public void factory_ofDateAdjuster() { - TemporalAdjuster test = TemporalAdjuster.ofDateAdjuster(date -> date.plusDays(2)); + TemporalAdjuster test = TemporalAdjusters.ofDateAdjuster(date -> date.plusDays(2)); assertEquals(LocalDate.of(2012, 6, 30).with(test), LocalDate.of(2012, 7, 2)); } @Test(expectedExceptions = NullPointerException.class) public void factory_ofDateAdjuster_null() { - TemporalAdjuster.ofDateAdjuster(null); + TemporalAdjusters.ofDateAdjuster(null); } @@ -103,7 +104,7 @@ //----------------------------------------------------------------------- @Test public void factory_firstDayOfMonth() { - assertNotNull(TemporalAdjuster.firstDayOfMonth()); + assertNotNull(TemporalAdjusters.firstDayOfMonth()); } @Test @@ -111,7 +112,7 @@ for (Month month : Month.values()) { for (int i = 1; i <= month.length(false); i++) { LocalDate date = date(2007, month, i); - LocalDate test = (LocalDate) TemporalAdjuster.firstDayOfMonth().adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.firstDayOfMonth().adjustInto(date); assertEquals(test.getYear(), 2007); assertEquals(test.getMonth(), month); assertEquals(test.getDayOfMonth(), 1); @@ -124,7 +125,7 @@ for (Month month : Month.values()) { for (int i = 1; i <= month.length(true); i++) { LocalDate date = date(2008, month, i); - LocalDate test = (LocalDate) TemporalAdjuster.firstDayOfMonth().adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.firstDayOfMonth().adjustInto(date); assertEquals(test.getYear(), 2008); assertEquals(test.getMonth(), month); assertEquals(test.getDayOfMonth(), 1); @@ -137,7 +138,7 @@ //----------------------------------------------------------------------- @Test public void factory_lastDayOfMonth() { - assertNotNull(TemporalAdjuster.lastDayOfMonth()); + assertNotNull(TemporalAdjusters.lastDayOfMonth()); } @Test @@ -145,7 +146,7 @@ for (Month month : Month.values()) { for (int i = 1; i <= month.length(false); i++) { LocalDate date = date(2007, month, i); - LocalDate test = (LocalDate) TemporalAdjuster.lastDayOfMonth().adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.lastDayOfMonth().adjustInto(date); assertEquals(test.getYear(), 2007); assertEquals(test.getMonth(), month); assertEquals(test.getDayOfMonth(), month.length(false)); @@ -158,7 +159,7 @@ for (Month month : Month.values()) { for (int i = 1; i <= month.length(true); i++) { LocalDate date = date(2008, month, i); - LocalDate test = (LocalDate) TemporalAdjuster.lastDayOfMonth().adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.lastDayOfMonth().adjustInto(date); assertEquals(test.getYear(), 2008); assertEquals(test.getMonth(), month); assertEquals(test.getDayOfMonth(), month.length(true)); @@ -171,7 +172,7 @@ //----------------------------------------------------------------------- @Test public void factory_firstDayOfNextMonth() { - assertNotNull(TemporalAdjuster.firstDayOfNextMonth()); + assertNotNull(TemporalAdjusters.firstDayOfNextMonth()); } @Test @@ -179,7 +180,7 @@ for (Month month : Month.values()) { for (int i = 1; i <= month.length(false); i++) { LocalDate date = date(2007, month, i); - LocalDate test = (LocalDate) TemporalAdjuster.firstDayOfNextMonth().adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.firstDayOfNextMonth().adjustInto(date); assertEquals(test.getYear(), month == DECEMBER ? 2008 : 2007); assertEquals(test.getMonth(), month.plus(1)); assertEquals(test.getDayOfMonth(), 1); @@ -192,7 +193,7 @@ for (Month month : Month.values()) { for (int i = 1; i <= month.length(true); i++) { LocalDate date = date(2008, month, i); - LocalDate test = (LocalDate) TemporalAdjuster.firstDayOfNextMonth().adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.firstDayOfNextMonth().adjustInto(date); assertEquals(test.getYear(), month == DECEMBER ? 2009 : 2008); assertEquals(test.getMonth(), month.plus(1)); assertEquals(test.getDayOfMonth(), 1); @@ -205,7 +206,7 @@ //----------------------------------------------------------------------- @Test public void factory_firstDayOfYear() { - assertNotNull(TemporalAdjuster.firstDayOfYear()); + assertNotNull(TemporalAdjusters.firstDayOfYear()); } @Test @@ -213,7 +214,7 @@ for (Month month : Month.values()) { for (int i = 1; i <= month.length(false); i++) { LocalDate date = date(2007, month, i); - LocalDate test = (LocalDate) TemporalAdjuster.firstDayOfYear().adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.firstDayOfYear().adjustInto(date); assertEquals(test.getYear(), 2007); assertEquals(test.getMonth(), Month.JANUARY); assertEquals(test.getDayOfMonth(), 1); @@ -226,7 +227,7 @@ for (Month month : Month.values()) { for (int i = 1; i <= month.length(true); i++) { LocalDate date = date(2008, month, i); - LocalDate test = (LocalDate) TemporalAdjuster.firstDayOfYear().adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.firstDayOfYear().adjustInto(date); assertEquals(test.getYear(), 2008); assertEquals(test.getMonth(), Month.JANUARY); assertEquals(test.getDayOfMonth(), 1); @@ -239,7 +240,7 @@ //----------------------------------------------------------------------- @Test public void factory_lastDayOfYear() { - assertNotNull(TemporalAdjuster.lastDayOfYear()); + assertNotNull(TemporalAdjusters.lastDayOfYear()); } @Test @@ -247,7 +248,7 @@ for (Month month : Month.values()) { for (int i = 1; i <= month.length(false); i++) { LocalDate date = date(2007, month, i); - LocalDate test = (LocalDate) TemporalAdjuster.lastDayOfYear().adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.lastDayOfYear().adjustInto(date); assertEquals(test.getYear(), 2007); assertEquals(test.getMonth(), Month.DECEMBER); assertEquals(test.getDayOfMonth(), 31); @@ -260,7 +261,7 @@ for (Month month : Month.values()) { for (int i = 1; i <= month.length(true); i++) { LocalDate date = date(2008, month, i); - LocalDate test = (LocalDate) TemporalAdjuster.lastDayOfYear().adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.lastDayOfYear().adjustInto(date); assertEquals(test.getYear(), 2008); assertEquals(test.getMonth(), Month.DECEMBER); assertEquals(test.getDayOfMonth(), 31); @@ -273,7 +274,7 @@ //----------------------------------------------------------------------- @Test public void factory_firstDayOfNextYear() { - assertNotNull(TemporalAdjuster.firstDayOfNextYear()); + assertNotNull(TemporalAdjusters.firstDayOfNextYear()); } @Test @@ -281,7 +282,7 @@ for (Month month : Month.values()) { for (int i = 1; i <= month.length(false); i++) { LocalDate date = date(2007, month, i); - LocalDate test = (LocalDate) TemporalAdjuster.firstDayOfNextYear().adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.firstDayOfNextYear().adjustInto(date); assertEquals(test.getYear(), 2008); assertEquals(test.getMonth(), JANUARY); assertEquals(test.getDayOfMonth(), 1); @@ -294,7 +295,7 @@ for (Month month : Month.values()) { for (int i = 1; i <= month.length(true); i++) { LocalDate date = date(2008, month, i); - LocalDate test = (LocalDate) TemporalAdjuster.firstDayOfNextYear().adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.firstDayOfNextYear().adjustInto(date); assertEquals(test.getYear(), 2009); assertEquals(test.getMonth(), JANUARY); assertEquals(test.getDayOfMonth(), 1); @@ -307,12 +308,12 @@ //----------------------------------------------------------------------- @Test public void factory_dayOfWeekInMonth() { - assertNotNull(TemporalAdjuster.dayOfWeekInMonth(1, MONDAY)); + assertNotNull(TemporalAdjusters.dayOfWeekInMonth(1, MONDAY)); } @Test(expectedExceptions=NullPointerException.class) public void factory_dayOfWeekInMonth_nullDayOfWeek() { - TemporalAdjuster.dayOfWeekInMonth(1, null); + TemporalAdjusters.dayOfWeekInMonth(1, null); } @DataProvider(name = "dayOfWeekInMonth_positive") @@ -338,7 +339,7 @@ for (int ordinal = 1; ordinal <= 5; ordinal++) { for (int day = 1; day <= Month.of(month).length(false); day++) { LocalDate date = date(year, month, day); - LocalDate test = (LocalDate) TemporalAdjuster.dayOfWeekInMonth(ordinal, dow).adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.dayOfWeekInMonth(ordinal, dow).adjustInto(date); assertEquals(test, expected.plusWeeks(ordinal - 1)); } } @@ -366,7 +367,7 @@ public void test_dayOfWeekInMonth_zero(int year, int month, DayOfWeek dow, LocalDate expected) { for (int day = 1; day <= Month.of(month).length(false); day++) { LocalDate date = date(year, month, day); - LocalDate test = (LocalDate) TemporalAdjuster.dayOfWeekInMonth(0, dow).adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.dayOfWeekInMonth(0, dow).adjustInto(date); assertEquals(test, expected); } } @@ -394,7 +395,7 @@ for (int ordinal = 0; ordinal < 5; ordinal++) { for (int day = 1; day <= Month.of(month).length(false); day++) { LocalDate date = date(year, month, day); - LocalDate test = (LocalDate) TemporalAdjuster.dayOfWeekInMonth(-1 - ordinal, dow).adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.dayOfWeekInMonth(-1 - ordinal, dow).adjustInto(date); assertEquals(test, expected.minusWeeks(ordinal)); } } @@ -405,19 +406,19 @@ //----------------------------------------------------------------------- @Test public void factory_firstInMonth() { - assertNotNull(TemporalAdjuster.firstInMonth(MONDAY)); + assertNotNull(TemporalAdjusters.firstInMonth(MONDAY)); } @Test(expectedExceptions=NullPointerException.class) public void factory_firstInMonth_nullDayOfWeek() { - TemporalAdjuster.firstInMonth(null); + TemporalAdjusters.firstInMonth(null); } @Test(dataProvider = "dayOfWeekInMonth_positive") public void test_firstInMonth(int year, int month, DayOfWeek dow, LocalDate expected) { for (int day = 1; day <= Month.of(month).length(false); day++) { LocalDate date = date(year, month, day); - LocalDate test = (LocalDate) TemporalAdjuster.firstInMonth(dow).adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.firstInMonth(dow).adjustInto(date); assertEquals(test, expected, "day-of-month=" + day); } } @@ -427,19 +428,19 @@ //----------------------------------------------------------------------- @Test public void factory_lastInMonth() { - assertNotNull(TemporalAdjuster.lastInMonth(MONDAY)); + assertNotNull(TemporalAdjusters.lastInMonth(MONDAY)); } @Test(expectedExceptions=NullPointerException.class) public void factory_lastInMonth_nullDayOfWeek() { - TemporalAdjuster.lastInMonth(null); + TemporalAdjusters.lastInMonth(null); } @Test(dataProvider = "dayOfWeekInMonth_negative") public void test_lastInMonth(int year, int month, DayOfWeek dow, LocalDate expected) { for (int day = 1; day <= Month.of(month).length(false); day++) { LocalDate date = date(year, month, day); - LocalDate test = (LocalDate) TemporalAdjuster.lastInMonth(dow).adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.lastInMonth(dow).adjustInto(date); assertEquals(test, expected, "day-of-month=" + day); } } @@ -449,12 +450,12 @@ //----------------------------------------------------------------------- @Test public void factory_next() { - assertNotNull(TemporalAdjuster.next(MONDAY)); + assertNotNull(TemporalAdjusters.next(MONDAY)); } @Test(expectedExceptions = NullPointerException.class) public void factory_next_nullDayOfWeek() { - TemporalAdjuster.next(null); + TemporalAdjusters.next(null); } @Test @@ -464,7 +465,7 @@ LocalDate date = date(2007, month, i); for (DayOfWeek dow : DayOfWeek.values()) { - LocalDate test = (LocalDate) TemporalAdjuster.next(dow).adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.next(dow).adjustInto(date); assertSame(test.getDayOfWeek(), dow, date + " " + test); @@ -488,12 +489,12 @@ //----------------------------------------------------------------------- @Test public void factory_nextOrCurrent() { - assertNotNull(TemporalAdjuster.nextOrSame(MONDAY)); + assertNotNull(TemporalAdjusters.nextOrSame(MONDAY)); } @Test(expectedExceptions = NullPointerException.class) public void factory_nextOrCurrent_nullDayOfWeek() { - TemporalAdjuster.nextOrSame(null); + TemporalAdjusters.nextOrSame(null); } @Test @@ -503,7 +504,7 @@ LocalDate date = date(2007, month, i); for (DayOfWeek dow : DayOfWeek.values()) { - LocalDate test = (LocalDate) TemporalAdjuster.nextOrSame(dow).adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.nextOrSame(dow).adjustInto(date); assertSame(test.getDayOfWeek(), dow); @@ -529,12 +530,12 @@ //----------------------------------------------------------------------- @Test public void factory_previous() { - assertNotNull(TemporalAdjuster.previous(MONDAY)); + assertNotNull(TemporalAdjusters.previous(MONDAY)); } @Test(expectedExceptions = NullPointerException.class) public void factory_previous_nullDayOfWeek() { - TemporalAdjuster.previous(null); + TemporalAdjusters.previous(null); } @Test @@ -544,7 +545,7 @@ LocalDate date = date(2007, month, i); for (DayOfWeek dow : DayOfWeek.values()) { - LocalDate test = (LocalDate) TemporalAdjuster.previous(dow).adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.previous(dow).adjustInto(date); assertSame(test.getDayOfWeek(), dow, date + " " + test); @@ -568,12 +569,12 @@ //----------------------------------------------------------------------- @Test public void factory_previousOrCurrent() { - assertNotNull(TemporalAdjuster.previousOrSame(MONDAY)); + assertNotNull(TemporalAdjusters.previousOrSame(MONDAY)); } @Test(expectedExceptions = NullPointerException.class) public void factory_previousOrCurrent_nullDayOfWeek() { - TemporalAdjuster.previousOrSame(null); + TemporalAdjusters.previousOrSame(null); } @Test @@ -583,7 +584,7 @@ LocalDate date = date(2007, month, i); for (DayOfWeek dow : DayOfWeek.values()) { - LocalDate test = (LocalDate) TemporalAdjuster.previousOrSame(dow).adjustInto(date); + LocalDate test = (LocalDate) TemporalAdjusters.previousOrSame(dow).adjustInto(date); assertSame(test.getDayOfWeek(), dow);
--- a/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java Tue Oct 15 13:14:03 2013 -0400 @@ -60,7 +60,7 @@ import java.time.temporal.ChronoField; import java.time.temporal.ChronoUnit; import java.time.temporal.TemporalAccessor; -import java.time.temporal.TemporalAdjuster; +import java.time.temporal.TemporalAdjusters; import java.time.temporal.ValueRange; import java.time.temporal.WeekFields; import java.util.Locale; @@ -357,12 +357,12 @@ @Test public void test_temporalDayAdjustments() { HijrahDate date = HijrahDate.of(1554, 7, 21); - assertEquals(date.with(TemporalAdjuster.firstDayOfMonth()), HijrahDate.of(1554, 7, 1)); - assertEquals(date.with(TemporalAdjuster.lastDayOfMonth()), HijrahDate.of(1554, 7, 29)); - assertEquals(date.with(TemporalAdjuster.firstDayOfNextMonth()), HijrahDate.of(1554, 8, 1)); - assertEquals(date.with(TemporalAdjuster.firstDayOfNextYear()), HijrahDate.of(1555, 1, 1)); - assertEquals(date.with(TemporalAdjuster.firstDayOfYear()), HijrahDate.of(1554, 1, 1)); - assertEquals(date.with(TemporalAdjuster.lastDayOfYear()), HijrahDate.of(1554, 12, 30)); + assertEquals(date.with(TemporalAdjusters.firstDayOfMonth()), HijrahDate.of(1554, 7, 1)); + assertEquals(date.with(TemporalAdjusters.lastDayOfMonth()), HijrahDate.of(1554, 7, 29)); + assertEquals(date.with(TemporalAdjusters.firstDayOfNextMonth()), HijrahDate.of(1554, 8, 1)); + assertEquals(date.with(TemporalAdjusters.firstDayOfNextYear()), HijrahDate.of(1555, 1, 1)); + assertEquals(date.with(TemporalAdjusters.firstDayOfYear()), HijrahDate.of(1554, 1, 1)); + assertEquals(date.with(TemporalAdjusters.lastDayOfYear()), HijrahDate.of(1554, 12, 30)); } // Data provider for string representation of the date instances @@ -412,7 +412,7 @@ @Test(dataProvider="monthDays") public void test_lastDayOfMonth(int year, int month, int numDays) { HijrahDate hDate = HijrahChronology.INSTANCE.date(year, month, 1); - hDate = hDate.with(TemporalAdjuster.lastDayOfMonth()); + hDate = hDate.with(TemporalAdjusters.lastDayOfMonth()); assertEquals(hDate.get(ChronoField.DAY_OF_MONTH), numDays); }
--- a/test/java/time/test/java/time/format/TestCharLiteralParser.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/test/java/time/format/TestCharLiteralParser.java Tue Oct 15 13:14:03 2013 -0400 @@ -66,7 +66,7 @@ import java.text.ParsePosition; import java.time.temporal.TemporalAccessor; -import java.time.temporal.TemporalQuery; +import java.time.temporal.TemporalQueries; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -111,8 +111,8 @@ } else { assertEquals(ppos.getIndex(), expectedPos); assertEquals(parsed.isSupported(YEAR), false); - assertEquals(parsed.query(TemporalQuery.chronology()), null); - assertEquals(parsed.query(TemporalQuery.zoneId()), null); + assertEquals(parsed.query(TemporalQueries.chronology()), null); + assertEquals(parsed.query(TemporalQueries.zoneId()), null); } }
--- a/test/java/time/test/java/time/format/TestNonIsoFormatter.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/test/java/time/format/TestNonIsoFormatter.java Tue Oct 15 13:14:03 2013 -0400 @@ -39,7 +39,7 @@ import java.time.format.FormatStyle; import java.time.format.TextStyle; import java.time.temporal.TemporalAccessor; -import java.time.temporal.TemporalQuery; +import java.time.temporal.TemporalQueries; import java.util.Locale; import org.testng.annotations.BeforeMethod; @@ -163,7 +163,7 @@ String text = dtf.format(chrono.dateNow()); assertEquals(text, expected); TemporalAccessor ta = dtf.parse(text); - Chronology cal = ta.query(TemporalQuery.chronology()); + Chronology cal = ta.query(TemporalQueries.chronology()); assertEquals(cal, chrono); } }
--- a/test/java/time/test/java/time/format/TestNumberParser.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/test/java/time/format/TestNumberParser.java Tue Oct 15 13:14:03 2013 -0400 @@ -72,7 +72,7 @@ import java.time.format.SignStyle; import java.time.temporal.TemporalAccessor; import java.time.temporal.TemporalField; -import java.time.temporal.TemporalQuery; +import java.time.temporal.TemporalQueries; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -178,8 +178,8 @@ assertTrue(subsequentWidth >= 0); assertEquals(ppos.getIndex(), expectedPos + subsequentWidth); assertEquals(parsed.getLong(DAY_OF_MONTH), expectedValue); - assertEquals(parsed.query(TemporalQuery.chronology()), null); - assertEquals(parsed.query(TemporalQuery.zoneId()), null); + assertEquals(parsed.query(TemporalQueries.chronology()), null); + assertEquals(parsed.query(TemporalQueries.zoneId()), null); } } @@ -198,8 +198,8 @@ assertTrue(subsequentWidth >= 0); assertEquals(ppos.getIndex(), expectedPos + subsequentWidth); assertEquals(parsed.getLong(DAY_OF_WEEK), expectedValue); - assertEquals(parsed.query(TemporalQuery.chronology()), null); - assertEquals(parsed.query(TemporalQuery.zoneId()), null); + assertEquals(parsed.query(TemporalQueries.chronology()), null); + assertEquals(parsed.query(TemporalQueries.zoneId()), null); } } @@ -313,8 +313,8 @@ } else { assertEquals(pos.getIndex(), parseLen); assertEquals(parsed.getLong(DAY_OF_MONTH), (long)parseVal); - assertEquals(parsed.query(TemporalQuery.chronology()), null); - assertEquals(parsed.query(TemporalQuery.zoneId()), null); + assertEquals(parsed.query(TemporalQueries.chronology()), null); + assertEquals(parsed.query(TemporalQueries.zoneId()), null); } } @@ -423,8 +423,8 @@ } else { assertEquals(pos.getIndex(), parseLen); assertEquals(parsed.getLong(DAY_OF_MONTH), (long)parseVal); - assertEquals(parsed.query(TemporalQuery.chronology()), null); - assertEquals(parsed.query(TemporalQuery.zoneId()), null); + assertEquals(parsed.query(TemporalQueries.chronology()), null); + assertEquals(parsed.query(TemporalQueries.zoneId()), null); } } @@ -514,8 +514,8 @@ } else { assertEquals(pos.getIndex(), parseLen); assertEquals(parsed.getLong(DAY_OF_MONTH), (long)parseVal); - assertEquals(parsed.query(TemporalQuery.chronology()), null); - assertEquals(parsed.query(TemporalQuery.zoneId()), null); + assertEquals(parsed.query(TemporalQueries.chronology()), null); + assertEquals(parsed.query(TemporalQueries.zoneId()), null); } } @@ -552,8 +552,8 @@ assertEquals(pos.getIndex(), parseLen); assertEquals(parsed.getLong(MONTH_OF_YEAR), (long) parseMonth); assertEquals(parsed.getLong(DAY_OF_MONTH), (long) parsedDay); - assertEquals(parsed.query(TemporalQuery.chronology()), null); - assertEquals(parsed.query(TemporalQuery.zoneId()), null); + assertEquals(parsed.query(TemporalQueries.chronology()), null); + assertEquals(parsed.query(TemporalQueries.zoneId()), null); } }
--- a/test/java/time/test/java/time/format/TestStringLiteralParser.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/test/java/time/format/TestStringLiteralParser.java Tue Oct 15 13:14:03 2013 -0400 @@ -66,7 +66,7 @@ import java.text.ParsePosition; import java.time.temporal.TemporalAccessor; -import java.time.temporal.TemporalQuery; +import java.time.temporal.TemporalQueries; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -114,8 +114,8 @@ } else { assertEquals(ppos.getIndex(), expectedPos); assertEquals(parsed.isSupported(YEAR), false); - assertEquals(parsed.query(TemporalQuery.chronology()), null); - assertEquals(parsed.query(TemporalQuery.zoneId()), null); + assertEquals(parsed.query(TemporalQueries.chronology()), null); + assertEquals(parsed.query(TemporalQueries.zoneId()), null); } }
--- a/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/test/java/time/format/TestZoneTextPrinterParser.java Tue Oct 15 13:14:03 2013 -0400 @@ -33,7 +33,7 @@ import java.time.format.DateTimeFormatterBuilder; import java.time.format.TextStyle; import java.time.temporal.ChronoField; -import java.time.temporal.TemporalQuery; +import java.time.temporal.TemporalQueries; import java.time.zone.ZoneRulesProvider; import java.util.Arrays; import java.util.Date; @@ -150,7 +150,7 @@ .toFormatter(locale) .withDecimalStyle(DecimalStyle.of(locale)); - String ret = fmt.parse(text, TemporalQuery.zone()).getId(); + String ret = fmt.parse(text, TemporalQueries.zone()).getId(); System.out.printf("[%-5s %s] %24s -> %s(%s)%n", locale.toString(), @@ -186,7 +186,7 @@ if (ci) { text = text.toUpperCase(); } - String ret = fmt.parse(text, TemporalQuery.zone()).getId(); + String ret = fmt.parse(text, TemporalQueries.zone()).getId(); // TBD: need an excluding list // assertEquals(...); if (ret.equals(expected) ||
--- a/test/java/time/test/java/util/TestFormatter.java Tue Jul 09 21:35:04 2013 +0100 +++ b/test/java/time/test/java/util/TestFormatter.java Tue Oct 15 13:14:03 2013 -0400 @@ -36,7 +36,7 @@ import java.time.chrono.Chronology; import java.time.temporal.ChronoField; -import java.time.temporal.TemporalQuery; +import java.time.temporal.TemporalQueries; import java.time.temporal.TemporalAccessor; import java.util.*; @@ -134,7 +134,7 @@ Class<?> c = o.getClass(); String clname = c.getName().substring(c.getPackage().getName().length() + 1); if (o instanceof TemporalAccessor) { - Chronology chrono = ((TemporalAccessor)o).query(TemporalQuery.chronology()); + Chronology chrono = ((TemporalAccessor)o).query(TemporalQueries.chronology()); if (chrono != null) { clname = clname + "(" + chrono.getId() + ")"; }