You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Justin Bertram (Jira)" <ji...@apache.org> on 2024/04/22 19:57:00 UTC
[jira] [Commented] (ARTEMIS-4735) BOXED PRIMITIVE FOR PARSING in ActiveMQConnectionMetaData.java
[ https://issues.apache.org/jira/browse/ARTEMIS-4735?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17839833#comment-17839833 ]
Justin Bertram commented on ARTEMIS-4735:
-----------------------------------------
There is unnecessary boxing in many places across the code-base so I opened ARTEMIS-4740 to deal with them all rather than just this individual one.
> BOXED PRIMITIVE FOR PARSING in ActiveMQConnectionMetaData.java
> --------------------------------------------------------------
>
> Key: ARTEMIS-4735
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4735
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Galkin Alexey
> Assignee: Justin Bertram
> Priority: Minor
>
> [On line 48|https://github.com/apache/activemq-artemis/blob/main/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionMetaData.java](JMS_MAJOR_VERSION = Integer.valueOf(versionProps.getProperty("activemq.version.implementation.majorVersion", "2")), a truly boxed primitive is created from a string simply to extract the value of the unboxed primitive. This approach is inefficient and can lead to code redundancy and loss of performance.
> A more efficient approach would be to immediately convert strings to primitive values without creating boxed primitives. For example, use the Integer.parseInt() method to directly convert a string to an int without creating an Integer object.
>
> Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.
> Author Alexey Galkin.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)