Thodoris Sotiropoulos created GROOVY-9963:
---------------------------------------------

             Summary: Generic type of field is not istantiated
                 Key: GROOVY-9963
                 URL: https://issues.apache.org/jira/browse/GROOVY-9963
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Thodoris Sotiropoulos


I have the following program
{code:java}
class A<T> {
  T x;
  A(T x) {
    this.x = x;
  }
}

public class Main {
  public static void main(String[] args) {
    bar((new A<>("")).x);
  }
  public static void bar(String x) {}
}
{code}
h3. Actual Behaviour

I get the following compile-time error
{code:java}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 11: [Static type checking] - Cannot find matching method 
Main#bar(T). Please check if the declared type is correct and if the method 
exists.
 @ line 11, column 5.
       bar((new A<>("")).x);
       ^1 error

{code}
h3. Expected Behaviour

Compile successfully



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to