You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/05/18 16:08:00 UTC

[jira] [Resolved] (GROOVY-10227) STC computes an imprecise LUB when involving two parameterized types implementing the same interface

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

Eric Milles resolved GROOVY-10227.
----------------------------------
    Fix Version/s: 5.0.0-alpha-1
                   4.0.3
       Resolution: Fixed

https://github.com/apache/groovy/commit/b66abe42b56b7e3e3b48cdd442fbcdf9ea247e8b

> 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, 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)