forked from phoedos/pmd
[java] use pmd-java:typeIs always with the prefix "pmd-java".
Jaxen ignores the prefix, Saxon will require it. So, it's more consistent to use the prefix always.
This commit is contained in:
@ -29,7 +29,7 @@ protected constructor in order to prevent instantiation than make the class misl
|
||||
//ClassOrInterfaceDeclaration
|
||||
[@Abstract = 'true']
|
||||
[count(//MethodDeclaration) + count(//ConstructorDeclaration) = 0]
|
||||
[not(../Annotation/MarkerAnnotation/Name[typeIs('com.google.auto.value.AutoValue')])]
|
||||
[not(../Annotation/MarkerAnnotation/Name[pmd-java:typeIs('com.google.auto.value.AutoValue')])]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
@ -267,13 +267,13 @@ Exception, or Error, use a subclassed exception or error instead.
|
||||
<![CDATA[
|
||||
//ThrowStatement//AllocationExpression
|
||||
/ClassOrInterfaceType[
|
||||
typeIsExactly('java.lang.Throwable')
|
||||
pmd-java:typeIsExactly('java.lang.Throwable')
|
||||
or
|
||||
typeIsExactly('java.lang.Exception')
|
||||
pmd-java:typeIsExactly('java.lang.Exception')
|
||||
or
|
||||
typeIsExactly('java.lang.Error')
|
||||
pmd-java:typeIsExactly('java.lang.Error')
|
||||
or
|
||||
typeIsExactly('java.lang.RuntimeException')
|
||||
pmd-java:typeIsExactly('java.lang.RuntimeException')
|
||||
]
|
||||
]]>
|
||||
</value>
|
||||
@ -503,7 +503,7 @@ Errors are system exceptions. Do not extend them.
|
||||
<value>
|
||||
<![CDATA[
|
||||
//ClassOrInterfaceDeclaration/ExtendsList/ClassOrInterfaceType
|
||||
[typeIs('java.lang.Error')]
|
||||
[pmd-java:typeIs('java.lang.Error')]
|
||||
|
||||
|
||||
]]>
|
||||
|
@ -96,7 +96,7 @@ and unintentional empty constructors.
|
||||
<![CDATA[
|
||||
//ConstructorDeclaration[@Private='false']
|
||||
[count(BlockStatement) = 0 and ($ignoreExplicitConstructorInvocation = 'true' or not(ExplicitConstructorInvocation)) and @containsComment = 'false']
|
||||
[not(../Annotation/MarkerAnnotation/Name[typeIs('javax.inject.Inject')])]
|
||||
[not(../Annotation/MarkerAnnotation/Name[pmd-java:typeIs('javax.inject.Inject')])]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
|
@ -707,9 +707,9 @@ public String bar(String string) {
|
||||
/Block[not(
|
||||
(BlockStatement[1]/Statement/StatementExpression/PrimaryExpression[./PrimaryPrefix[@SuperModifier='true']]/PrimarySuffix[@Image= ancestor::MethodDeclaration/MethodDeclarator/@Image]))]
|
||||
[ancestor::ClassOrInterfaceDeclaration[ExtendsList/ClassOrInterfaceType[
|
||||
typeIs('android.app.Activity') or
|
||||
typeIs('android.app.Application') or
|
||||
typeIs('android.app.Service')
|
||||
pmd-java:typeIs('android.app.Activity') or
|
||||
pmd-java:typeIs('android.app.Application') or
|
||||
pmd-java:typeIs('android.app.Service')
|
||||
]]]
|
||||
]]>
|
||||
</value>
|
||||
@ -752,9 +752,9 @@ Super should be called at the end of the method
|
||||
/Block/BlockStatement[last()]
|
||||
[not(Statement/StatementExpression/PrimaryExpression[./PrimaryPrefix[@SuperModifier='true']]/PrimarySuffix[@Image= ancestor::MethodDeclaration/MethodDeclarator/@Image])]
|
||||
[ancestor::ClassOrInterfaceDeclaration[ExtendsList/ClassOrInterfaceType[
|
||||
typeIs('android.app.Activity') or
|
||||
typeIs('android.app.Application') or
|
||||
typeIs('android.app.Service')
|
||||
pmd-java:typeIs('android.app.Activity') or
|
||||
pmd-java:typeIs('android.app.Application') or
|
||||
pmd-java:typeIs('android.app.Service')
|
||||
]]]
|
||||
]]>
|
||||
</value>
|
||||
@ -2304,7 +2304,7 @@ Serializable classes should provide a serialVersionUID field.
|
||||
[@Abstract = 'false']
|
||||
[count(ClassOrInterfaceBody/ClassOrInterfaceBodyDeclaration
|
||||
/FieldDeclaration/VariableDeclarator/VariableDeclaratorId[@Image='serialVersionUID']) = 0]
|
||||
[(ImplementsList | ExtendsList)/ClassOrInterfaceType[typeIs('java.io.Serializable')]]
|
||||
[(ImplementsList | ExtendsList)/ClassOrInterfaceType[pmd-java:typeIs('java.io.Serializable')]]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
|
@ -169,8 +169,8 @@ Explicitly calling Thread.run() method will execute in the caller's thread of co
|
||||
[
|
||||
./Name[ends-with(@Image, '.run') or @Image = 'run']
|
||||
and substring-before(Name/@Image, '.') =//VariableDeclarator/VariableDeclaratorId/@Image
|
||||
[../../../Type/ReferenceType/ClassOrInterfaceType[typeIs('java.lang.Thread')]]
|
||||
or (./AllocationExpression/ClassOrInterfaceType[typeIs('java.lang.Thread')]
|
||||
[../../../Type/ReferenceType/ClassOrInterfaceType[pmd-java:typeIs('java.lang.Thread')]]
|
||||
or (./AllocationExpression/ClassOrInterfaceType[pmd-java:typeIs('java.lang.Thread')]
|
||||
and ../PrimarySuffix[@Image = 'run'])
|
||||
]
|
||||
]
|
||||
|
@ -135,10 +135,10 @@ The FileReader and FileWriter constructors instantiate FileInputStream and FileO
|
||||
<value>
|
||||
<![CDATA[
|
||||
//PrimaryPrefix/AllocationExpression/ClassOrInterfaceType[
|
||||
typeIs('java.io.FileInputStream')
|
||||
or typeIs('java.io.FileOutputStream')
|
||||
or typeIs('java.io.FileReader')
|
||||
or typeIs('java.io.FileWriter')
|
||||
pmd-java:typeIs('java.io.FileInputStream')
|
||||
or pmd-java:typeIs('java.io.FileOutputStream')
|
||||
or pmd-java:typeIs('java.io.FileReader')
|
||||
or pmd-java:typeIs('java.io.FileWriter')
|
||||
]
|
||||
]]>
|
||||
</value>
|
||||
@ -209,10 +209,10 @@ adverse impacts on performance.
|
||||
<![CDATA[
|
||||
//FieldDeclaration/Type/PrimitiveType[@Image = 'short']
|
||||
|
|
||||
//ClassOrInterfaceBodyDeclaration[not(Annotation/MarkerAnnotation/Name[typeIs('java.lang.Override')])]
|
||||
//ClassOrInterfaceBodyDeclaration[not(Annotation/MarkerAnnotation/Name[pmd-java:typeIs('java.lang.Override')])]
|
||||
/MethodDeclaration/ResultType/Type/PrimitiveType[@Image = 'short']
|
||||
|
|
||||
//ClassOrInterfaceBodyDeclaration[not(Annotation/MarkerAnnotation/Name[typeIs('java.lang.Override')])]
|
||||
//ClassOrInterfaceBodyDeclaration[not(Annotation/MarkerAnnotation/Name[pmd-java:typeIs('java.lang.Override')])]
|
||||
/MethodDeclaration/MethodDeclarator/FormalParameters/FormalParameter/Type/PrimitiveType[@Image = 'short']
|
||||
|
|
||||
//LocalVariableDeclaration/Type/PrimitiveType[@Image = 'short']
|
||||
@ -294,7 +294,7 @@ Note that new Byte() is deprecated since JDK 9 for that reason.
|
||||
<![CDATA[
|
||||
//AllocationExpression
|
||||
[not (ArrayDimsAndInits)
|
||||
and ClassOrInterfaceType[typeIs('java.lang.Byte')]]
|
||||
and ClassOrInterfaceType[pmd-java:typeIs('java.lang.Byte')]]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
@ -467,7 +467,7 @@ Note that new Integer() is deprecated since JDK 9 for that reason.
|
||||
<![CDATA[
|
||||
//AllocationExpression
|
||||
[not (ArrayDimsAndInits)
|
||||
and ClassOrInterfaceType[typeIs('java.lang.Integer')]]
|
||||
and ClassOrInterfaceType[pmd-java:typeIs('java.lang.Integer')]]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
@ -500,7 +500,7 @@ Note that new Long() is deprecated since JDK 9 for that reason.
|
||||
<![CDATA[
|
||||
//AllocationExpression
|
||||
[not (ArrayDimsAndInits)
|
||||
and ClassOrInterfaceType[typeIs('java.lang.Long')]]
|
||||
and ClassOrInterfaceType[pmd-java:typeIs('java.lang.Long')]]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
@ -664,7 +664,7 @@ Note that new Short() is deprecated since JDK 9 for that reason.
|
||||
<![CDATA[
|
||||
//AllocationExpression
|
||||
[not (ArrayDimsAndInits)
|
||||
and ClassOrInterfaceType[typeIs('java.lang.Short')]]
|
||||
and ClassOrInterfaceType[pmd-java:typeIs('java.lang.Short')]]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
|
Reference in New Issue
Block a user