summary: CompareObjectsWithEquals: == ok for enums --> [java] CompareObjectsWithEquals: == ok for enums
Description has changed:
Diff:
--- old+++ new@@ -1,2 +1,4 @@+Rule: [CompareObjectsWithEquals](http://pmd.github.io/latest/pmd-java/rules/java/design.html#CompareObjectsWithEquals)+
I think, comparison with == and != is ok e.g. for enums.
Could one modify this rule accordingly?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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