Skip to content

Commit 044b8ec

Browse files
runningcodeclaude
andcommitted
ref(core): Remove unnecessary boxing (JAVA-554)
Replace Integer.valueOf/Double.valueOf boxing with primitives or the appropriate parse method. String.format takes the primitives directly, the double conversions only need a cast, and the version check parses straight to a primitive double via Double.parseDouble. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 43baf95 commit 044b8ec

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

‎sentry/src/main/java/io/sentry/CircularFifoQueue.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,7 @@ public boolean add(final @NotNull E element) {
258258
if (index < 0 || index >= sz) {
259259
throw new NoSuchElementException(
260260
String.format(
261-
"The specified index (%1$d) is outside the available range [0, %2$d)",
262-
Integer.valueOf(index), Integer.valueOf(sz)));
261+
"The specified index (%1$d) is outside the available range [0, %2$d)", index, sz));
263262
}
264263

265264
final int idx = (start + index) % maxElements;

‎sentry/src/main/java/io/sentry/DateUtils.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public static double nanosToMillis(final double nanos) {
115115
* @return date rounded down to milliseconds
116116
*/
117117
public static Date nanosToDate(final long nanos) {
118-
final Double millis = nanosToMillis(Double.valueOf(nanos));
118+
final Double millis = nanosToMillis((double) nanos);
119119
return getDateTime(millis.longValue());
120120
}
121121

@@ -137,7 +137,7 @@ public static Date nanosToDate(final long nanos) {
137137
* @return seconds
138138
*/
139139
public static double nanosToSeconds(final long nanos) {
140-
return Double.valueOf(nanos) / (1000.0 * 1000.0 * 1000.0);
140+
return (double) nanos / (1000.0 * 1000.0 * 1000.0);
141141
}
142142

143143
/**

‎sentry/src/main/java/io/sentry/util/Platform.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public final class Platform {
2323
try {
2424
final @Nullable String javaStringVersion = System.getProperty("java.specification.version");
2525
if (javaStringVersion != null) {
26-
final @NotNull double javaVersion = Double.valueOf(javaStringVersion);
26+
final @NotNull double javaVersion = Double.parseDouble(javaStringVersion);
2727
isJavaNinePlus = javaVersion >= 9.0;
2828
} else {
2929
isJavaNinePlus = false;

0 commit comments

Comments
 (0)