Review 8035808: Eliminate dependency to GetPropertyAction and other sun.security.action convenient classes
mandy.chung at oracle.com
Fri Mar 7 23:30:36 UTC 2014
On 3/7/14 2:20 PM, Sergey Bylokhov wrote:
> On 3/8/14 12:19 AM, Mandy Chung wrote:
>> On 3/7/14 7:03 AM, Sergey Bylokhov wrote:
>>> Is this absolutely necessary? Does it mean that Get**Actions are
>>> deprecated now?
>> The question should be whether this dependency is absolutely
>> necessary and it's not. Get**Action classes are simple convenient
>> classes that you could either use lambda or implement your own one.
>> AWT and other client code in the JDK is another heavy user of
>> sun.security.action that you can consider simply have your own
>> convenient class as module-private API. If sun.security.action were
>> private to the security library, they would not be used in the client
>> code in the first place (there are external code depending on it too
>> [1 for example]). Now we are retrofitting and eliminate unnecessary
> 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"));
> (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.
Sergey - for client code, I do think it's good to eliminate such
dependency. On the other hand, as the client code (desktop module)
depends on many other internal APIs in the base module, I'll leave it as
it is and revisit it later.
More information about the core-libs-dev