[java] CompareObjectsWithEquals: == ok for enums
A source code analyzer
Brought to you by:
adangel,
juansotuyo
Rule: CompareObjectsWithEquals
I think, comparison with == and != is ok e.g. for enums.
Could one modify this rule accordingly?
Diff:
In order to be able to differ between ordinary Objects and Enums, PMD needs to use typeresolution. It needs to detect, that the object is actually a enum. It should be sufficient, if PMD finds on one side an enum.
The issue is not reproducible provided PMD is run with an appropriate auxclasspath.
The rule currently checks if both ends of the check are of the same type, and they are enums, and will work as expected.
Make sure you are providing PMD with a full auxclasspath