[ 
https://issues.apache.org/jira/browse/GROOVY-10227?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-10227:
---------------------------------
    Fix Version/s: 3.0.11

> STC computes an imprecise LUB when involving two parameterized types 
> implementing the same interface
> ----------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-10227
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10227
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 5.0.0-alpha-1, 3.0.11, 4.0.3
>
>
> I have the following program
>  
> {code:java}
> class A {
>   void foo(I x) {}
> }
> interface I {}
> interface I2 extends I {}
> class B<T> implements I2 {}
> class C<T> implements I {}
> class Main {
>   public static void main(String[] args) {
>     (new A()).foo((true) ? new B<String>() : new C<String>());
>   }
> }
> {code}
> h3. Actual behaviour
> {code:java}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
> failed:
> test.groovy: 12: [Static type checking] - Cannot find matching method 
> A#foo(java.lang.Object). Please check if the declared type is correct and if 
> the method exists.
>  @ line 12, column 5.
>        (new A()).foo((true) ? new B<String>() : new C<String>());
>        ^1 error
> {code}
> h3. Expected behaviour
> Compile successfully
>  
> Tested against master
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to