You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (Jira)" <ji...@apache.org> on 2020/02/02 16:56:00 UTC

[jira] [Resolved] (GROOVY-9204) Compiler loses type info of superclass field

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

Daniel Sun resolved GROOVY-9204.
--------------------------------
    Fix Version/s: 3.0.0-rc-4
                   2.5.10
         Assignee: Daniel Sun
       Resolution: Fixed

The proposed PR was merged. Thanks.

[https://github.com/apache/groovy/commit/0cb6d88b96871320ec5ece8609cd9437766b71e5]

> Compiler loses type info of superclass field
> --------------------------------------------
>
>                 Key: GROOVY-9204
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9204
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation, Static Type Checker
>    Affects Versions: 2.5.7
>            Reporter: Daniil Ovchinnikov
>            Assignee: Daniel Sun
>            Priority: Blocker
>             Fix For: 2.5.10, 3.0.0-rc-4
>
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> {code:java|title=foo/bar/classes.java}
> package foo.bar;
> class F {
>     void hi() {}
> }
> abstract class Base<T extends F> {
>     protected T theField;
> }
> abstract class Middle<T extends F> extends Base<T> {}
> abstract class Concrete extends Middle<F> {}
> {code}
> {code:java|title=foo/bar/GroovyUsage.groovy}
> package foo.bar
> @groovy.transform.CompileStatic
> class GroovyUsage extends Concrete {
>     def usage() {
>         theField.hi() // Error:(7, 9) Groovyc: [Static type checking] - Cannot find matching method java.lang.Object#hi(). Please check if the declared type is correct and if the method exists.
>     }
> }
> {code}
> Note this was working with 2.4.17.



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