[java] TooFewBranchesForSwitch - add test case from comment on #5311
This commit is contained in:
@@ -178,6 +178,26 @@ class Tester {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
]]></code>
|
||||||
|
</test-code>
|
||||||
|
|
||||||
|
<test-code>
|
||||||
|
<description>From #5311: Another example for list of case constants</description>
|
||||||
|
<expected-problems>0</expected-problems>
|
||||||
|
<code><![CDATA[
|
||||||
|
public class Foo {
|
||||||
|
|
||||||
|
String foo(Bar bar) {
|
||||||
|
return switch (bar) {
|
||||||
|
case A, B, C, D -> "Hello";
|
||||||
|
case E, F, G -> "World";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Bar {
|
||||||
|
A, B, C, D, E, F, G
|
||||||
|
}
|
||||||
|
}
|
||||||
]]></code>
|
]]></code>
|
||||||
</test-code>
|
</test-code>
|
||||||
</test-data>
|
</test-data>
|
||||||
|
Reference in New Issue
Block a user