RFR: 8358618: UnsupportedOperationException no-args constructor javadoc is not clear

Chen Liang liach at openjdk.org
Tue Jul 29 13:56:04 UTC 2025


On Tue, 29 Jul 2025 12:54:56 GMT, Nizar Benalla <nbenalla at openjdk.org> wrote:

> Please review this patch that extends the javadoc of `UnsupportedOperationException` no-arg constructor, to clear up that the detail message is null.

Reviewed the CSR for the new assertion that the detail message is `null`.

src/java.base/share/classes/java/lang/RuntimeException.java line 47:

> 45:     static final long serialVersionUID = -7034897190745766939L;
> 46: 
> 47:     /** Constructs a new {@code RuntimeException} with {@code null} as its

All other constructors use "a new runtime exception". I suggest consistency for all constructors.

src/java.base/share/classes/java/lang/UnsupportedOperationException.java line 40:

> 38: public class UnsupportedOperationException extends RuntimeException {
> 39:     /**
> 40:      * Constructs a new {@code UnsupportedOperationException} with {@code null} as its

Similar consistency request for all constructors. Note the two cause-accepting constructors use "a new exception" which may be better updated to what you have here.

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

PR Review: https://git.openjdk.org/jdk/pull/26533#pullrequestreview-3067655550
PR Review Comment: https://git.openjdk.org/jdk/pull/26533#discussion_r2239906599
PR Review Comment: https://git.openjdk.org/jdk/pull/26533#discussion_r2239909242


More information about the core-libs-dev mailing list