diff --git a/pmd-java/src/main/resources/category/java/codestyle.xml b/pmd-java/src/main/resources/category/java/codestyle.xml
index 57d59a88bd..4de7330e0d 100644
--- a/pmd-java/src/main/resources/category/java/codestyle.xml
+++ b/pmd-java/src/main/resources/category/java/codestyle.xml
@@ -1236,7 +1236,7 @@ Fields, formal arguments, or local variable names that are too long can make the
$minimum]
+//VariableDeclaratorId[string-length(@Name) > $minimum]
]]>
@@ -1704,7 +1704,7 @@ Fields, local variables, or parameter names that are very short are not helpful
- //VariableDeclaratorId[@Image='assert']
+ //VariableDeclaratorId[@Name='assert']
@@ -347,7 +347,7 @@ Use of the term 'enum' will conflict with newer versions of Java since it is a r
- //VariableDeclaratorId[@Image='enum']
+ //VariableDeclaratorId[@Name='enum']
@@ -546,15 +546,15 @@ only add to code size. Either remove the invocation, or use the return result.
@@ -1487,7 +1487,7 @@ or reported.
[FormalParameter/Type/ReferenceType
/ClassOrInterfaceType[@Image != 'InterruptedException' and @Image != 'CloneNotSupportedException']
]
- [FormalParameter/VariableDeclaratorId[not(matches(@Image, $allowExceptionNameRegex))]]
+ [FormalParameter/VariableDeclaratorId[not(matches(@Name, $allowExceptionNameRegex))]]
]]>
@@ -2147,7 +2147,7 @@ Avoid jumbled loop incrementers - its usually a mistake, and is confusing even i
[
ForUpdate/StatementExpressionList/StatementExpression/PostfixExpression/PrimaryExpression/PrimaryPrefix/Name/@Image
=
- ancestor::ForStatement/ForInit//VariableDeclaratorId/@Image
+ ancestor::ForStatement/ForInit//VariableDeclaratorId/@Name
]
]]>
@@ -2702,8 +2702,8 @@ with the restriction that the logger needs to be passed into the constructor.
(: check modifiers :)
(@Private = false() or @Final = false())
(: check logger name :)
- or (@Static and VariableDeclarator/VariableDeclaratorId[@Image != $staticLoggerName])
- or (@Static = false() and VariableDeclarator/VariableDeclaratorId[@Image != $loggerName])
+ or (@Static and VariableDeclarator/VariableDeclaratorId[@Name != $staticLoggerName])
+ or (@Static = false() and VariableDeclarator/VariableDeclaratorId[@Name != $loggerName])
(: check logger argument type matches class or enum name :)
or .//ArgumentList//ClassOrInterfaceType[@Image != ancestor::ClassOrInterfaceDeclaration/@SimpleName]
@@ -2717,7 +2717,7 @@ with the restriction that the logger needs to be passed into the constructor.
ancestor::ClassOrInterfaceBody//ConstructorDeclaration//StatementExpression
[PrimaryExpression[PrimaryPrefix[@ThisModifier]]/PrimarySuffix[@Image=$loggerName]]
[AssignmentOperator[@Image = '=']]
- [Expression/PrimaryExpression/PrimaryPrefix/Name[@Image = ancestor::ConstructorDeclaration//FormalParameter/VariableDeclaratorId/@Image]]
+ [Expression/PrimaryExpression/PrimaryPrefix/Name[@Image = ancestor::ConstructorDeclaration//FormalParameter/VariableDeclaratorId/@Name]]
[not(.//AllocationExpression)]
)
]
diff --git a/pmd-java/src/main/resources/category/java/performance.xml b/pmd-java/src/main/resources/category/java/performance.xml
index 9afd4f220b..8213f85f83 100644
--- a/pmd-java/src/main/resources/category/java/performance.xml
+++ b/pmd-java/src/main/resources/category/java/performance.xml
@@ -878,14 +878,14 @@ You must use new ArrayList<>(Arrays.asList(...)) if that is inconvenient for you
@Image="ArrayList"
]
)=1
- ]/@Image
+ ]/@Name
]
and
PrimaryExpression/PrimarySuffix/Arguments/ArgumentList/Expression/PrimaryExpression/PrimaryPrefix/Name
[
- @Image = ancestor::MethodDeclaration[1]//LocalVariableDeclaration/VariableDeclarator/VariableDeclaratorId[@ArrayType=true()]/@Image
+ @Image = ancestor::MethodDeclaration[1]//LocalVariableDeclaration/VariableDeclarator/VariableDeclaratorId[@ArrayType=true()]/@Name
or
- @Image = ancestor::MethodDeclaration[1]//FormalParameter/VariableDeclaratorId/@Image
+ @Image = ancestor::MethodDeclaration[1]//FormalParameter/VariableDeclaratorId/@Name
]
/../..[count(.//PrimarySuffix)
=1]/PrimarySuffix/Expression/PrimaryExpression/PrimaryPrefix