[java] Update rule NonCaseLabelInSwitchStatement

This commit is contained in:
Andreas Dangel
2021-10-01 18:50:33 +02:00
parent 4b112e8a88
commit 5828168934
4 changed files with 4 additions and 4 deletions

View File

@ -237,7 +237,7 @@
<rule ref="category/java/errorprone.xml/MissingSerialVersionUID"/>
<!-- <rule ref="category/java/errorprone.xml/MissingStaticMethodInNonInstantiatableClass"/> -->
<!-- <rule ref="category/java/errorprone.xml/MoreThanOneLogger"/> -->
<!-- <rule ref="category/java/errorprone.xml/NonCaseLabelInSwitchStatement"/> -->
<rule ref="category/java/errorprone.xml/NonCaseLabelInSwitchStatement"/>
<rule ref="category/java/errorprone.xml/NonStaticInitializer"/>
<!-- <rule ref="category/java/errorprone.xml/NullAssignment"/> -->
<!-- <rule ref="category/java/errorprone.xml/OverrideBothEqualsAndHashcode"/> -->

View File

@ -2428,12 +2428,12 @@ public class Foo {
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_errorprone.html#noncaselabelinswitchstatement">
<description>
A non-case label (e.g. a named break/continue label) was present in a switch statement.
This legal, but confusing. It is easy to mix up the case labels and the non-case labels.
This is legal, but confusing. It is easy to mix up the case labels and the non-case labels.
</description>
<priority>3</priority>
<properties>
<property name="xpath">
<value>//SwitchStatement//BlockStatement/Statement/LabeledStatement</value>
<value>//SwitchStatement//LabeledStatement</value>
</property>
</properties>
<example>

View File

@ -6,7 +6,6 @@ package net.sourceforge.pmd.lang.java.rule.errorprone;
import net.sourceforge.pmd.testframework.PmdRuleTst;
@org.junit.Ignore("Rule has not been updated yet")
public class NonCaseLabelInSwitchStatementTest extends PmdRuleTst {
// no additional unit tests
}

View File

@ -7,6 +7,7 @@
<test-code>
<description>label inside switch</description>
<expected-problems>1</expected-problems>
<expected-linenumbers>6</expected-linenumbers>
<code><![CDATA[
public class Foo {
void bar(int x) {