danielsun1106 commented on a change in pull request #1674:
URL: https://github.com/apache/groovy/pull/1674#discussion_r780601820



##########
File path: src/main/java/groovy/lang/MetaClassImpl.java
##########
@@ -2085,73 +2089,65 @@ public void setProperty(Object object, Object newValue) 
{
         checkInitalised();
 
         
//----------------------------------------------------------------------
-        // turn getProperty on a Map to get on the Map itself
+        // getter
         
//----------------------------------------------------------------------
-        if (!isStatic && this.isMap) {
-            return new MetaProperty(name, Object.class) {
-                @Override
-                public Object getProperty(Object object) {
-                    return ((Map) object).get(name);
-                }
-
-                @Override
-                public void setProperty(Object object, Object newValue) {
-                    throw new UnsupportedOperationException();
-                }
-            };
-        }
-
         Tuple2<MetaMethod, MetaProperty> methodAndProperty = 
createMetaMethodAndMetaProperty(sender, theClass, name, useSuper, isStatic);
         MetaMethod method = methodAndProperty.getV1();
 
-        
//----------------------------------------------------------------------
-        // getter
-        
//----------------------------------------------------------------------
-        MetaProperty mp = methodAndProperty.getV2();
+        if (method == null || "class".equals(name) || (isMap && 
"empty".equals(name))) {

Review comment:
       It's better to extract the common checking logic, here is same code at 
line 1981:
   `if (method == null || "class".equals(name) || (isMap && 
"empty".equals(name)))`




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to