[jira] [Closed] (GROOVY-7721) Static type checking fails when compiling against a Java8 interface with inherited methods

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Closed] (GROOVY-7721) Static type checking fails when compiling against a Java8 interface with inherited methods

JIRA jira@apache.org

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

Daniel Sun closed GROOVY-7721.
------------------------------
       Resolution: Fixed
    Fix Version/s: 2.4.x

Fixed by https://github.com/apache/groovy/commit/1c395602ee4929959d451e918015fc7ebf258dec

> Static type checking fails when compiling against a Java8 interface with inherited methods
> ------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-7721
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7721
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 2.4.0
>            Reporter: Peter Gromov
>            Assignee: Daniel Sun
>             Fix For: 2.4.x
>
>
> Create classes.java:
> {code}
> interface I {
>     R[] method();
> }
> interface I2 extends I {
>     R2[] method();
> }
> interface R {}
> interface R2 extends R {}
> {code}
> compile it with JDK 8 javac.
> Then create usage.groovy:
> {code}import groovy.transform.CompileStatic
> @CompileStatic
> class Gr {
>     R2[] x(I2 i) {
>        return i.method();
>     }
> }
> {code}
> Compile it with groovyc (also run with Java8) with the classes from previous compilation in the classpath. Compilation fails:
> {code}
> usage.groovy: 6: [Static type checking] - Reference to method is ambiguous. Cannot choose between [R2[] I2#method(), R[] I2#method()]
>  @ line 6, column 15.
>           return i.method();
>                  ^
> 1 error
> {code}
> Originally reported as https://youtrack.jetbrains.com/issue/IDEA-148973



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)