forked from phoedos/pmd
Small performance improvements for rule FieldDeclarationsShouldBeAtStartOfClass
It is the slowest rule from #1308 PMD runs endlessly on some generated files
This commit is contained in:
@ -1805,10 +1805,16 @@ Fields should be declared at the top of the class, before any method declaration
|
|||||||
<value>
|
<value>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
//ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration/FieldDeclaration
|
//ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration/FieldDeclaration
|
||||||
[not(.//ClassOrInterfaceBodyDeclaration) or $ignoreAnonymousClassDeclarations = 'false']
|
[not(.//ClassOrInterfaceBodyDeclaration) or $ignoreAnonymousClassDeclarations = 'false']
|
||||||
[count(../preceding-sibling::ClassOrInterfaceBodyDeclaration/child::*[1]
|
[../preceding-sibling::ClassOrInterfaceBodyDeclaration
|
||||||
[name() != 'FieldDeclaration' and name() != 'Annotation' and
|
[
|
||||||
(name() != 'EnumDeclaration' or $ignoreEnumDeclarations = 'false')]) > 0]
|
count(child::*)
|
||||||
|
- count(FieldDeclaration)
|
||||||
|
- count(Annotation)
|
||||||
|
- count(EnumDeclaration[$ignoreEnumDeclarations = 'true'])
|
||||||
|
> 0
|
||||||
|
]
|
||||||
|
]
|
||||||
]]>
|
]]>
|
||||||
</value>
|
</value>
|
||||||
</property>
|
</property>
|
||||||
|
Reference in New Issue
Block a user