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 2024/05/05 23:37:00 UTC

[jira] [Created] (GROOVY-11368) SC: map access different for parameter and local variable of same type

Eric Milles created GROOVY-11368:
------------------------------------

             Summary: SC: map access different for parameter and local variable of same type
                 Key: GROOVY-11368
                 URL: https://issues.apache.org/jira/browse/GROOVY-11368
             Project: Groovy
          Issue Type: Bug
          Components: Static compilation
    Affects Versions: 3.0.21
            Reporter: Eric Milles
            Assignee: Eric Milles


Consider the following:
{code:groovy}
class C implements Map<String,String> {
    @Delegate Map<String,String> impl = [:]
}
def map = new C()
assert map.entry == null
assert map.empty == null
assert map.class == null
assert map.metaClass == null

def test(C map) {
    assert map.entry == null
    assert map.empty == null
    assert map.class == null
    assert map.metaClass == null
}
test(new C())
{code}

The method-based test fails with "class" returning the map class.  Something is different for local variable and parameter property expressions.



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