Created
December 9, 2013 09:37
-
-
Save davidecavestro/7869714 to your computer and use it in GitHub Desktop.
Property resolution clash for Map subclasses:
http://groovy.329449.n5.nabble.com/Property-resolution-clash-for-Map-subclasses-td5717713.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo extends AbstractMap<Object, Object>{ | |
String bar | |
def map = [:] | |
String getBar () {bar} | |
//map impl | |
public Set entrySet() {map.entrySet()} | |
} | |
Foo foo = new Foo (bar: 'baz') | |
assert foo.getBar() == 'baz' //WORKS | |
assert foo.bar == 'baz' //FAILS because foo.bar is NULL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment