You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Timothy A. Bish (Jira)" <ji...@apache.org> on 2025/06/23 19:07:00 UTC

[jira] [Commented] (ARTEMIS-5542) Use Objects.equals consistently

    [ https://issues.apache.org/jira/browse/ARTEMIS-5542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17985699#comment-17985699 ] 

Timothy A. Bish commented on ARTEMIS-5542:
------------------------------------------

Commit 4890bb36c70977180db223a6839e1c881116232e in activemq-artemis's branch refs/heads/main from Justin Bertram
[ [https://gitbox.apache.org/repos/asf?p=activemq-artemis.git;h=4890bb36c7] ]

ARTEMIS-5442 use Objects.equals consistently

This commit enforces consistency for `Object#equals` implementations
across the code-base via the following changes:
 - Use `Objects#equals` whenever possible.
 - Use `instanceof` rather than explicit null checks & `getClass`.
 - Use "obj" for parameter name and "other" for cast object name.
 - Always check identity using `==` first.
 - Use explicit curly brackets for conditionals to increase clarity.

> Use Objects.equals consistently
> -------------------------------
>
>                 Key: ARTEMIS-5542
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-5542
>             Project: ActiveMQ Artemis
>          Issue Type: Task
>            Reporter: Justin Bertram
>            Assignee: Justin Bertram
>            Priority: Major
>             Fix For: 2.42.0
>
>
> We have implementations of {{Object#equals}} across the code-base that follow several different patterns. We should leverage {{Objects#equals}} as it frees us from having to deal with {{null}} values explicitly. Lots of implementations already do this, but it would good to apply this consistently.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@activemq.apache.org
For additional commands, e-mail: issues-help@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact