glaforge 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_r275374385
########## 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: `CacheAccessControlException` could perhaps also override `fillInStackTrace()` to avoid filling in the stack trace, which is an expensive operation? ---------------------------------------------------------------- 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