[ 
https://issues.apache.org/jira/browse/ARTEMIS-2183?focusedWorklogId=203225&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-203225
 ]

ASF GitHub Bot logged work on ARTEMIS-2183:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 24/Feb/19 13:25
            Start Date: 24/Feb/19 13:25
    Worklog Time Spent: 10m 
      Work Description: orpiske commented on issue #2564: ARTEMIS-2183 Useless 
statement in public synchronized List
URL: https://github.com/apache/activemq-artemis/pull/2564#issuecomment-466775546
 
 
   > Take a look at the history for it ans maybe it has been changed from 
something that was correct before!
   
   It seems that it was already this way when this code was introduced, [around 
October 
2014](https://github.com/apache/activemq-artemis/commit/177e6820b541e0a71b952eebf503a4d2235910c5#diff-321554fd18f6c7a3a382a7d50ce7a1abR191).
 Maybe we would need to go even farther ahead in the past to figure out.
   
   Looking at the original HornetQ code, it seems that it used to [return the 
refsToAck](https://github.com/hornetq/hornetq/blob/HornetQ_2_2_25_Final/src/main/org/hornetq/core/server/impl/QueueImpl.java#L2712).
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 203225)
    Time Spent: 40m  (was: 0.5h)

> 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
>            Priority: Trivial
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> {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)

Reply via email to