[ https://issues.apache.org/jira/browse/GROOVY-6067?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Schumacher resolved GROOVY-6067. --------------------------------------- Resolution: Fixed Assignee: Pascal Schumacher (was: Cédric Champeau) Fix Version/s: 2.4.6 Script works with 2.4.6, therefore I'm resolving this issue. > MetaClassImpl triggers new entries for maps with default > -------------------------------------------------------- > > Key: GROOVY-6067 > URL: https://issues.apache.org/jira/browse/GROOVY-6067 > Project: Groovy > Issue Type: Bug > Components: groovy-jdk > Affects Versions: 1.8.9, 2.1.2 > Reporter: Cédric Champeau > Assignee: Pascal Schumacher > Fix For: 2.4.6 > > > The following code: > {code} > def map = [:].withDefault { 'foo' } > Map.metaClass.bar = { -> 'ok' } > assert map.bar() == 'ok' > assert !map.containsKey('bar') > println map.keySet() > {code} > Fails at the second assertion, because MetaClassImpl triggers an unexpected > get() into the map. > Note that the behaviour is not the same if you use a per instance MC, which > probably means inconsistencies... -- This message was sent by Atlassian JIRA (v6.3.4#6332)