Thodoris Sotiropoulos created GROOVY-11109:
----------------------------------------------

             Summary: Unable to initialize generic class with an array
                 Key: GROOVY-11109
                 URL: https://issues.apache.org/jira/browse/GROOVY-11109
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Thodoris Sotiropoulos


Probably a regeression.

I have the following program

{code}
class Foo<T> {
  Foo(T[] x) {}
}

class Main {
  static final void test() {
    Byte[][] arg = null;
    Foo<Byte[]> res = new Foo<Byte[]>(arg)
  }
}
{code}

h3. Actual behavior

{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Main.groovy: 8: [Static type checking] - Cannot call 
Foo#<init>(java.lang.Byte[][]) with arguments [java.lang.Byte[][]]
 @ line 8, column 23.
       Foo<Byte[]> res = new Foo<Byte[]>(arg)
                         ^

1 error
{code}

h3. Expected behavior

Compile successfully

h3. Notes

Tested against master

adapted from the following program

{code}
class Main {
  static final void test() {
    byte[][] arg = null;
    byte[] res = new 
com.fasterxml.jackson.databind.util.ArrayIterator<byte[]>(arg).next();
  }
}
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to