Eclipse: Warn on incomplete switch cases even when default exists

We already have the warning "Incomplete 'switch' cases on enum" enabled,
but it does not warn when a case is missing if the switch has a default
block.

Enable the "Signal even if 'default' case exists" option. This would
have enabled us to catch the problem that was fixed in Ied8ff0f8f.

In most instances of the warning we can simply add the missing case(s)
above the 'default', meaning there is no change in behaviour.

However there are some instances where the missing case is a bug and
should be handled correctly. These are fixed separately in follow-up
commits.

Change-Id: I3675d29981423043266a26b1a78932c5708a6272
This commit is contained in:
David Pursehouse
2016-01-18 17:33:39 +09:00
parent 82be744b7b
commit 0b7517a06e
38 changed files with 191 additions and 3 deletions

View File

@@ -340,6 +340,13 @@ public class PublicKeyStore implements AutoCloseable {
toAdd.clear();
toRemove.clear();
break;
case FORCED:
case IO_FAILURE:
case LOCK_FAILURE:
case NOT_ATTEMPTED:
case REJECTED:
case REJECTED_CURRENT_BRANCH:
case RENAMED:
default:
break;
}

View File

@@ -80,6 +80,14 @@ public class DeleteGpgKey implements RestModifyView<GpgKey, Input> {
case NO_CHANGE:
case FAST_FORWARD:
break;
case FORCED:
case IO_FAILURE:
case LOCK_FAILURE:
case NEW:
case NOT_ATTEMPTED:
case REJECTED:
case REJECTED_CURRENT_BRANCH:
case RENAMED:
default:
throw new ResourceConflictException(
"Failed to delete public key: " + saveResult);

View File

@@ -232,6 +232,12 @@ public class PostGpgKeys implements RestModifyView<AccountResource, Input> {
break;
case NO_CHANGE:
break;
case IO_FAILURE:
case LOCK_FAILURE:
case NOT_ATTEMPTED:
case REJECTED:
case REJECTED_CURRENT_BRANCH:
case RENAMED:
default:
// TODO(dborowitz): Backoff and retry on LOCK_FAILURE.
throw new ResourceConflictException(