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

Eric Milles updated GROOVY-11370:
---------------------------------
    Description: 
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

  was:
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


> 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
>
> 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



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

Reply via email to