[java] SwitchStmtsShouldHaveDefault.xml: don't report empty switch
Empty switch statements are already reported by EmptyControlStatement
This commit is contained in:
parent
6c35c73919
commit
662759755d
@ -24,6 +24,8 @@ See [PR #5040](https://github.com/pmd/pmd/pull/5040) for details.
|
||||
### 🌟 Rule Changes
|
||||
|
||||
#### Changed Rules
|
||||
* {% rule java/bestpractices/SwitchStmtsShouldHaveDefault %} (Java Best Practices) doesn't report empty switch statements anymore.
|
||||
To detect these, use {% rule java/codestyle/EmptyControlStatement %}.
|
||||
* {% rule java/bestpractices/UnitTestShouldUseAfterAnnotation %} (Java Best Practices) now also considers JUnit 5 and TestNG tests.
|
||||
* {% rule java/bestpractices/UnitTestShouldUseBeforeAnnotation %} (Java Best Practices) now also considers JUnit 5 and TestNG tests.
|
||||
|
||||
|
@ -19,6 +19,19 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>empty switch is ok</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
void bar() {
|
||||
int x = 2;
|
||||
switch (x) { } // this is ok. The empty switch is detected by EmptyControlStatement
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>simple ok case</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
|
Loading…
x
Reference in New Issue
Block a user