Yes, you benefit from calling PrivilegedAction with the permissions of the calling class, even if the code (in this case, the accessDeclaredField method) is called by external code that does not have these permissions.
Without using AccessController.doPrivileged , if some X code calls the ReflectionUtils API to access the declared field, and the X code does not have suppressAccessChecks security permission, then the action will end with a security exception.
Concluding the action inside AccessController.doPrivileged , ReflectionUtils notes that its action must be performed with its own permissions, even if the calling X code does not have these permissions.
source share