[
https://issues.apache.org/jira/browse/ARTEMIS-4738?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Justin Bertram resolved ARTEMIS-4738.
-------------------------------------
Resolution: Invalid
As far as I can tell the use of {{instanceof}} here is perfectly valid. You can
find the same kind of implementation in the {{String}} class shipped by OpenJDK.
> OVERRIDING EQUALS NOT SYMMETRIC in ActiveMQQueue.java
> -----------------------------------------------------
>
> Key: ARTEMIS-4738
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4738
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Galkin Alexey
> Priority: Major
>
> The equals method is overridden in the ActiveMQQueue class and this method
> uses the instanceof operator to check the type of the object. However, this
> does not take into account the symmetry of the equals method. The equals
> method must be symmetric, that is, if a.equals(b) returns true, then
> b.equals(a) must return true.
> In this case, if the object "o" is not an instance of the ActiveMQQueue
> class, the equals method immediately returns false([line
> 83|https://github.com/apache/activemq-artemis/blob/main/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQQueue.java]),
> without giving the opportunity to check, on the contrary, whether the
> current object is an instance of the object "o". Therefore, the equals method
> in this case does not satisfy the symmetry requirement and can lead to
> incorrect results when comparing objects.
>
> Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.
> Author Alexey Galkin.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)