RFR 8073056: Repeating annotations throws java.security.AccessControlException with a SecurityManager
Joel Borggrén-Franck
joel.franck at oracle.com
Wed Feb 25 13:19:10 UTC 2015
Hi,
> On 25 feb 2015, at 13:16, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> On Feb 25, 2015, at 12:59 PM, Joel Borggrén-Franck <joel.franck at oracle.com> wrote:
>
>> Hi Paul,
>>
>> Yes that would indeed be possible, but after some internal discussions we though it safer to reuse the Proxy invocation path.
>>
>
> Ok, i claim ignorance as to why that is so :-)
>
> Is there any performance impact since all code will go through the proxy? It might be possible to check if the security manager is enabled before going through that path?
Arguably this should actually be faster. For all “our” annotations the Proxy invocation handler will be the final invoker anyway, so this is just cutting out the middle.
> If not I think you should add a comment on the effectively dead code path of direct method invocation.
>
Agreed.
>
> 213 } catch (IllegalAccessException | // couldn't loosen security
> 214 IllegalArgumentException | // parameters doesn't match
> 215 InvocationTargetException | // the value method threw an exception
> 216 ClassCastException e) {
>
> 217 throw invalidContainerException(container, e);
> 218 } catch (Throwable t) { // from InvocationHandler::invoke
> 219 throw invalidContainerException(container, t);
> 220 }
> 221 }
> 222
>
> You could compress all this down to just catching Throwable. It seems quite a large net that may inadvertently catch other runtime exceptions.
InvocationHandler::invoke unfortunately throws Throwable, but I restructured it a bit so it is easier to follow.
http://cr.openjdk.java.net/~jfranck/8073056/webrev.01/
cheers
/Joel
More information about the core-libs-dev
mailing list