Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert nine variable assignments to the usage of compound operators #559

Open
elfring opened this issue Dec 12, 2021 · 0 comments
Open

Comments

@elfring
Copy link

elfring commented Dec 12, 2021

馃憖 Some source code analysis tools can help to find opportunities for improving software components.
馃挱 I propose to increase the usage of compound operators accordingly.

diff --git a/structr-core/src/main/java/org/structr/core/property/IntegerSumProperty.java b/structr-core/src/main/java/org/structr/core/property/IntegerSumProperty.java
index b5a1029783..7ca529f4c4 100644
--- a/structr-core/src/main/java/org/structr/core/property/IntegerSumProperty.java
+++ b/structr-core/src/main/java/org/structr/core/property/IntegerSumProperty.java
@@ -72,7 +72,7 @@ public class IntegerSumProperty extends AbstractReadOnlyProperty<Integer> {
 
 			if (value != null) {
 
-				sum = sum + value.intValue();
+				sum += value.intValue();
 			}
 		}
 
diff --git a/structr-core/src/main/java/org/structr/schema/SchemaHelper.java b/structr-core/src/main/java/org/structr/schema/SchemaHelper.java
index a61776a669..458d8c243c 100644
--- a/structr-core/src/main/java/org/structr/schema/SchemaHelper.java
+++ b/structr-core/src/main/java/org/structr/schema/SchemaHelper.java
@@ -897,7 +897,7 @@ public class SchemaHelper {
 				if (propertyNames.contains(propertyName)) {
 
 					while (propertyNames.contains(propertyName)) {
-						propertyName = propertyName + count++;
+						propertyName += count++;
 					}
 
 					logger.warn("Property name {} already present in type {}, renaming to {}", oldName, entity.getClassName(), propertyName);
diff --git a/structr-rest/src/main/java/org/structr/rest/maintenance/SnapshotCommand.java b/structr-rest/src/main/java/org/structr/rest/maintenance/SnapshotCommand.java
index de96cee14c..a9f0efaf34 100644
--- a/structr-rest/src/main/java/org/structr/rest/maintenance/SnapshotCommand.java
+++ b/structr-rest/src/main/java/org/structr/rest/maintenance/SnapshotCommand.java
@@ -279,7 +279,7 @@ public class SnapshotCommand extends NodeServiceCommand implements MaintenanceCo
 
 		// append JSON extension
 		if (!fileName.endsWith(".json")) {
-			fileName = fileName + ".json";
+			fileName += ".json";
 		}
 
 		// create
diff --git a/structr-rest/src/main/java/org/structr/rest/resource/LogResource.java b/structr-rest/src/main/java/org/structr/rest/resource/LogResource.java
index 0f14cd3c0f..27ac819890 100644
--- a/structr-rest/src/main/java/org/structr/rest/resource/LogResource.java
+++ b/structr-rest/src/main/java/org/structr/rest/resource/LogResource.java
@@ -693,7 +693,7 @@ public class LogResource extends Resource {
 			if (count == null) {
 				count = 1;
 			} else {
-				count = count + 1;
+				count += 1;
 			}
 			obj.put(totalProperty.jsonName(), count);
 
@@ -710,7 +710,7 @@ public class LogResource extends Resource {
 					if (c == null) {
 						c = multiplier;
 					} else {
-						c = c + multiplier;
+						c += multiplier;
 					}
 
 					obj.put(key, c);
@@ -743,7 +743,7 @@ public class LogResource extends Resource {
 			if (count == null) {
 				count = 1;
 			} else {
-				count = count + 1;
+				count += 1;
 			}
 			obj.put(totalProperty.jsonName(), count);
 
@@ -759,7 +759,7 @@ public class LogResource extends Resource {
 				if (c == null) {
 					c = multiplier;
 				} else {
-					c = c + multiplier;
+					c += multiplier;
 				}
 
 				obj.put(key, c);
diff --git a/structr-ui/src/main/java/org/structr/web/auth/UiAuthenticator.java b/structr-ui/src/main/java/org/structr/web/auth/UiAuthenticator.java
index db3465998f..bda1d825dc 100644
--- a/structr-ui/src/main/java/org/structr/web/auth/UiAuthenticator.java
+++ b/structr-ui/src/main/java/org/structr/web/auth/UiAuthenticator.java
@@ -243,7 +243,7 @@ public class UiAuthenticator implements Authenticator {
 				if (securityContext.isReadable(grant, false, false)) {
 
 					grantsFound++;
-					combinedFlags = combinedFlags | grant.getFlags();
+					combinedFlags |= grant.getFlags();
 				}
 			}
 		}
diff --git a/structr-ui/src/main/java/org/structr/web/entity/MinifiedCssFile.java b/structr-ui/src/main/java/org/structr/web/entity/MinifiedCssFile.java
index 57892abebb..b6063265c7 100644
--- a/structr-ui/src/main/java/org/structr/web/entity/MinifiedCssFile.java
+++ b/structr-ui/src/main/java/org/structr/web/entity/MinifiedCssFile.java
@@ -272,7 +272,7 @@ public interface MinifiedCssFile extends AbstractMinifiedFile {
 				if (token.endsWith("\\")) {
 					preservedTokens.add("\\");
 					css = css.replace(placeholder,  "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.size() - 1) + "___");
-					i = i + 1; // attn: advancing the loop
+					i += 1; // attn: advancing the loop
 					preservedTokens.add("");
 					css = css.replace("___YUICSSMIN_PRESERVE_CANDIDATE_COMMENT_" + i + "___",  "___YUICSSMIN_PRESERVED_TOKEN_" + (preservedTokens.size() - 1) + "___");
 					continue;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant