RFR: 8294226: Document missing UnsupportedTemporalTypeException

Gautham Krishnan gkrishnan at openjdk.org
Mon Jun 16 16:43:00 UTC 2025


Some methods in the java.time.chrono interfaces—ChronoLocalDate, ChronoLocalDateTime, and ChronoZonedDateTime—override methods from the java.time.temporal.Temporal interface that are documented to throw UnsupportedTemporalTypeException when given unsupported fields or units.

These overridden methods include:

with(TemporalField, long)

plus(long, TemporalUnit)

minus(long, TemporalUnit)

However, their Javadoc in the chrono interfaces does not mention the possibility of this exception, resulting in incomplete or inconsistent documentation. This contrasts with the parent Temporal interface, which explicitly documents the exception.

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

Commit messages:
 - Documenting missing UnsupportedTemporalTypeException

Changes: https://git.openjdk.org/jdk/pull/25836/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25836&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8294226
  Stats: 10 lines in 3 files changed: 8 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jdk/pull/25836.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25836/head:pull/25836

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


More information about the core-libs-dev mailing list