Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-5845 Search and fix minor errors and typos
  3. TRUNK-5958

Overriding methods should do more than simply call the same method in the super class

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Could
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Core 2.4.0
    • Component/s: None
    • Labels:
    • Complexity:
      Low

      Description

      From SonarQube:

      Overriding a method just to call the same method from the super class without performing any other actions is useless and misleading. The only time this is justified is in final overriding methods, where the effect is to lock in the parent class behavior. This rule ignores such overrides of equals, hashCode and toString.

      Class BaseChangeableOpenmrsData:
      SonarQube links:

      GitHub link:

      Class BaseChangeableOpenmrsMetadata:
      SonarQube links:

      GitHub link:

      Class ConceptSource:
      SonarQube links:

      GitHub links:

      Problem:
      Overwriting a parent class method only so that one command is a call to the parent class method. The author of this code forgot about inheritance?

      Solution:
      Removal of unnecessary calls and use of inheritance.

        Gliffy Diagrams

          Attachments

            Activity

              People

              Assignee:
              sacull Lukasz Debicki
              Reporter:
              sacull Lukasz Debicki
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: