Example:
static Object handleNullableEnumCaseNullDefaultStatement(@Nullable NullableEnum nullableEnum) {
Object result;
switch (nullableEnum) {
case null -> result = new Object();
default -> result = nullableEnum.toString();
};
return result;
}
NullAway warns of a possible null dereference for the switch, but it should not, as there is a case null. (We currently don't warn on switch expressions as we don't match them yet due to google/error-prone#4119, but similar logic is required there.)
Example:
NullAway warns of a possible null dereference for the switch, but it should not, as there is a
case null. (We currently don't warn on switch expressions as we don't match them yet due to google/error-prone#4119, but similar logic is required there.)