Back to Error Prone

UnnecessaryBoxedAssignment

docs/bugpattern/UnnecessaryBoxedAssignment.md

2.49.0363 B
Original Source

The Java language automatically converts primitive types to their boxed representations in some contexts (see JLS 5.1.7).

That is, prefer this:

java
int x;
Integer y = x;

to the equivalent but more verbose explicit conversion:

java
int x;
Integer y = Integer.valueOf(x);