RFR 8014678: Spurious AccessControlException thrown in java.lang.Class.getEnclosingMethod()
Peter Levart
peter.levart at gmail.com
Wed Feb 25 14:48:57 UTC 2015
On 02/25/2015 03:26 PM, Peter Levart wrote:
> Ah, never mind. I missed the explicit access check that
> getEnclosingMethod() already performs on it's own before calling
> getDeclaredMethods(). But the check is for the same permission and
> could be performed implicitly by getDeclaredMethods() if the caller of
> getEnclosingMethod() was passed to it. Just an optimization
> opportunity therefore.
>
> Peter
Or, even a better optimization:
- leave explicit check in getEnclosingMethod() as is
- call privateGetDeclaredMethods(false) instead to iterate through methods
- return a defensive copy of just the matching Method if found
Peter
More information about the core-libs-dev
mailing list