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

S2259 FP on null when called Class.isInstance

    Details

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

      Description

      Following equals implementation will raise FP on

      @Override
      public boolean equals(Object o) {
          if (this == o) return true;
          if (Example.class.isInstance(o)) return false;
          Example example = (Example) o;
          return Objects.equals(foo, example.foo); // FP 
      } 

       

      True branch of isInstance invocation should add NOT_NULL  on the parameter.

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alban.auzeill Alban Auzeill
                Reporter:
                tibor.blenessy Tibor Blenessy
              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: