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

S2293 fails analysis with IllegalStateException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.14
    • Fix Version/s: 6.0
    • Component/s: Rules
    • Labels:
      None

      Description

      Implementation of RSPEC-2293 fails with the following code:

      class A {
      
        public void foo() {
          this.bar()[0] = new GenericClass<String, Integer, Integer>(); // unexpected method invocation on the expression side of ArrayAccess
        }
      
        public MyInterface[] bar() {
          return new MyInterface[1];
        }
      
        interface MyInterface { }
        static class GenericClass<X, Y, Z> implements MyInterface { }
      }

      This behavior has been introduced when merging the following PR: https://github.com/SonarSource/sonar-java/pull/1850

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                amelie.renard Amélie Renard
                Reporter:
                michael.gumowski Michael Gumowski
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: