On Mon, 15 Jun 2026 19:44:01 GMT, Joe Darcy <[email protected]> wrote:

>> src/java.base/share/classes/java/lang/IdentityException.java line 73:
>> 
>>> 71:      *               that the cause is nonexistent or unknown.
>>> 72:      */
>>> 73:     public IdentityException(Throwable cause) {
>> 
>> As far as I can see, this constructor and the other one below which takes a 
>> message and Throwable aren't used. Like other public APIs, would it be 
>> preferable to not introduce these until there's an actual need for them?
>
>> As far as I can see, this constructor and the other one below which takes a 
>> message and Throwable aren't used. Like other public APIs, would it be 
>> preferable to not introduce these until there's an actual need for them?
> 
> Quick exception type design considerations: general-purpose exceptions in 
> should consider defined four constructors mirroring the four constructors on 
> Throwable, Exception, and RuntimeException. (The JDK APIs aren't super 
> consistent on this point and there have some partial efforts to regularize 
> the sets of constructors on exceptions over the years.)
> 
> I don't think IdentityException.java is general purpose in that sense; 
> however, so I think it would be acceptable to define fewer exceptions 
> initially. On the other hand, I don't think there is that much harm in 
> defining "extra" constructors either.
> 
> I do think it is preferable if IdentityException starts out as final though.
> 
> HTH

This has been addressed in the latest state of this PR through 
https://bugs.openjdk.org/browse/JDK-8386815

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31123#discussion_r3558027074

Reply via email to