Use Boolean constant values directly

From the SpotBugs report:

> NAB_NEEDLESS_BOOLEAN_CONSTANT_CONVERSION: Method needlessly boxes a boolean
> constant
>
> This method assigns a Boxed boolean constant to a primitive boolean variable,
> or assigns a primitive boolean constant to a Boxed boolean variable. Use the
> correct constant for the variable desired. Use
>
>
> boolean b = true;
> boolean b = false;
>
> or
>
>
> Boolean b = Boolean.TRUE;
> Boolean b = Boolean.FALSE;
>
> Be aware that this boxing happens automatically when you might not expect it.
> For example,
>
>
> Map statusMap = ...
>
> public Boolean someMethod() {
>     statusMap.put("foo", true);  //the "true" here is boxed
>     return false;  //the "false" here is boxed
> }
>
> has two cases of this needless autoboxing. This can be made more efficient by
> simply substituting in the constant values:
>
>
> Map statusMap = ...
>
> public Boolean someMethod() {
>     statusMap.put("foo", Boolean.TRUE);
>     return Boolean.FALSE;
> }

Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
Tim Krüger 2022-03-07 13:11:23 +01:00
parent 8e11f21233
commit 5ad6da86f1
No known key found for this signature in database
GPG Key ID: FECE3A7222C52A4E

View File

@ -331,7 +331,7 @@ public class PushUtils {
pushConfigurationState.setDeviceIdentifier(proxyMap.get("deviceIdentifier"));
pushConfigurationState.setDeviceIdentifierSignature(proxyMap.get("deviceIdentifierSignature"));
pushConfigurationState.setUserPublicKey(proxyMap.get("userPublicKey"));
pushConfigurationState.setUsesRegularPass(false);
pushConfigurationState.setUsesRegularPass(Boolean.FALSE);
userUtils.createOrUpdateUser(null,
null,