Github user jwagenleitner commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/532#discussion_r116365210
  
    --- Diff: src/main/org/codehaus/groovy/reflection/CachedField.java ---
    @@ -51,6 +52,12 @@ public int getModifiers() {
          */
         public Object getProperty(final Object object) {
             try {
    +            AccessPermissionChecker.checkAccessPermission(field);
    +        }
    +        catch (AccessControlException ex) {
    +            throw new IllegalArgumentException("Illegal access to field" + 
" " + field.getName());
    --- End diff --
    
    Any reason for using `IllegalArgumentException`?  I think the following may 
be more appropriate:
    
    ```java
    throw new GroovyRuntimeException("Illegal access to field " + 
field.getName() + ".", ex);
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to