On Wed, 1 Nov 2023 08:24:10 GMT, John Hendrikx <jhendr...@openjdk.org> wrote:

>> This might not be an issue, considering that the Boolean(String) constructor 
>> is terminally deprecated anyway.
>
> It might not be, or it may become a bigger issue than it is now.  Why take 
> the risk?  The rule in Java is always the same, objects are compared with 
> `equals` unless you specifically need reference equality.
> 
> You don't do this with other primitive wrappers either (because you are 
> probably aware of things like the integer cache, which is just an 
> implementation detail and no guarantee).  Same for these booleans, you're 
> relying on implementation details for this to work correctly.

I agree with John: `if (Boolean.TRUE.equals(` is much better (maintaintability, 
correctness)

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1014#discussion_r1378908269

Reply via email to