From 5ad6da86f166e2a9fa3793d8b8c4a4dcae605f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Kr=C3=BCger?= Date: Mon, 7 Mar 2022 13:11:23 +0100 Subject: [PATCH] Use Boolean constant values directly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- app/src/main/java/com/nextcloud/talk/utils/PushUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/nextcloud/talk/utils/PushUtils.java b/app/src/main/java/com/nextcloud/talk/utils/PushUtils.java index 03b273d00..4010ba9c4 100644 --- a/app/src/main/java/com/nextcloud/talk/utils/PushUtils.java +++ b/app/src/main/java/com/nextcloud/talk/utils/PushUtils.java @@ -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,