Use type resolution for AvoidThrowingRawExceptionTypes

- Fixes the false negatives
 - Is actually 100X faster as we avoid all those `//ImportDeclaration`
This commit is contained in:
Juan Martín Sotuyo Dodero
2018-05-12 01:06:38 -03:00
parent 43839bd772
commit a378299978

View File

@ -266,13 +266,13 @@ Exception, or Error, use a subclassed exception or error instead.
<![CDATA[
//ThrowStatement//AllocationExpression
/ClassOrInterfaceType[
(@Image='Throwable' and count(//ImportDeclaration/Name[ends-with(@Image,'Throwable')]) = 0)
typeof(@Image, 'java.lang.Throwable', 'Throwable')
or
(@Image='Exception' and count(//ImportDeclaration/Name[ends-with(@Image,'Exception')]) = 0)
typeof(@Image, 'java.lang.Exception', 'Exception')
or
(@Image='Error' and count(//ImportDeclaration/Name[ends-with(@Image,'Error')]) = 0)
typeof(@Image, 'java.lang.Error', 'Error')
or
( @Image='RuntimeException' and count(//ImportDeclaration/Name[ends-with(@Image,'RuntimeException')]) = 0)
typeof(@Image, 'java.lang.RuntimeException', 'RuntimeException')
]
]]>
</value>