I20210416-1800
tagged this
16 Apr 17:54
Replace Long wrapper object by long primitive type when an object is not
necessary:
- The variable must be not null,
- The result should not make more autoboxing/unboxing than the original
code.
Given:
Long shouldBeAPrimitiveLong = Long.MIN_VALUE;
aLong &= shouldBeAPrimitiveLong;
anotherLong += shouldBeAPrimitiveLong;
yetAnotherLong ^= shouldBeAPrimitiveLong;
When:
Applying "Primitive rather than wrapper" clean up...
Then:
long shouldBeAPrimitiveLong = Long.MIN_VALUE;
aLong &= shouldBeAPrimitiveLong;
anotherLong += shouldBeAPrimitiveLong;
yetAnotherLong ^= shouldBeAPrimitiveLong;
Also add tests for int primitives.
Change-Id: I63971c8154d4b1a2baa50704147d000e44882b11
Signed-off-by: Fabrice Tiercelin <fabrice.tiercelin@yahoo.fr>
Reviewed-on: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/179166