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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to