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

@@ -150,7 +150,7 @@ public class PostReviewers implements RestModifyView<ChangeResource, AddReviewer
}
private PostResult putAccount(ReviewerResource rsrc) throws OrmException,
EmailException, IOException {
IOException {
Account.Id id = rsrc.getUser().getAccountId();
ChangeControl control = rsrc.getControl().forUser(
identifiedUserFactory.create(id));
@@ -161,7 +161,7 @@ public class PostReviewers implements RestModifyView<ChangeResource, AddReviewer
private PostResult putGroup(ChangeResource rsrc, AddReviewerInput input)
throws BadRequestException,
UnprocessableEntityException, OrmException, EmailException, IOException {
UnprocessableEntityException, OrmException, IOException {
GroupDescription.Basic group = groupsCollection.parseInternal(input.reviewer);
PostResult result = new PostResult();
if (!isLegalReviewerGroup(group.getGroupUUID())) {
@@ -222,7 +222,7 @@ public class PostReviewers implements RestModifyView<ChangeResource, AddReviewer
private void addReviewers(ChangeResource rsrc, PostResult result,
Map<Account.Id, ChangeControl> reviewers)
throws OrmException, EmailException, IOException {
throws OrmException, IOException {
ReviewDb db = dbProvider.get();
ChangeUpdate update = updateFactory.create(rsrc.getControl());
List<PatchSetApproval> added;
@@ -260,8 +260,7 @@ public class PostReviewers implements RestModifyView<ChangeResource, AddReviewer
}
}
private void emailReviewers(Change change, List<PatchSetApproval> added)
throws OrmException, EmailException {
private void emailReviewers(Change change, List<PatchSetApproval> added) {
if (added.isEmpty()) {
return;
}