RFC: Enable Eclipse warning about fall-through cases in switch statements
Enable the "'switch' case fall-through" warning in Eclipse to catch unintentional fall-through to the following 'case' block when a 'break' statement is omitted. All warnings raised in the current codebase are caused by intentional fall-throughs, so add "//$FALL-THROUGH$" comments to suppress those warnings. This change was inspired by the coverity report [1] which found the problem in PutConfig (see CID 19880) but interestingly did not report anything for the other ones. RFC because I'm not sure if the "//$FALL-THROUGH$" comments will cause the warnings to be suppressed on subsequent coverity scans. [1] https://scan.coverity.com/projects/4032 Change-Id: Iad003bd7d086c67cccdbfb1312c8bd82d17fcc57
This commit is contained in:
@@ -17,7 +17,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=
|
||||
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
|
||||
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
|
||||
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
|
||||
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||
|
@@ -227,6 +227,7 @@ public class Submit implements RestModifyView<RevisionResource, SubmitInput>,
|
||||
if (msg != null) {
|
||||
throw new ResourceConflictException(msg.getMessage());
|
||||
}
|
||||
//$FALL-THROUGH$
|
||||
default:
|
||||
throw new ResourceConflictException("change is " + status(change));
|
||||
}
|
||||
|
@@ -1733,6 +1733,7 @@ public class ReceiveCommits {
|
||||
addMessage("Change " + c.getChangeId() + ": " + msg.getMessage());
|
||||
break;
|
||||
}
|
||||
//$FALL-THROUGH$
|
||||
default:
|
||||
addMessage("change " + c.getChangeId() + " is "
|
||||
+ c.getStatus().name().toLowerCase());
|
||||
|
@@ -166,6 +166,7 @@ public class CreateBranch implements RestModifyView<ProjectResource, Input> {
|
||||
}
|
||||
refPrefix = getRefPrefix(refPrefix);
|
||||
}
|
||||
//$FALL-THROUGH$
|
||||
default: {
|
||||
throw new IOException(result.name());
|
||||
}
|
||||
|
@@ -253,6 +253,7 @@ public class PutConfig implements RestModifyView<ProjectResource, Input> {
|
||||
"The value '%s' is not permitted for parameter '%s' of plugin '"
|
||||
+ pluginName + "'", value, v.getKey()));
|
||||
}
|
||||
//$FALL-THROUGH$
|
||||
case STRING:
|
||||
cfg.setString(v.getKey(), value);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user