forked from phoedos/pmd
Fixes #1021
This commit is contained in:
Akshat Bahety
committed by
Akshat Bahety
parent
863083d1a8
commit
958fd34c0f
@ -488,6 +488,7 @@ public class DataClass {
|
||||
|
||||
<rule name="DoNotExtendJavaLangError"
|
||||
language="java"
|
||||
typeResolution="true"
|
||||
since="4.0"
|
||||
message="Exceptions should not extend java.lang.Error"
|
||||
class="net.sourceforge.pmd.lang.rule.XPathRule"
|
||||
@ -501,7 +502,9 @@ Errors are system exceptions. Do not extend them.
|
||||
<value>
|
||||
<![CDATA[
|
||||
//ClassOrInterfaceDeclaration/ExtendsList/ClassOrInterfaceType
|
||||
[@Image="Error" or @Image="java.lang.Error"]
|
||||
[typeof(@Image,'java.lang.Error','Error')]
|
||||
|
||||
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
|
@ -33,4 +33,18 @@ public class Foo extends FooError {
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description><![CDATA[
|
||||
Extends name Error
|
||||
]]></description>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
import net.sourceforge.pmd.lang.java.rule.design.donotextendjavalangerror.Error;
|
||||
|
||||
public class Foo extends Error {
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
</test-data>
|
||||
|
Reference in New Issue
Block a user