Turn on many more Eclipse warnings, and fix them

- Warn on empty statements, e.g. "for (;;);". These may be
   typos and are easily replaced by "for (;;) {}" which is more
   explicit.
 - Warn on field hiding. This allows cleanup of many acceptance test
   members, at the cost of a couple of renames and the occasional
   suppression (when the field is in a public nested enum that shadows
   a public constant).
 - Warn on unnecessary casts.
 - Warn on unused declared thrown exceptions. In addition to reducing
   method signature length and number of imports, this also eliminated
   some impossible catch blocks.
 - Warn on missing @Override annotations.
 - Warn on unused parameters. This is likely the most controversial,
   as a few relatively common patterns require unused parameters in a
   way that Eclipse can't ignore. However, it also resulted in cleanup
   of a lot of unnecessary injections and method parameters, so I
   think the cost was worth it.

Change-Id: I7224be8b1c798613a127c88507e8cce400679e5d
This commit is contained in:
Dave Borowitz
2014-10-28 12:09:55 -07:00
parent 2e82f2f8a2
commit 8b42ec5bd5
305 changed files with 932 additions and 699 deletions

View File

@@ -240,7 +240,7 @@ public class Dispatcher {
if (defaultScreenToken != null && !MINE.equals(defaultScreenToken)) {
select(defaultScreenToken);
} else {
Gerrit.display(token, mine(token));
Gerrit.display(token, mine());
}
} else if (matchPrefix("/dashboard/", token)) {
@@ -433,7 +433,7 @@ public class Dispatcher {
Gerrit.display(token, screen);
}
private static Screen mine(final String token) {
private static Screen mine() {
if (Gerrit.isSignedIn()) {
return new AccountDashboardScreen(Gerrit.getUserAccount().getId());
@@ -644,6 +644,7 @@ public class Dispatcher {
private static void publish(final PatchSet.Id ps) {
String token = toPublish(ps);
new AsyncSplit(token) {
@Override
public void onSuccess() {
Gerrit.display(token, select());
}
@@ -670,6 +671,7 @@ public class Dispatcher {
Gerrit.getPatchScreenTopView() : topView;
GWT.runAsync(new AsyncSplit(token) {
@Override
public void onSuccess() {
Gerrit.display(token, select());
}
@@ -743,6 +745,7 @@ public class Dispatcher {
private static void settings(String token) {
GWT.runAsync(new AsyncSplit(token) {
@Override
public void onSuccess() {
Gerrit.display(token, select());
}
@@ -810,6 +813,7 @@ public class Dispatcher {
private static void admin(String token) {
GWT.runAsync(new AsyncSplit(token) {
@Override
public void onSuccess() {
if (matchExact(ADMIN_GROUPS, token)
|| matchExact("/admin/groups", token)) {
@@ -983,6 +987,7 @@ public class Dispatcher {
this.token = token;
}
@Override
public final void onFailure(Throwable reason) {
if (!isReloadUi
&& "HTTP download failed with status 404".equals(reason.getMessage())) {
@@ -999,6 +1004,7 @@ public class Dispatcher {
private static void docSearch(final String token) {
GWT.runAsync(new AsyncSplit(token) {
@Override
public void onSuccess() {
Gerrit.display(token, new DocScreen(skip(token)));
}