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

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

                Author: ASF GitHub Bot
            Created on: 24/Jun/25 15:36
            Start Date: 24/Jun/25 15:36
    Worklog Time Spent: 10m 
      Work Description: jbertram commented on PR #5776:
URL: 
https://github.com/apache/activemq-artemis/pull/5776#issuecomment-3000991245

   @tabish121, I modified 42 instances where `Objects.hash(super.hashCode(), 
...)` was invoked with just one other parameter. These are now 
`super.hashCode() + Objects.hashCode(...)`.




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

            Worklog Id:     (was: 973037)
    Remaining Estimate: 0h
            Time Spent: 10m

> Use Objects.hash consistently
> -----------------------------
>
>                 Key: ARTEMIS-5539
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-5539
>             Project: ActiveMQ Artemis
>          Issue Type: Task
>            Reporter: Justin Bertram
>            Assignee: Justin Bertram
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> There are a lot of implementations of {{hashCode}} like this:
> {code:java}
>    @Override
>    public int hashCode() {
>       int result = super.hashCode();
>       result = 31 * result + (strConnectorClassName != null ? 
> strConnectorClassName.hashCode() : 0);
>       result = 31 * result + (strConnectionParameters != null ? 
> strConnectionParameters.hashCode() : 0);
>       result = 31 * result + (ra != null ? ra.hashCode() : 0);
>       result = 31 * result + (connectionFactoryLookup != null ? 
> connectionFactoryLookup.hashCode() : 0);
>       result = 31 * result + (destination != null ? destination.hashCode() : 
> 0);
>       result = 31 * result + (destinationType != null ? 
> destinationType.hashCode() : 0);
>       result = 31 * result + (messageSelector != null ? 
> messageSelector.hashCode() : 0);
>       result = 31 * result + acknowledgeMode;
>       result = 31 * result + (subscriptionDurability ? 1 : 0);
>       result = 31 * result + (subscriptionName != null ? 
> subscriptionName.hashCode() : 0);
>       result = 31 * result + (shareSubscriptions != null && 
> shareSubscriptions ? 1 : 0);
>       result = 31 * result + (user != null ? user.hashCode() : 0);
>       result = 31 * result + (password != null ? password.hashCode() : 0);
>       result = 31 * result + (maxSession != null ? maxSession.hashCode() : 0);
>       result = 31 * result + (singleConnection != null ? 
> singleConnection.hashCode() : 0);
>       result = 31 * result + (transactionTimeout != null ? 
> transactionTimeout.hashCode() : 0);
>       result = 31 * result + (useJNDI != null ? useJNDI.hashCode() : 0);
>       result = 31 * result + (jndiParams != null ? jndiParams.hashCode() : 0);
>       result = 31 * result + (parsedJndiParams != null ? 
> parsedJndiParams.hashCode() : 0);
>       result = 31 * result + (localTx != null ? localTx.hashCode() : 0);
>       result = 31 * result + (rebalanceConnections != null ? 
> rebalanceConnections.hashCode() : 0);
>       result = 31 * result + (setupAttempts != null ? 
> setupAttempts.hashCode() : 0);
>       result = 31 * result + (setupInterval != null ? 
> setupInterval.hashCode() : 0);
>       result = 31 * result + (queuePrefix != null ? queuePrefix.hashCode() : 
> 0);
>       result = 31 * result + (topicPrefix != null ? topicPrefix.hashCode() : 
> 0);
>       return result;
>    }{code}
> This could be simplified using {{Objects.hash}}, e.g.:
> {code:java}
>    @Override
>    public int hashCode() {
>       return Objects.hash(super.hashCode(), strConnectorClassName, 
> strConnectionParameters, ra, connectionFactoryLookup,
>                           destination, destinationType, messageSelector, 
> acknowledgeMode, subscriptionDurability,
>                           subscriptionName, shareSubscriptions, user, 
> password, maxSession, singleConnection,
>                           transactionTimeout, useJNDI, jndiParams, 
> parsedJndiParams, localTx, rebalanceConnections,
>                           setupAttempts, setupInterval, queuePrefix, 
> topicPrefix);
>    }{code}
> We already use {{Objects.hash}} in many places. Using it consistently will 
> make the code simpler.



--
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