You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2022/03/08 12:17:01 UTC

[jira] [Closed] (GROOVY-6430) Type checking error when multiple-dispatching on instance fields from static context

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

Paul King closed GROOVY-6430.
-----------------------------

> Type checking error when multiple-dispatching on instance fields from static context
> ------------------------------------------------------------------------------------
>
>                 Key: GROOVY-6430
>                 URL: https://issues.apache.org/jira/browse/GROOVY-6430
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 2.2.0-rc-3, 2.3.0, 2.4.0-rc-1
>            Reporter: Dimitar Dimitrov
>            Priority: Major
>
> {code}
> @groovy.transform.CompileStatic
> class InstanceGenericsInStaticContext {
> //    List<Class> classes = [] // If we use List it all works!
>     Collection<Class> classes = []
>     def compilesInstance() {
>         println classes*.simpleName
>     }
>     // Groovyc: [Static type checking] - No such property: simpleName for class: java.util.Set <java.lang.Class>
>     static compilesStatic() {
>         Collection<Class> x = []
>         println x*.simpleName
>     }
>     static compilesStatic(InstanceGenericsInStaticContext it) {
>         it.classes.first().simpleName
>         println it.classes.collect { (Class) it }*.simpleName
>     }
>     static doesNotCompile(InstanceGenericsInStaticContext it) {
>         println it.classes*.simpleName
>     }
>     static doesNotCompile2(InstanceGenericsInStaticContext it) {
>         Collection<Class> x = it.classes
>         println x*.simpleName
>     }
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)