Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update to pmd 7 #177

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
*.class
/.idea/
/.tmp/
*.jar
*.jar
/.mvn/
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<sonar.version>3.4.0.905</sonar.version>
<commons-logging.version>1.2</commons-logging.version>
<!-- General dependencies -->
<pmd.rules.version>6.55.0</pmd.rules.version>
<pmd.rules.version>7.5.0</pmd.rules.version>
<!-- Testing -->
<hamcrest.version>2.2</hamcrest.version>
<cactoos-matchers.version>0.25</cactoos-matchers.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
package io.github.dgroup.arch4u.pmd;

import java.util.List;

import net.sourceforge.pmd.lang.java.ast.ASTType;
import net.sourceforge.pmd.lang.java.ast.ASTVariableDeclaratorId;
import net.sourceforge.pmd.lang.java.ast.ASTVariableId;
import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule;
import net.sourceforge.pmd.lang.java.rule.AbstractPoorMethodCall;
import net.sourceforge.pmd.lang.java.symboltable.JavaNameOccurrence;
import net.sourceforge.pmd.lang.java.types.TypeTestUtil;
import net.sourceforge.pmd.lang.symboltable.NameOccurrence;
Expand Down Expand Up @@ -85,7 +85,7 @@ public AvoidProhibitedMethodsUsage() {
}

@Override
public Object visit(final ASTVariableDeclaratorId node, final Object data) {
public Object visit(final ASTVariableId node, final Object data) {
if (this.hasNotedClass(node)) {
for (final NameOccurrence usage : node.getUsages()) {
final JavaNameOccurrence occurrence = (JavaNameOccurrence) usage;
Expand All @@ -106,7 +106,7 @@ public Object visit(final ASTVariableDeclaratorId node, final Object data) {
* @param node Variable declarator node.
* @return True if the node class is specified.
*/
private boolean hasNotedClass(final ASTVariableDeclaratorId node) {
private boolean hasNotedClass(final ASTVariableId node) {
final boolean noted;
final String typename = this.getProperty(CLASS);
final ASTType typenode = node.getTypeNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Optional;

import net.sourceforge.pmd.lang.ast.AbstractNode;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.java.ast.ASTArgumentList;
Expand All @@ -37,11 +38,11 @@
import net.sourceforge.pmd.lang.java.ast.ASTPrimaryPrefix;
import net.sourceforge.pmd.lang.java.ast.ASTPrimarySuffix;
import net.sourceforge.pmd.lang.java.ast.ASTType;
import net.sourceforge.pmd.lang.java.ast.ASTVariableDeclaratorId;
import net.sourceforge.pmd.lang.java.ast.ASTVariableId;
import net.sourceforge.pmd.lang.java.ast.TypeNode;
import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule;
import net.sourceforge.pmd.lang.java.rule.xpath.internal.TypeIsFunction;
import net.sourceforge.pmd.lang.java.symboltable.JavaNameOccurrence;
import net.sourceforge.pmd.lang.java.xpath.TypeIsFunction;
import net.sourceforge.pmd.lang.symboltable.NameOccurrence;
import net.sourceforge.pmd.properties.PropertyDescriptor;
import net.sourceforge.pmd.properties.PropertyFactory;
Expand Down Expand Up @@ -99,7 +100,7 @@ public ObfuscationRequired() {
}

@Override
public Object visit(final ASTVariableDeclaratorId vardecl, final Object data) {
public Object visit(final ASTVariableId vardecl, final Object data) {
if (this.isLogger(vardecl.getTypeNode())) {
for (final NameOccurrence usage : vardecl.getUsages()) {
final JavaNameOccurrence occurrence = (JavaNameOccurrence) usage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@
package io.github.dgroup.arch4u.pmd;

import java.util.regex.Pattern;
import net.sourceforge.pmd.RuleContext;

import net.sourceforge.pmd.lang.java.ast.ASTLiteral;
import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule;
import net.sourceforge.pmd.properties.PropertyDescriptor;
import net.sourceforge.pmd.properties.PropertyFactory;
import net.sourceforge.pmd.reporting.RuleContext;
import org.apache.commons.lang3.StringUtils;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@

package io.github.dgroup.arch4u.pmd;

import static net.sourceforge.pmd.lang.java.ast.JModifier.PUBLIC;

import java.util.List;

import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration;
import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule;
import net.sourceforge.pmd.properties.PropertyDescriptor;
Expand Down Expand Up @@ -82,6 +85,6 @@ private boolean isRestMethod(final ASTMethodDeclaration mthd) {
* @return True if the method has prohibited signature.
*/
private static boolean hasWrongSignature(final ASTMethodDeclaration mthd) {
return !mthd.isAnnotationPresent("java.lang.Override") || !mthd.isPublic();
return !mthd.isAnnotationPresent("java.lang.Override") || !mthd.hasModifiers(PUBLIC);
}
}
Loading
Loading