On 03/20/2017 12:54 PM, Peter Levart wrote:


On 03/20/2017 12:42 PM, Peter Levart wrote:
Currently core reflection throws InternalError (because of the check in Reflection::ensureMemberAccess). But jake repo already contains changes that remove this check and NPE is thrown later on in verifyModuleAccess...

Regards, Peter

...it is actually even more erratic. If the invocation of core reflection is performed from JNI with no caller on a freshly constructed Member object, then the call often always succeeds (unless the member is protected instance member accessed from subclass), because AccessibleObject cache with no cached entry is mistakenly treated as 'null' caller. If the Member object is 1st used from a non-null caller, only then InternalError is thrown when such Member is later invoked from JNI with no caller.

Regards, Peter


Perhaps the best way to rectify those problems in one place would be for Reflection.getCallerClass() to return a special internal class in its own package, such as:

jdk.internal.solitary.NoCaller

...when there is no caller. This would work correctly for class loader checks and would only allow invoking public exported members by core reflection if invoked with no caller...


What do you think?


Regards, Peter

Reply via email to