HBASE-20707 Move MissingSwitchDefault case check

Perform this check using error-prone instead of checkstyle because the
former can handle enum switches somewhat more intelligently.
This commit is contained in:
Mike Drob 2018-06-08 16:57:15 -05:00
parent 6befdc43ba
commit 4b0bbd839e
7 changed files with 11 additions and 3 deletions

View File

@ -84,6 +84,7 @@
<arg>-XepDisableWarningsInGeneratedCode</arg>
<arg>-Xep:FallThrough:OFF</arg> <!-- already in findbugs -->
<arg>-Xep:ClassNewInstance:ERROR</arg>
<arg>-Xep:MissingDefault:ERROR</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>

View File

@ -60,7 +60,6 @@
<module name="EqualsHashCode"/>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MissingSwitchDefault"/>
<module name="NoFinalizer"/>
<!-- Import Checks

View File

@ -101,7 +101,7 @@ public class JenkinsHash extends Hash {
* <p>Use for hash table lookup, or anything where one collision in 2^^32 is
* acceptable. Do NOT use for cryptographic purposes.
*/
@SuppressWarnings("fallthrough")
@SuppressWarnings({"fallthrough", "MissingDefault"})
@Override
public <T> int hash(HashKey<T> hashKey, int initval) {
int length = hashKey.length();

View File

@ -78,6 +78,8 @@ public class MurmurHash3 extends Hash {
k1 = (k1 << 15) | (k1 >>> 17); // ROTL32(k1,15);
k1 *= c2;
h1 ^= k1;
default:
// fall out
}
// finalization

View File

@ -306,7 +306,8 @@ public class ExpressionParser {
return Operator.OR;
case NOT:
return Operator.NOT;
default:
return null;
}
return null;
}
}

View File

@ -62,6 +62,7 @@ public class TestClusterStatusPublisher {
@Test
public void testMaxSend() {
ClusterStatusPublisher csp = new ClusterStatusPublisher() {
@SuppressWarnings("MissingDefault")
@Override
protected List<Pair<ServerName, Long>> getDeadServers(long since) {
List<Pair<ServerName, Long>> res = new ArrayList<>();

View File

@ -765,6 +765,8 @@ public class TestAssignmentManager {
case 0: throw new ServerNotRunningYetException("wait on server startup");
case 1: throw new SocketTimeoutException("simulate socket timeout");
case 2: throw new RemoteException("java.io.IOException", "unexpected exception");
default:
// fall out
}
return super.sendRequest(server, req);
}
@ -785,6 +787,8 @@ public class TestAssignmentManager {
LOG.info("Return transition report that FAILED_OPEN/FAILED_OPENING response");
sendTransitionReport(server, openReq.getRegion(), TransitionCode.FAILED_OPEN);
return OpenRegionResponse.RegionOpeningState.FAILED_OPENING;
default:
// fall out
}
// The procedure on master will just hang forever because nothing comes back
// from the RS in this case.