On Fri, 10 Jul 2026 09:02:55 GMT, Jaikiran Pai <[email protected]> wrote:
>> Personal preference is to only have the isEnabled()-check within
>> requireIdentity itself, to avoid extraneous code throughout the codebase.
>
>> Infact, should the newly added @throws specification state that the
>> IdentityException is only thrown when value objects preview is enabled?
>
> The latest specification in `Objects.hasIdentity()` specifies:
>
> ... All objects are identity objects when preview
> * features are disabled; consequently, this method behaves the same as
> * {@link #nonNull Objects.nonNull} when preview features are disabled.
>
> So I think explicitly mentioning that `IdentityException` gets thrown only
> when preview is enabled isn't necessary.
> Personal preference is to only have the isEnabled()-check within
> requireIdentity itself, to avoid extraneous code throughout the codebase.
That sounds reasonable to me.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/31123#discussion_r3557691789