Minor cleanups
This commit is contained in:
1 parent
8b279fac25
commit
c96358506b
2 files changed
+21
-28
No files matched your search
+5
-10
@@ -32,17 +32,12 @@ import net.sourceforge.pmd.properties.StringMultiProperty;
|
||||
|
||||
public class UnusedPrivateFieldRule extends AbstractLombokAwareRule {
|
||||
|
||||
private static final List<String> NEGLECT_ANNOTATIONS_DEFAULT = new ArrayList<>();
|
||||
|
||||
static {
|
||||
NEGLECT_ANNOTATIONS_DEFAULT.add("java.lang.Deprecated");
|
||||
NEGLECT_ANNOTATIONS_DEFAULT.add("javafx.fxml.FXML");
|
||||
}
|
||||
|
||||
private static final StringMultiProperty IGNORED_ANNOTATIONS_DESCRIPTOR
|
||||
= StringMultiProperty.named("IgnoredAnnotations")
|
||||
.desc("The annotations should be ignored by rule unusedPrivateFieldRule")
|
||||
.defaultValues(NEGLECT_ANNOTATIONS_DEFAULT).build();
|
||||
= StringMultiProperty.named("ignoredAnnotations")
|
||||
.desc("Fully qualified names of the annotation types that should be ignored by this rule")
|
||||
.defaultValues("java.lang.Deprecated", "javafx.fxml.FXML")
|
||||
.build();
|
||||
|
||||
|
||||
public UnusedPrivateFieldRule() {
|
||||
definePropertyDescriptor(IGNORED_ANNOTATIONS_DESCRIPTOR);
|
||||
|
||||
+16
-18
@@ -544,37 +544,35 @@ public class Foo {
|
||||
<description>#907 UnusedPrivateField false-positive with @FXML</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXML;
|
||||
|
||||
public class NodeInfoPanelController {
|
||||
@FXML
|
||||
private TabPane nodeInfoTabPane;
|
||||
}
|
||||
public class NodeInfoPanelController {
|
||||
@FXML
|
||||
private TabPane nodeInfoTabPane;
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>#907 UnusedPrivateField false-positive with @FXML</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
import java.lang.Deprecated;
|
||||
|
||||
public class Foo {
|
||||
@Deprecated
|
||||
private String bar;
|
||||
}
|
||||
public class Foo {
|
||||
@Deprecated
|
||||
private String bar;
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>#907 UnusedPrivateField false-positive with @FXML</description>
|
||||
<rule-property name="IgnoredAnnotations">"FXML"</rule-property>
|
||||
<rule-property name="ignoredAnnotations">javafx.fxml.FXML</rule-property>
|
||||
<expected-problems>1</expected-problems>
|
||||
<code><![CDATA[
|
||||
import java.lang.Deprecated;
|
||||
|
||||
public class Foo {
|
||||
@Deprecated
|
||||
private String bar;
|
||||
}
|
||||
public class Foo {
|
||||
@Deprecated
|
||||
private String bar;
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
|
||||
Reference in new issue
Block a user