Skip to content

Commit 130d14d

Browse files
committed
Merge branch '__rultor'
2 parents da87b7e + 15e5db1 commit 130d14d

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

qulice-pmd/src/main/resources/com/qulice/pmd/ruleset.xml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,10 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
153153
</description>
154154
<priority>3</priority>
155155
<properties>
156+
<property name="version" value="2.0"/>
156157
<property name="xpath">
157158
<value><![CDATA[
158-
//Name[@Image = //FieldDeclaration[@Static='true']/@VariableName]
159+
//Name[@Image = //FieldDeclaration[@Static=true()]/VariableDeclarator/VariableDeclaratorId/@Name]
159160
]]></value>
160161
</property>
161162
</properties>
@@ -175,13 +176,14 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
175176
</description>
176177
<priority>3</priority>
177178
<properties>
179+
<property name="version" value="2.0"/>
178180
<property name="xpath">
179181
<value><![CDATA[
180182
//PrimaryExpression[
181-
(./PrimaryPrefix[@ThisModifier='true']) and
183+
(./PrimaryPrefix[@ThisModifier=true()]) and
182184
(./PrimarySuffix[
183-
@Image=//FieldDeclaration[@Static='true']/@VariableName
184-
or @Image=//MethodDeclaration[@Static='true']/@MethodName
185+
@Image=./ancestor::ClassOrInterfaceBody[1]/ClassOrInterfaceBodyDeclaration/FieldDeclaration[@Static=true()]/VariableDeclarator/VariableDeclaratorId/@Name
186+
or @Image=./ancestor::ClassOrInterfaceBody[1]/ClassOrInterfaceBodyDeclaration/MethodDeclaration[@Static=true()]/@Name
185187
])
186188
]
187189
]]></value>

qulice-pmd/src/test/resources/com/qulice/pmd/StaticAccessToStaticFields.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ public int another() {
1212
}
1313

1414
public int addToNum(final int another) {
15-
return another + StaticAccessToStaticFields.number();
15+
return another + StaticAccessToStaticFields.number() + this.another();
16+
}
17+
18+
class InternalClass {
19+
final int num;
20+
21+
InternalClass(final int par) {
22+
this.num = par;
23+
}
24+
static int another() {
25+
return 1;
26+
}
27+
28+
public int add(final int a) {
29+
return a + this.num;
30+
}
1631
}
1732
}

0 commit comments

Comments
 (0)