<i18n dev> RFR: JDK-8316435: sun.util.calendar.CalendarSystem subclassing should be restricted

Justin Lu jlu at openjdk.org
Mon Sep 18 22:48:53 UTC 2023


Please review this PR which restricts sub-classing of the internal calendar system in sun.util.calendar to only the existing implementations.

As the implementation is long-standing and complete with no intent for future sub-classing, the CalendarSystem should be made sealed. Modifiers adjusted accordingly (`JulianCalendar.Date` must now have package visibility).


This system has the following structure,

`CalendarSystem` extended by `AbstractCalendar` extended by `BaseCalendar` extended by 
(`Gregorian, JulianCalendar, LocalGregorianCalendar`)

`CalendarDate` extended by `BaseCalendar.Date` extended by 
(`Gregorian.Date, ImmutableGregorianDate, JulianCalendar.Date, LocalGregorianCalendar.Date`)

Additionally, CalendarUtils was made `final`, as it is a utility class composed of static util methods.

-------------

Commit messages:
 - private constructor in CalendarUtils
 - Make utility class 'CalendarUtils' final
 - Copyright years
 - Seal the rest of the 'CalendarSystem'
 - Clarify public for LCG.date, when other BaseCalendar.date inheritors are default
 - Seal BaseCalendar and make inheritors final
 - Seal BaseCalendar.Date and make inheritors final

Changes: https://git.openjdk.org/jdk/pull/15803/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15803&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8316435
  Stats: 40 lines in 9 files changed: 7 ins; 0 del; 33 mod
  Patch: https://git.openjdk.org/jdk/pull/15803.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15803/head:pull/15803

PR: https://git.openjdk.org/jdk/pull/15803


More information about the i18n-dev mailing list