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 2020/08/10 13:55:00 UTC

[jira] [Resolved] (GROOVY-8049) Trait properties with 'with'

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

Eric Milles resolved GROOVY-8049.
---------------------------------
    Fix Version/s: 3.0.6
                   4.0.0-alpha-1
       Resolution: Fixed

> Trait properties with 'with'
> ----------------------------
>
>                 Key: GROOVY-8049
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8049
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.7
>            Reporter: Daniil Ovchinnikov
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.0-alpha-1, 3.0.6
>
>
> {code}
> @CompileStatic
> interface I {
>   String getFoo()
> }
> @CompileStatic
> trait T {
>   abstract I getProp()
>   def usage() {
>     prop.with {
>       foo.toUpperCase() 
> // Groovyc: [Static type checking] - Cannot find matching method java.lang.Object#toUpperCase(). Please check if the declared type is right and if the method exists.
> // works when changed to getFoo().toUpperCase() 
>     }
>   }
> }
> @CompileStatic
> class Main implements T {
>   I prop = { "hello" } as I
>   static void main(String[] args) {
>     println new Main().usage()
>   }
> }
> {code}



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