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

FP in S2159 when type compared is Unknown

    XMLWordPrintable

    Details

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

      Description

      S2159 reports FP when one of the type compared is unknown. We should not report an issue to reduce the noise.

      class ExtendsUnknown extends Unknown {
        @Override
        public boolean equals(Object o) {
          if (super.equals(o)) { // FP
            return false;
          }
          return o.toString().equals("abc");
        }
      
        public void unknownArg(Unknown unknown, Object object) {
          object.equals(unknown); // FP
          unknown.equals(object); // FP
        }
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              quentin.jaquier Quentin Jaquier
              Reporter:
              quentin.jaquier Quentin Jaquier
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: