You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by GitBox <gi...@apache.org> on 2019/07/03 06:54:18 UTC

[GitHub] [groovy] danielsun1106 commented on a change in pull request #934: GROOVY-9103: CLONE - CLONE - Fix warning "An illegal reflective acces…

danielsun1106 commented on a change in pull request #934: GROOVY-9103: CLONE - CLONE - Fix warning "An illegal reflective acces…
URL: https://github.com/apache/groovy/pull/934#discussion_r299800475
 
 

 ##########
 File path: src/main/java/groovy/lang/MetaClassImpl.java
 ##########
 @@ -2207,11 +2210,34 @@ private static MetaMethod getCategoryMethodSetter(Class sender, String name, boo
 //                    element = new MetaBeanProperty(mp.getName(), mp.getType(), null, mp.getSetter());
 //                }
             }
+
+            if (!ALLOW_ILLEGAL_ACCESS_PROPERTIES) {
+                if (element instanceof MetaBeanProperty) {
+                    MetaBeanProperty mbp = (MetaBeanProperty) element;
+                    boolean getterAccessible = canAccessLegally(mbp.getGetter());
+                    boolean setterAccessible = canAccessLegally(mbp.getSetter());
+
+                    if (!(getterAccessible && setterAccessible)) continue;
+                }
+            }
+
             ret.add(element);
         }
         return ret;
     }
 
+    private static final boolean ALLOW_ILLEGAL_ACCESS_PROPERTIES = SystemUtil.getBooleanSafe("groovy.allow.illegal.access.properties");
 
 Review comment:
   Thanks for you reviewing the PR, Paul :)
   
   I wish I had caught the points:
   1) Rename `groovy.allow.illegal.access.properties`  to `groovy.permissive.property.access`
   2) Add an instance property whose value is initialized by the system property `groovy.permissive.property.access`, we use the instance property to control the illegal access to properties

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services