[java] TooFewBranchesForSwitch - add test case from comment on #5311
This commit is contained in:
parent
16eafc89c2
commit
ee7d6fed3e
@ -178,6 +178,26 @@ class Tester {
|
||||
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>
|
||||
</test-code>
|
||||
</test-data>
|
||||
|
Loading…
x
Reference in New Issue
Block a user