[
https://issues.apache.org/jira/browse/GROOVY-9963?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles reassigned GROOVY-9963:
-----------------------------------
Assignee: Eric Milles
> 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
> Assignee: Eric Milles
> Priority: Major
>
> 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
>
> Tested on:
> https://github.com/apache/groovy/commit/715c34edc82261544b8715bc2253b0b3f05bdbad
--
This message was sent by Atlassian Jira
(v8.3.4#803005)