Skip to content

chore/java: Replace deprecated primitive-wrapper constructors with valueOf - #14

Closed
trly wants to merge 1 commit into
mainfrom
fix-wrapper-constructors-16mv5l6mNFkk
Closed

trly wants to merge 1 commit into
mainfrom
fix-wrapper-constructors-16mv5l6mNFkk

Conversation

@trly

@trly trly commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

The primitive-wrapper constructors (new Integer(...), new Double(...), etc.) are deprecated for removal and flagged by SonarQube (java:S2129, java:S5738). They always allocate a new object, whereas the valueOf factories can reuse cached instances.

This replaces each wrapper constructor call with the equivalent static valueOf factory (for example new Double(19.99) becomes Double.valueOf(19.99)). Behavior is unchanged apart from instance identity, which this code does not rely on.

Created by a Sourcegraph agentic batch change.

…lueOf

Resolves SonarQube java:S2129 and java:S5738 by using the static valueOf factories instead of the constructors deprecated for removal.

Sourcegraph-Batch-Change: https://sourcegraph.sourcegraph.com/batch-change-agents/1203
@trly trly closed this Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant