Fix PMD dogfood: UnusedPrivateField

Refs #361
This commit is contained in:
Andreas Dangel
2018-02-11 10:59:18 +01:00
parent e9abdf7a92
commit 4ace14899c
10 changed files with 17 additions and 33 deletions

View File

@ -29,7 +29,6 @@ A rule for the politically correct... we don't want to offend anyone.
|----|-------------|-----------|
|disallowedTerms|[idiot, jerk]|Illegal terms or phrases|
|caseSensitive|false|Case sensitive|
|wordsAreRegex|false|Use regular expressions|
**Use this rule by referencing it:**
``` xml

View File

@ -12,10 +12,12 @@ This is a bug fixing release.
### Table Of Contents
* [New and noteworthy](#new-and-noteworthy)
* [Fixed Issues](#fixed-issues)
* [API Changes](#api-changes)
* [External Contributions](#external-contributions)
* [New and noteworthy](#new-and-noteworthy)
* [Fixed Issues](#fixed-issues)
* [Ecmascript (JavaScript)](#ecmascript-javascript)
* [Modified Rules](#modified-rules)
* [API Changes](#api-changes)
* [External Contributions](#external-contributions)
### New and noteworthy
@ -29,6 +31,11 @@ Detailed changes for changed in Rhino can be found:
Both are bugfixing releases.
#### Modified Rules
* The rule "CommentContentRule" (java-documentation) previously had the property `wordsAreRegex`. But this
property never had been implemented and is removed now.
### Fixed Issues
* all

View File

@ -28,15 +28,10 @@ public class ApexParser {
protected final ApexParserOptions parserOptions;
private Map<Integer, String> suppressMap;
private String suppressMarker = "NOPMD";
public ApexParser(ApexParserOptions parserOptions) {
ApexJorjeLogging.disableLogging();
this.parserOptions = parserOptions;
if (parserOptions.getSuppressMarker() != null) {
suppressMarker = parserOptions.getSuppressMarker();
}
}
public Compilation parseApex(final String sourceCode) throws ParseException {

View File

@ -24,8 +24,6 @@ public abstract class MemberNode<S extends MemberNode<S, T>, T extends Member>
private List<MemberNode> users;
private Object decoration;
public MemberNode(ClassNode classNode, String name, String desc) {
this.classNode = classNode;
this.name = name;

View File

@ -68,7 +68,6 @@ public final class JavaQualifiedName implements QualifiedName {
private static final int PACKAGES_GROUP_INDEX = 1;
private static final int CLASSES_GROUP_INDEX = 3;
private static final int OPERATION_GROUP_INDEX = 7;
private static final int PARAMETERS_GROUP_INDEX = 9;
/** Local index value for when the class is not local. */

View File

@ -31,16 +31,12 @@ import net.sourceforge.pmd.properties.StringMultiProperty;
public class CommentContentRule extends AbstractCommentRule {
private boolean caseSensitive;
private boolean wordsAreRegex;
private List<String> originalBadWords;
private List<String> currentBadWords;
// FIXME need some better defaults (or none?)
private static final String[] BAD_WORDS = {"idiot", "jerk" };
public static final BooleanProperty WORDS_ARE_REGEX_DESCRIPTOR = new BooleanProperty("wordsAreRegex",
"Use regular expressions", false, 1.0f);
// ignored when property above == True
public static final BooleanProperty CASE_SENSITIVE_DESCRIPTOR = new BooleanProperty("caseSensitive",
"Case sensitive", false, 2.0f);
@ -56,7 +52,6 @@ public class CommentContentRule extends AbstractCommentRule {
}
public CommentContentRule() {
definePropertyDescriptor(WORDS_ARE_REGEX_DESCRIPTOR);
definePropertyDescriptor(CASE_SENSITIVE_DESCRIPTOR);
definePropertyDescriptor(DISSALLOWED_TERMS_DESCRIPTOR);
}
@ -66,7 +61,6 @@ public class CommentContentRule extends AbstractCommentRule {
*/
@Override
public void start(RuleContext ctx) {
wordsAreRegex = getProperty(WORDS_ARE_REGEX_DESCRIPTOR);
originalBadWords = getProperty(DISSALLOWED_TERMS_DESCRIPTOR);
caseSensitive = getProperty(CASE_SENSITIVE_DESCRIPTOR);
if (caseSensitive) {
@ -79,12 +73,6 @@ public class CommentContentRule extends AbstractCommentRule {
}
}
@Override
public Set<PropertyDescriptor<?>> ignoredProperties() {
return getProperty(WORDS_ARE_REGEX_DESCRIPTOR) ? NON_REGEX_PROPERTIES
: Collections.<PropertyDescriptor<?>>emptySet();
}
/**
* .
* @see Rule#end(RuleContext)

View File

@ -53,10 +53,10 @@ public class Designer extends Application {
DesignerRoot owner = new DesignerRoot(stage);
MainDesignerController mainController = new MainDesignerController(owner);
NodeInfoPanelController nodeInfoPanelController = new NodeInfoPanelController(owner, mainController);
NodeInfoPanelController nodeInfoPanelController = new NodeInfoPanelController(mainController);
XPathPanelController xpathPanelController = new XPathPanelController(owner, mainController);
SourceEditorController sourceEditorController = new SourceEditorController(owner, mainController);
EventLogController eventLogController = new EventLogController(owner, mainController);
EventLogController eventLogController = new EventLogController(owner);
loader.setControllerFactory(type -> {
if (type == MainDesignerController.class) {

View File

@ -31,7 +31,6 @@ import javafx.scene.control.cell.PropertyValueFactory;
public class EventLogController implements Initializable {
private final DesignerRoot designerRoot;
private final MainDesignerController parent;
@FXML
private TableView<LogEntry> eventLogTableView;
@ -45,9 +44,8 @@ public class EventLogController implements Initializable {
private TextArea logDetailsTextArea;
public EventLogController(DesignerRoot owner, MainDesignerController mainController) {
public EventLogController(DesignerRoot owner) {
this.designerRoot = owner;
parent = mainController;
}

View File

@ -66,6 +66,7 @@ import javafx.util.Duration;
* @see XPathPanelController
* @since 6.0.0
*/
@SuppressWarnings("PMD.UnusedPrivateField")
public class MainDesignerController implements Initializable, SettingsOwner {
/**

View File

@ -39,9 +39,9 @@ import javafx.scene.control.TreeView;
* @author Clément Fournier
* @since 6.0.0
*/
@SuppressWarnings("PMD.UnusedPrivateField")
public class NodeInfoPanelController implements Initializable {
private final DesignerRoot designerRoot;
private final MainDesignerController parent;
@FXML
@ -61,8 +61,7 @@ public class NodeInfoPanelController implements Initializable {
private MetricEvaluator metricEvaluator = new MetricEvaluator();
public NodeInfoPanelController(DesignerRoot root, MainDesignerController mainController) {
this.designerRoot = root;
public NodeInfoPanelController(MainDesignerController mainController) {
parent = mainController;
}