/** * Returns a copy of this date with the year altered. * <p> * This method changes the year of the date. * If the month-day is invalid for the year, then the previous valid day * will be selected instead. * <p> * This instance is immutable and unaffected by this method call. * * @param era the era to set in the result, not null * @param yearOfEra the year-of-era to set in the returned date * @return a {@code JapaneseDate} based on this date with the requested year, never null * @throws DateTimeException if {@code year} is invalid */ private JapaneseDate withYear(JapaneseEra era, int yearOfEra) { int year = JapaneseChronology.INSTANCE.prolepticYear(era, yearOfEra); return with(isoDate.withYear(year)); }