src/share/classes/java/time/chrono/ThaiBuddhistDate.java

Print this page

        

@@ -94,11 +94,11 @@
  *
  * @since 1.8
  */
 public final class ThaiBuddhistDate
         extends ChronoDateImpl<ThaiBuddhistDate>
-        implements ChronoLocalDate<ThaiBuddhistDate>, Serializable {
+        implements ChronoLocalDate, Serializable {
 
     /**
      * Serialization version.
      */
     private static final long serialVersionUID = -8722293800195731463L;

@@ -150,11 +150,11 @@
      * @param clock  the clock to use, not null
      * @return the current date, not null
      * @throws DateTimeException if the current date cannot be obtained
      */
     public static ThaiBuddhistDate now(Clock clock) {
-        return ThaiBuddhistChronology.INSTANCE.date(LocalDate.now(clock));
+        return new ThaiBuddhistDate(LocalDate.now(clock));
     }
 
     /**
      * Obtains a {@code ThaiBuddhistDate} representing a date in the Thai Buddhist calendar
      * system from the proleptic-year, month-of-year and day-of-month fields.

@@ -262,11 +262,11 @@
                         return ValueRange.of(1, max);
                     }
                 }
                 return getChronology().range(f);
             }
-            throw new UnsupportedTemporalTypeException("Unsupported field: " + field.getName());
+            throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
         }
         return field.rangeRefinedBy(this);
     }
 
     @Override

@@ -323,11 +323,11 @@
                     }
                 }
             }
             return with(isoDate.with(field, newValue));
         }
-        return ChronoLocalDate.super.with(field, newValue);
+        return super.with(field, newValue);
     }
 
     /**
      * {@inheritDoc}
      * @throws DateTimeException {@inheritDoc}

@@ -412,17 +412,18 @@
     private ThaiBuddhistDate with(LocalDate newDate) {
         return (newDate.equals(isoDate) ? this : new ThaiBuddhistDate(newDate));
     }
 
     @Override        // for javadoc and covariant return type
+    @SuppressWarnings("unchecked")
     public final ChronoLocalDateTime<ThaiBuddhistDate> atTime(LocalTime localTime) {
-        return super.atTime(localTime);
+        return (ChronoLocalDateTime<ThaiBuddhistDate>) super.atTime(localTime);
     }
 
     @Override
-    public Period periodUntil(ChronoLocalDate<?> endDate) {
-        return isoDate.periodUntil(endDate);
+    public Period until(ChronoLocalDate endDate) {
+        return isoDate.until(endDate);
     }
 
     @Override  // override for performance
     public long toEpochDay() {
         return isoDate.toEpochDay();