Fix Eclipse warnings
- Statement unnecessarily nested in 'else' clause
- Missing @Override annotations
- Unnecessary 'unused' warning suppression
Change-Id: I388909d5eb517a0d657e1e5dc26f64800bd46caf
diff --git a/src/main/java/com/googlesource/gerrit/plugins/manager/GerritVersionBranch.java b/src/main/java/com/googlesource/gerrit/plugins/manager/GerritVersionBranch.java
index 75256b2..faca388 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/manager/GerritVersionBranch.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/manager/GerritVersionBranch.java
@@ -22,21 +22,20 @@
|| !Character.isDigit(gerritVersion.trim().charAt(0))
|| gerritVersion.startsWith(GERRIT_NEXT_VERSION)) {
return "master";
- } else {
- String[] versionNumbers = gerritVersion.split("\\.");
+ }
+ String[] versionNumbers = gerritVersion.split("\\.");
- if (versionNumbers.length > 2) {
- String fixVersionNumber = versionNumbers[2];
- if (fixVersionNumber.contains("-")) {
- String nextVersion =
- String.format("%s.%d", versionNumbers[0],
- Integer.parseInt(versionNumbers[1]) + 1);
- if (nextVersion.equals(GERRIT_NEXT_VERSION)) {
- return "master";
- }
+ if (versionNumbers.length > 2) {
+ String fixVersionNumber = versionNumbers[2];
+ if (fixVersionNumber.contains("-")) {
+ String nextVersion =
+ String.format("%s.%d", versionNumbers[0],
+ Integer.parseInt(versionNumbers[1]) + 1);
+ if (nextVersion.equals(GERRIT_NEXT_VERSION)) {
+ return "master";
}
}
- return "stable-" + versionNumbers[0] + "." + versionNumbers[1];
}
+ return "stable-" + versionNumbers[0] + "." + versionNumbers[1];
}
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/manager/TokenReplaceOutputStream.java b/src/main/java/com/googlesource/gerrit/plugins/manager/TokenReplaceOutputStream.java
index 2c5976b..4eb643b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/manager/TokenReplaceOutputStream.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/manager/TokenReplaceOutputStream.java
@@ -97,9 +97,11 @@
flush();
}
- public void setWriteListener(@SuppressWarnings("unused") WriteListener writeListener) {
+ @Override
+ public void setWriteListener(WriteListener writeListener) {
}
+ @Override
public boolean isReady() {
return true;
}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/manager/gson/SmartJson.java b/src/main/java/com/googlesource/gerrit/plugins/manager/gson/SmartJson.java
index 7766796..ff0b96b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/manager/gson/SmartJson.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/manager/gson/SmartJson.java
@@ -51,9 +51,8 @@
if (jsonElem != null && jsonElem.getAsJsonObject().get(fieldName) != null) {
return Optional.of(SmartJson
.of(jsonElem.getAsJsonObject().get(fieldName)));
- } else {
- return Optional.absent();
}
+ return Optional.absent();
}
public SmartJson get(String fieldName) {