Skip to content

I20210501-1800

tagged this 01 May 18:19
Replace Byte wrapper object by byte 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:
        Byte alwaysInitializedVar = Byte.MIN_VALUE;
        if (alwaysInitializedVar == 0) {
            System.out.println("Zero!");
        }

When:
Applying "Primitive rather than wrapper" clean up...

Then:
        byte alwaysInitializedVar = Byte.MIN_VALUE;
        if (alwaysInitializedVar == 0) {
            System.out.println("Zero!");
        }

Change-Id: Ic9a426779a70654c679854292bbfd92041109f6f
Signed-off-by: Fabrice Tiercelin <fabrice.tiercelin@yahoo.fr>
Reviewed-on: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/180083
Tested-by: JDT Bot <jdt-bot@eclipse.org>
Reviewed-by: Jörg Kubitz <jkubitz-eclipse@gmx.de>
Assets 2
Loading