--- old/src/java.base/share/classes/java/time/LocalDate.java 2015-11-12 20:57:39.862677000 +0300 +++ new/src/java.base/share/classes/java/time/LocalDate.java 2015-11-12 20:57:39.628677000 +0300 @@ -1,5 +1,5 @@ /* - * 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 @@ -81,7 +81,7 @@ 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; @@ -712,15 +712,12 @@ * 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. - *

- * 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); } /** --- old/test/java/time/tck/java/time/TCKLocalDate.java 2015-11-12 20:57:40.458677000 +0300 +++ new/test/java/time/tck/java/time/TCKLocalDate.java 2015-11-12 20:57:40.262677000 +0300 @@ -1,5 +1,5 @@ /* - * 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 @@ -104,6 +104,7 @@ import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.time.chrono.IsoChronology; +import java.time.chrono.IsoEra; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; import java.time.temporal.ChronoField; @@ -2285,4 +2286,13 @@ return LocalDate.of(year, month, day); } + //----------------------------------------------------------------- + // getEra() + // ----------------------------------------------------------------- + @Test + private void test_getEra(){ + IsoEra isoEra = LocalDate.MAX.getEra(); + assertSame(isoEra,IsoEra.CE); + assertSame(LocalDate.MIN.getEra(),IsoEra.BCE); + } }