CAST Engineering Dashboard - Violations - False Violation - Check usage of equal equal and not equal on objects
Description
This page provides the details on wrong violations that are flagged for the Quality Rule “Check usage of ‘==’ and ‘!=’ on objects”.
Please refer to the below screenshot:

Observed in CAST AIP
| Release | Yes/No |
|---|---|
| 8.3.x | ✅ |
Observed on RDBMS
| RDBMS | Yes/No |
|---|---|
| CSS | ✅ |
Step by Step Scenario
Below is the step-by-step scenario leading to the problem:
- Run analysis + snapshot for a JAVA application.
- Open dashboard and login.
- Check the violations for QR - Check usage of ‘==’ and ‘!=’ on objects.
Impact of the Problem
The impact of the problem on the dashboard is: The user is able to see violations for the QR when it is not expected.
Details
This issue is not a case of Wrong Violation.
Please refer to the below explanation about the function of the Quality Rule to know why the violation is not wrong:
The QR is about the unexpected consequence of using ==/!= in Java, without knowledge of what they actually do. So it leaves room for false positives, in cases where they are used knowingly, according to their actual feature.
If that is the case, then indeed, in the equal method overload of the use of == is safe and intended.
However, there is no way of detecting the developer’s intention. QR only knows that in most of the cases, the usage will be improper.
That’s why QR allows, in the grading system, for a few remaining violations even at maximum grade.
If the user/developer thinks that it is safe and intended then they can add this violation under exclusion.
This metric is now scheduled to be removed from CAST metrics in the JEE 1.2.15 extension due to this and issues with accurately determining the violation for this metric.
Notes/comments
Ticket # 5581
Related Pages