Uploaded image for project: 'SonarJava'
  1. SonarJava
  2. SONARJAVA-3450

FP on S3973 on valid generated equals methods from IntelliJ

    Details

    • Type: False-Positive
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.6
    • Component/s: Rules
    • Labels:
      None

      Description

      Implementation of rule RSPEC-3973 is raising a FP on the following (generated) code, which is following correct indentation:

      class A {
        Object lastRefresh;
        Object someValue;
      
        // equals method generated by IntelliJ
        @Override
        public boolean equals(Object obj) {
          if (this == obj)
            return true;
          if (obj == null)
            return false;
          if (getClass() != obj.getClass())
            return false;
          A other = (A) obj;
          if (lastRefresh == null) {
            if (other.someValue != null)
              return false;
          } else if (!someValue.equals(other.someValue)) // FP S3973
      //    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            return false;
          return true;
        }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                quentin.jaquier Quentin Jaquier
                Reporter:
                michael.gumowski Michael Gumowski
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: