< prev index next >
src/java.base/share/classes/java/time/chrono/JapaneseEra.java
Print this page
rev 17640 : [mq]: 8171049
*** 71,80 ****
--- 71,81 ----
import java.io.ObjectInputStream;
import java.io.ObjectStreamException;
import java.io.Serializable;
import java.time.DateTimeException;
import java.time.LocalDate;
+ import java.time.format.DateTimeFormatterBuilder;
import java.time.format.TextStyle;
import java.time.temporal.ChronoField;
import java.time.temporal.TemporalField;
import java.time.temporal.UnsupportedTemporalTypeException;
import java.time.temporal.ValueRange;
*** 251,261 ****
// the era definition.
if (getValue() > N_ERA_CONSTANTS - ERA_OFFSET) {
Objects.requireNonNull(locale, "locale");
return style.asNormal() == TextStyle.NARROW ? getAbbreviation() : getName();
}
! return Era.super.getDisplayName(style, locale);
}
//-----------------------------------------------------------------------
/**
* Obtains an instance of {@code JapaneseEra} from a date.
--- 252,267 ----
// the era definition.
if (getValue() > N_ERA_CONSTANTS - ERA_OFFSET) {
Objects.requireNonNull(locale, "locale");
return style.asNormal() == TextStyle.NARROW ? getAbbreviation() : getName();
}
!
! return new DateTimeFormatterBuilder()
! .appendText(ERA, style)
! .toFormatter(locale)
! .withChronology(JapaneseChronology.INSTANCE)
! .format(this == MEIJI ? MEIJI_6_ISODATE : since);
}
//-----------------------------------------------------------------------
/**
* Obtains an instance of {@code JapaneseEra} from a date.
< prev index next >