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

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

                Author: ASF GitHub Bot
            Created on: 10/Nov/25 15:46
            Start Date: 10/Nov/25 15:46
    Worklog Time Spent: 10m 
      Work Description: jbertram commented on code in PR #6029:
URL: https://github.com/apache/activemq-artemis/pull/6029#discussion_r2511077523


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java:
##########
@@ -102,6 +102,17 @@ public void setSwept(boolean swept) {
    private AddressInfo() {
    }
 
+   /**
+    * Constructs a new {@code AddressInfo} object by copying the name and 
routing types
+    * from another {@code AddressInfo} instance.
+    *
+    * @param other the {@code AddressInfo} instance to copy from. The name and 
routing types
+    *              from this instance will be used to initialize the new 
{@code AddressInfo}.
+    */
+   public AddressInfo(AddressInfo other) {
+      this(other.getName(), EnumSet.copyOf(other.getRoutingTypes()));
+   }

Review Comment:
   It's certainly possible that a partial copy constructor could cause 
confusion. I added JavaDoc to help mitigate that risk. 
   
   I was actually using `AddressInfo(SimpleString name, EnumSet<RoutingType> 
routingTypes)` directly at one point, but I wasn't using `EnumSet.copyOf` so it 
was causing other issues. Once I realized I needed `EnumSet.copyOf` I thought 
it would be helpful to codify its use in a copy constructor to prevent other 
such errors in the future.
   
   Generally speaking, the `AddressInfo` class is kind of confusing since it 
acts as a container for configuration information that is passed around a lot 
simply to represent a name + routing-types, but it is also used for runtime 
info (e.g. various counts and statuses). We should probably eventually split 
these two concerns apart like we have with the queue (i.e. using 
`QueueConfiguration` and `QueueImpl`).
   
   In any event, I can remove the copy constructor and use the other 
constructor directly if that's ultimately desired.





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

    Worklog Id:     (was: 990975)
    Time Spent: 0.5h  (was: 20m)

> Don't modify AddressInfo during auto-create checks
> --------------------------------------------------
>
>                 Key: ARTEMIS-5744
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-5744
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>            Reporter: Justin Bertram
>            Assignee: Justin Bertram
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>




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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to