Review 8035808: Eliminate dependency to GetPropertyAction and other sun.security.action convenient classes

Florian Weimer fweimer at redhat.com
Tue May 6 11:30:32 UTC 2014


On 03/08/2014 12:30 AM, Mandy Chung wrote:
> On 3/7/14 2:20 PM, Sergey Bylokhov wrote:
>> But after this fix: size of class files are increased, instead of
>> usage of one or two classes we get 50 new lambdas, and of course this
>> horrible cast.
>> new GetPropertyAction("user.home"));
>> vs
>> (PrivilegedAction<String>) () -> System.getProperty("user.home"));
>
> I don't like the cast either and can leave with it as the explicit
> method call is actually a plus.  JDK-8019851 will re-examine this in 9
> to bring something better.
>
> I'll need to find out from the performance team if the footprint is an
> issue.  I'll follow this up and if it turns out to be an issue, we will
> fix it differently.  The main fix here is to remove the dependency.

A javac optimization could avoid generating the helper method that 
contains the System.getProperty("user.home") call and build the lambda 
directly off System.getProperty(String).  The bytecode is likely still a 
bit larger than what we had before, but not by as much.

-- 
Florian Weimer / Red Hat Product Security Team



More information about the core-libs-dev mailing list