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

 ##########
 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:
   I feel like using an exception here is likely to have a huge impact on 
performance, given that you might throw an exception for each method. The 
problem is that it's going to fill the stack trace everytime here. Would be 
good to do some measurements.

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