RFR(M) 8212605: Pure-Java implementation of AccessController.doPrivileged

dean.long at oracle.com dean.long at oracle.com
Mon Nov 5 18:51:13 UTC 2018


Hi Roger.  Thanks for looking at this.

On 11/5/18 7:21 AM, Roger Riggs wrote:
> Hi Dean,
>
> typo AccessController line788: "annocations"
>

Fixed.

> The implementations of
>
> doPrivileged(PrivilegedExceptionAction<T> action) and
> doPrivileged(PrivilegedAction<T> action)
>
> Could be a bit more similar since except for the exception wrapping 
> they are the same.
>

I was trying to make doPrivileged(PrivilegedExceptionAction<T> action)  
look like
doPrivileged(PrivilegedExceptionAction<T> action, AccessControlContext 
context), but I didn't see the point in doing that with
doPrivileged(PrivilegedAction<T> action).  Do you have a suggestion on 
how to improve it?

> 309 return executePrivileged(action, null, 
> Reflection.getCallerClass()); vs. AccessControlContext context = null;
> 548 Class <?> caller = Reflection.getCallerClass();
> 549 try {
> 550 return executePrivileged(action, context, caller);
>
> The context and caller locals aren't needed.
>

I agree, if no exception is thrown, but just in case I'd rather not do 
any extra work inside the "try" that might cause
an exception to be wrapped that shouldn't.

dl

> Thanks, Roger
>
> On 11/03/2018 04:00 PM, dean.long at oracle.com wrote:
>> I made a pass at improving the comments based on feedback I've 
>> received.  I updated webrev.4 in place, along with an incremental diff:
>>
>> http://cr.openjdk.java.net/~dlong/8212605/webrev.4.update/
>>
>> dl
>>
>> On 10/31/18 9:39 PM, Bernd Eckenfels wrote:
>>> I find the tail call optimization comment in wrapException adds only 
>>> confusion to an otherwise clear helper. But maybe it’s just me who 
>>> does not understand it.
>>
>




More information about the security-dev mailing list