how do I check with functions using CompareObjectsWithEquals
A source code analyzer
Brought to you by:
adangel,
juansotuyo
I want to check compare object with == or != in my project,but if I use CompareObjectsWithEquals,
code like following cannot be reported by PMD:
but if I change the cod to :
then PMD can report the error to me.
Did I do something wrong? How could I configure it to check the first code?
Hi,
you are not doing anything wrong. You are running into a current limitation of PMD - we are not yet able to determine the (return) type of method call. If you define local variables first, then we know the type (because you need to explicitly declare the type for the variable declaration) and then we can detect the violation.
We'll hopefully be able to detect your first example, too, in some time. It needs some more work on the type resolution code.
Ok, I got it. Thanks.
look forward to the future.