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

Semantic: Return type of parametrized method wrongly resolved when using arrays

    Details

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

      Description

      Resolution of return type does not handle correctly arrays:

      class A {
        <T> T foo(T t) { return null; }
        <T> T[] bar(T t) { return null; }
      
        void test() {
          String s = this.<String>foo("hello");    // return type is "String"
          String[] sArray = this.<String>bar("hello"); // return type is T[] instead of String[]
        }
      }
      

        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: