groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [groovy] melix commented on a change in pull request #905: GROOVY-8339: Fix warning "An illegal reflective access operation has …
Date Mon, 15 Apr 2019 13:30:31 GMT
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:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message