On 07/03/2014 11:39, Peter Levart wrote:
Maybe, if PrivilegedAction interface could be retrofitted as follows:
public interface PrivilegedExceptionAction<T> {
T run() throws Exception;
}
public interface PrivilegedAction<T> extends
PrivilegedExceptionAction<T> {
@Override
T run();
}
Then in majority of cases where lambda body did not throw a checked
exception, the most-specific rule would choose the
doPrivileged(PrivilegedAction) method automatically... For
checked-exceptional-cases the cast would still be needed.
There was a discussion on security-dev about this some time ago and this
bug created:
https://bugs.openjdk.java.net/browse/JDK-8019851
I hope it will be looked at again in 9 as it is an inconvenience in the
JDK (but perhaps not as much outside of the JDK where it's not going to
be used very much).
-Alan.