< prev index next >
src/java.base/share/classes/java/time/LocalDate.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -79,11 +79,11 @@
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.time.chrono.ChronoLocalDate;
-import java.time.chrono.Era;
+import java.time.chrono.IsoEra;
import java.time.chrono.IsoChronology;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoField;
import java.time.temporal.ChronoUnit;
@@ -710,19 +710,16 @@
* eras, often referred to using 'BC' and 'AD'.
* <p>
* Users of this class should typically ignore this method as it exists primarily
* to fulfill the {@link ChronoLocalDate} contract where it is necessary to support
* the Japanese calendar system.
- * <p>
- * The returned era will be a singleton capable of being compared with the constants
- * in {@link IsoChronology} using the {@code ==} operator.
*
* @return the {@code IsoChronology} era constant applicable at this date, not null
*/
@Override // override for Javadoc
- public Era getEra() {
- return ChronoLocalDate.super.getEra();
+ public IsoEra getEra() {
+ return (getYear() >= 1 ? IsoEra.CE : IsoEra.BCE);
}
/**
* Gets the year field.
* <p>
< prev index next >