New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[java] CompareObjectsWithEqualsRule: False positive with Enums #2716
Comments
Fixed via #2899 for PMD 7. |
I also get a lot of false positives for this rule when upgrading from 6.29.0 to 6.30.0 or 6.31.0: What are the plans for 7.0.0? The backlog looks quite large before we can expect a new major release. |
That indeed will still take a while. But we are open to fix/backport issues that are already fixed for pmd 7, if there is a demand. We also accept pull requests. I've looked at this issue again and that's my conclusion:
Then I looked at your false positives:
The one new violation with "LiteralsFirstInComparisons" appears here: https://github.com/jenkinsci/warnings-ng-plugin/blob/9869a3bff1f20cfc593c2bfe01bacdc55c7dc625/plugin/src/test/java/io/jenkins/plugins/analysis/core/model/PropertyStatisticsTest.java#L94 |
Thanks for clarifying! You are right, the class actually is not an enum it is just used in the same way. It seems that I forgot about it since I haven't looked into that part of my code since a long time... |
Affects PMD Version:
6.26.0
Rule:
CompareObjectsWithEquals
Description:
With #885 this rule was fixed to not show a false-positive violation when comparing enums with '=='.
However there is still a way to get a false-positive.
Code Sample demonstrating the issue:
Expected outcome:
No violation -> false-positive
Running PMD through: Eclipse
The text was updated successfully, but these errors were encountered: