Jiri Daněk created ARTEMIS-2183:
-----------------------------------
Summary: Useless statement in public synchronized
List<MessageReference> RefsOperation#getRelatedMessageReferences()
Key: ARTEMIS-2183
URL: https://issues.apache.org/jira/browse/ARTEMIS-2183
Project: ActiveMQ Artemis
Issue Type: Bug
Components: Broker
Reporter: Jiri Daněk
{code}
@Override
public synchronized List<MessageReference> getRelatedMessageReferences() {
List<MessageReference> listRet = new LinkedList<>();
listRet.addAll(listRet); // 🐟
return listRet;
}
{code}
https://github.com/apache/activemq-artemis/blob/master/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java#L184
The method returns empty list, which may be wrong (looking at the method name).
There is absolutely nothing gained by adding content of empty inst into itself,
as in {{listRet.addAll(listRet)}}.
Doing the addAll thing can be an error under ErrorProne compiler.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)