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 2024/11/12 11:43:00 UTC

[jira] [Closed] (GROOVY-11370) STC: extension method cannot provide map property (read mode)

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

Paul King closed GROOVY-11370.
------------------------------

> STC: extension method cannot provide map property (read mode)
> -------------------------------------------------------------
>
>                 Key: GROOVY-11370
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11370
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 3.0.21, 4.0.21
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 3.0.22, 4.0.22
>
>
> Consider the following:
> {code:groovy}
> @TypeChecked
> void test() {
>   def map = [:]
>   print map.metaClass
> }
> test()
> {code}
> The script prints "null" (before Groovy 5) indicating that "getMetaClass()" extension method is not used.  However, node metadata indicates that the extension method is used.  For example, adding "Number n = map.metaClass" says: "Cannot assign value of type groovy.lang.MetaClass to variable of type java.lang.Number"
> GROOVY-5001, GROOVY-5491, GROOVY-5568, GROOVY-9115, GROOVY-9123



--
This message was sent by Atlassian Jira
(v8.20.10#820010)