-
Hi. I've recently been writing a bunch of custom xpath rules, and wrote one which I wanted to apply to any Collection, so I used |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Currently, there's no way to do that within an XPath expression (though with java your hands are freer)
Actually it does, the type resolution framework does resolve them and use their type (but, it doesn't expose eg a reflect.Field instance, only the final Class for the expression). If the classpath is properly configured, and the type of the expression is not resolved, this is a bug that you should report to us :) In PMD 7 this part of pmd will also be very significantly improved. Given that, I think it's a bad idea to add a way to do what you describe. If we have no information we could be reporting false positives. The correct way to fix these cases shouldn't be to make the rule less precise (which could backfire and you'd have a noisy rule that you won't pay attention to). But this hints that there may be a problem with our type resolution, or with your classpath configuration. |
Beta Was this translation helpful? Give feedback.
Currently, there's no way to do that within an XPath expression (though with java your hands are freer)
Actually it does, the type resolution framework does resolve them and use their type (but, it doesn't expose eg a reflect.Field instance, only the final Class for the expression). If the classpath is properly configured, and the type of the expression is not resolved, this is a bug that you should report to us :) In PMD 7 this part of pmd will also be very significantly improved.
Given that, I think it's a bad idea to add a way to do what you describe. If we have no information we coul…