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/04/15 13:55:39 UTC

[GitHub] [groovy] danielsun1106 commented on a change in pull request #905: GROOVY-8339: Fix warning "An illegal reflective access operation has …

danielsun1106 commented on a change in pull request #905: GROOVY-8339: Fix warning "An illegal reflective access operation has …
URL: https://github.com/apache/groovy/pull/905#discussion_r275371976
 
 

 ##########
 File path: src/main/java/org/codehaus/groovy/reflection/AccessPermissionChecker.java
 ##########
 @@ -59,13 +60,28 @@ static void checkAccessPermission(Method method) {
         }
     }
 
+    static void checkAccessPermission(Constructor constructor) {
+        try {
+            checkAccessPermission(constructor.getDeclaringClass(), constructor.getModifiers(), constructor.isAccessible());
+        } catch (AccessControlException e) {
+            throw createCacheAccessControlExceptionOf(constructor, e);
+        }
+    }
+
     private static CacheAccessControlException createCacheAccessControlExceptionOf(Method method, AccessControlException e) {
         return new CacheAccessControlException(
                 "Groovy object can not access method " + method.getName()
                         + " cacheAccessControlExceptionOf class " + method.getDeclaringClass().getName()
                         + " with modifiers \"" + Modifier.toString(method.getModifiers()) + "\"", e);
     }
 
+    private static CacheAccessControlException createCacheAccessControlExceptionOf(Constructor constructor, AccessControlException e) {
+        return new CacheAccessControlException(
 
 Review comment:
   Thanks for your reviewing the PR.
   I understand your worries ;-)  Actually the exception will be only thrown if illegal access happens when the accessible object is accessed.
   

----------------------------------------------------------------
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