tmortagne commented on code in PR #54:
URL: https://github.com/apache/velocity-engine/pull/54#discussion_r1793108303


##########
velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/MethodMap.java:
##########
@@ -387,9 +393,52 @@ public static Method getTopMostMethodDeclaration(Method 
method)
             }
             clazz = superClass;
         }
+
         return method;
     }
 
+    private static boolean canAccess(Method method)
+    {
+        // Check if the method is public
+        if (Modifier.isPublic(method.getModifiers())) {
+            if (method.isAccessible()) {
+                // The method accessible flag was already set to true so we 
assume we can call it
+                return true;
+            } else {
+                try {
+                    // Check if we are able to change the accessible flag
+                    if (trySetAccessible(method)) {
+                        // Restore the accessible flag to its former value
+                        method.setAccessible(false);

Review Comment:
   Just a reflex to keep things as they were before I start messing with it for 
what is supposed to be just a check. Just in case.



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

To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org

Reply via email to