Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-4612

Correctness - Call to equals() comparing different types

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Non-Essential
    • Resolution: Fixed
    • Affects Version/s: Platform 1.11.0
    • Fix Version/s: Platform 2.0.0
    • Component/s: None
    • Complexity:
      Low

      Description

      There are methods, which call equals(Object) on two references of different class types with no common subclasses. Therefore, the objects being compared are unlikely to be members of the same class at runtime (unless some application classes were not analyzed, or dynamic class loading can occur at runtime). According to the contract of equals(), objects of different classes should always compare as unequal; therefore, according to the contract defined by java.lang.Object.equals(Object), the result of this comparison will always be false at runtime.

      Reported Classes:
      FormListController (lines 91 and 94), StateConversionListController, LocationListController, ORUR01Handler, ConceptClassListController, PrivilegeListController, ConceptDatatypeListController

      Acceptance Criteria
      Eliminate all errors reported by Sonar for this rule
      https://ci.openmrs.org/sonar/drilldown/issues/1865?&rule=findbugs%3AEC_UNRELATED_TYPES&rule_sev=CRITICAL

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sashrika Sashrika Waidyarathna
              Reporter:
              raff Rafal Korytkowski
              Designated Committer:
              Daniel Kayiwa
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 4 hours
                  4h
                  Remaining:
                  Time Spent - 2 hours Remaining Estimate - 2 hours
                  2h
                  Logged:
                  Time Spent - 2 hours Remaining Estimate - 2 hours
                  2h