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:
Andreas Dangel
2015-01-24 15:57:04 +01:00
parent 4be14adebb
commit 172c20efa6

View File

@ -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>