8019622: (sl) ServiceLoadet.next incorrect when creation and usages are in different contexts
Alan Bateman
Alan.Bateman at oracle.com
Wed Jul 3 17:01:27 UTC 2013
On 03/07/2013 17:24, Remi Forax wrote:
>
> Hi Alan,
> you can use a method reference instead a lambda here,
> so
> PrivilegedAction<Boolean> action = () -> hasNextService();
> return AccessController.doPrivileged(action, acc);
> can be written
> return AccessController.doPrivileged(this::hasNextService, acc);
> (me crossing my fingers in hope that the compiler will not be confused
> by the overloads).
There is a problem using method references here that need to be tracked
down. In TypeConvertingMethodAdapter where it handles boxing then
String.format is used but that triggers the loading of formatter
providers and recursive initialization that blows the stack and
manifests as a BootstrapMethodError. I need to ask Robert about this or
bring it up on lambda-dev as I'm not sure why this doesn't happen with a
lambda. If we have a bootstrapping issue then it may be that
ServiceLoader will need to use an inner class here.
AccessController.doPrivileged does have overloads that javac reports as
ambiguous. As it happens someone made a good suggestion recently on
security-dev that the new limited doPrivlieged methods take this into
account.
-Alan.
More information about the core-libs-dev
mailing list