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

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

                Author: ASF GitHub Bot
            Created on: 25/Feb/19 17:51
            Start Date: 25/Feb/19 17:51
    Worklog Time Spent: 10m 
      Work Description: orpiske commented on pull request #2564: ARTEMIS-2183 
Useless statement in public synchronized List
URL: https://github.com/apache/activemq-artemis/pull/2564#discussion_r259943352
 
 

 ##########
 File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java
 ##########
 @@ -190,9 +190,7 @@ private void decrementRefCount(MessageReference refmsg) {
 
    @Override
    public synchronized List<MessageReference> getRelatedMessageReferences() {
-      List<MessageReference> listRet = new LinkedList<>();
 
 Review comment:
   Yeah, the original commit was just replacing the addAll with a return of an 
empty list. I modified it to return refsAcks. 
   
   Given that there can be unintended consequences here, I am closing the PR 
and letting those of you with more experience on the code base to decide what 
may be the more appropriate solution in this case.
   
   Nonetheless, I agree with @michaelandrepearce, that there is something 
strange with the original code that the PR intended to fix. 
 
----------------------------------------------------------------
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: 203792)
    Time Spent: 2h 40m  (was: 2.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: 2h 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