I20210428-1800
tagged this
28 Apr 16:26
Replace Boolean wrapper object by boolean 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:
Boolean shouldBeAPrimitiveBoolean = Boolean.TRUE;
aBoolean &= shouldBeAPrimitiveBoolean;
anotherBoolean |= shouldBeAPrimitiveBoolean;
yetAnotherBoolean ^= shouldBeAPrimitiveBoolean;
When:
Applying "Primitive rather than wrapper" clean up...
Then:
boolean shouldBeAPrimitiveBoolean = Boolean.TRUE;
aBoolean &= shouldBeAPrimitiveBoolean;
anotherBoolean |= shouldBeAPrimitiveBoolean;
yetAnotherBoolean ^= shouldBeAPrimitiveBoolean;
Also merge code
Change-Id: I418f5d0cffcd165c7fed7497516101546f6ad63f
Signed-off-by: Fabrice Tiercelin <fabrice.tiercelin@yahoo.fr>
Reviewed-on: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/179803
Reviewed-by: Jörg Kubitz <jkubitz-eclipse@gmx.de>
Tested-by: JDT Bot <jdt-bot@eclipse.org>