jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java
changeset 20520 0952771e3e25
parent 20518 dde564773845
child 24256 da9a41004459
--- a/jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java	Wed Sep 04 15:18:54 2013 +0100
+++ b/jdk/src/share/classes/java/time/chrono/ChronoLocalDateImpl.java	Sat Sep 14 22:46:49 2013 +0100
@@ -372,22 +372,10 @@
     }
 
     //-----------------------------------------------------------------------
-    /**
-     * {@inheritDoc}
-     * @throws DateTimeException {@inheritDoc}
-     * @throws ArithmeticException {@inheritDoc}
-     */
     @Override
-    public long until(Temporal endDateTime, TemporalUnit unit) {
-        Objects.requireNonNull(endDateTime, "endDateTime");
-        Objects.requireNonNull(unit, "unit");
-        if (endDateTime instanceof ChronoLocalDate == false) {
-            throw new DateTimeException("Unable to calculate amount as objects are of two different types");
-        }
-        ChronoLocalDate end = (ChronoLocalDate) endDateTime;
-        if (getChronology().equals(end.getChronology()) == false) {
-            throw new DateTimeException("Unable to calculate amount as objects have different chronologies");
-        }
+    public long until(Temporal endExclusive, TemporalUnit unit) {
+        Objects.requireNonNull(endExclusive, "endExclusive");
+        ChronoLocalDate end = getChronology().date(endExclusive);
         if (unit instanceof ChronoUnit) {
             switch ((ChronoUnit) unit) {
                 case DAYS: return daysUntil(end);
@@ -401,7 +389,8 @@
             }
             throw new UnsupportedTemporalTypeException("Unsupported unit: " + unit);
         }
-        return unit.between(this, endDateTime);
+        Objects.requireNonNull(unit, "unit");
+        return unit.between(this, end);
     }
 
     private long daysUntil(ChronoLocalDate end) {