[lworld] RFR: 8287241: Add IdentityException to report that a value object is not valid [v3]
Rémi Forax
forax at openjdk.java.net
Wed Jun 8 21:57:58 UTC 2022
On Wed, 8 Jun 2022 21:42:05 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> Add class java.lang.IdentityException, when thrown indicates that an identity object was required but a value object was supplied.
>>
>> Also add methods `java.util.Objects.requireIdentity(obj)` and `Objects.requireIdentity(obj, message)` to check and throw.
>>
>> Updated java.lang.ref.Reference and related tests to use new exception and method.
>
> Roger Riggs has updated the pull request incrementally with one additional commit since the last revision:
>
> Tweaks to Objects.requireIdentity and IdentityException
src/java.base/share/classes/java/lang/IdentityException.java line 69:
> 67: public IdentityException(String message, Throwable cause) {
> 68: super(message, cause);
> 69: }
There is a missing variant, the one with a Throwable but no message that you use when you want to throw an IdentityException as a result of a previous exception (by example an IllegalMonitorStateException).
-------------
PR: https://git.openjdk.java.net/valhalla/pull/696
More information about the valhalla-dev
mailing list