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

Invariance of generics not handled correctly

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.12
    • Component/s: Semantic
    • Labels:
      None

      Description

      In the following code snippet, type of field b is considered as being a subtype of type of field a, which is wrong.

      interface Parent<T> {}
      interface Child<T> extends Parent<T> {}
      class A {}
      class B extends A {}
      
      class Test {
        Child<B> b;
        Parent<A> a;
      }
      

        Attachments

          Activity

            People

            • Assignee:
              michael.gumowski Michael Gumowski
              Reporter:
              michael.gumowski Michael Gumowski
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: