Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.0-beta-6
-
None
-
None
-
Jdk1.4, OS, Linux.
Description
Let's say you have a class like so:
public class StupidClass extends HashMap
{
String myProperty = "Hello";
public String getMyProperty()
{ return myProperty; }}
If you write, in a groovy script:
obj = new StupidClass();
return obj.myProperty;
It doesn't work - it seems to look in the map for "myProperty", and if it doesn't find it, accepts failure. Instead, I have to write:
obj = new StupidClass();
return obj.getMyProperty();
What I think would be appropriate is for Groovy to check for a javabean property first, and then for the Map key.
Attachments
Issue Links
- is related to
-
GROOVY-5001 Map access is given higher precedence when trying to access fields/properties in classes which implement java.util.Map or extend java.util.HashMap or java.util.Properties
- Closed