detected at #19114 (comment)
[ERROR] [checkstyle] [ERROR] /Users/runner/work/1/s/src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java:1100:9: Switch using reference types should have a null case. [MissingNullCaseInSwitch]
[ERROR] [checkstyle] [ERROR] /Users/runner/work/1/s/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsPagesTest.java:1578:9: Switch using reference types should have a null case. [MissingNullCaseInSwitch]
such situations are in Test code, no coverage concern, but they may hide problems of null, we wants to be fail fast here, remaping null to exlicit throw of exception might be a solution, but it is just more code and it will behave kind of same.
private static IntStream getIntStream(Object value) {
return switch (value) {
case Collection<?> collection -> collection.stream()
.mapToInt(int.class::cast);
case BitSet set -> set.stream();
case null -> throw new NulPointerException("value is null");
default -> Arrays.stream((int[]) value);
};
}
detected at #19114 (comment)
[ERROR] [checkstyle] [ERROR] /Users/runner/work/1/s/src/main/java/com/puppycrawl/tools/checkstyle/site/SiteUtil.java:1100:9: Switch using reference types should have a null case. [MissingNullCaseInSwitch][ERROR] [checkstyle] [ERROR] /Users/runner/work/1/s/src/test/java/com/puppycrawl/tools/checkstyle/internal/XdocsPagesTest.java:1578:9: Switch using reference types should have a null case. [MissingNullCaseInSwitch]such situations are in Test code, no coverage concern, but they may hide problems of null, we wants to be fail fast here, remaping null to exlicit throw of exception might be a solution, but it is just more code and it will behave kind of same.