vendredi 25 décembre 2020

MethodHandle cross ClassLoader method calls

The documentation of MethodHandles#Lookup says the following:

If the retrieved member is not public, smgr.checkMemberAccess(defc, Member.DECLARED) is called. (Note that defc might be the same as refc.) The default implementation of this security manager method inspects the stack to determine the original caller of the reflective request (such as findStatic), and performs additional permission checks if the class loader of defc differs from the class loader of the class from which the reflective request came.

So currently its not possible to invoke a method that has been loaded by a different ClassLoader. Is it possible to bypass this? Or should I just stick to normal reflection.





Aucun commentaire:

Enregistrer un commentaire