JDK 9 RFR of JDK-8078468: Update security libraries to use diamond with anonymous classes

Joseph D. Darcy joe.darcy at oracle.com
Fri Apr 24 01:45:29 UTC 2015


Hi Max,

On 4/23/2015 5:33 PM, Weijun Wang wrote:
> Hi Joe
>
> The changes look good.
>
> I remember last time when Stuart updated JDK to use diamond there was 
> a rule that if the assignment of a variable is a little far from its 
> definition, then we don't use diamond. It seems we are not obeying it 
> anymore?

A few of the changes in the patch were of the form

     List<Foo> foos = new ArrayList<Foo>();
         =>
     List<Foo> foos = new ArrayList<>();

but in most cases a type hint wasn't on the same line. When diamond was 
first introduced in JDK 7 circa 2010 - 2011, I think developers were 
less certain of when to use the feature. After a few years to get 
familiar with it, I think more aggressive diamond use is fine, 
especially since tooling support should already be in place to view the 
inferred type bounds if interested (I know NetBeans has long had such a 
feature).

Thanks for the review.

-Joe

>
> Thanks
> Max
>
> On 4/24/2015 6:34 AM, Joseph D. Darcy wrote:
>> Hello,
>>
>> Please review the straightforward changes to address
>>
>>      JDK-8078468: Update security libraries to use diamond with
>> anonymous classes
>>      http://cr.openjdk.java.net/~darcy/8078468.0/
>>
>> This patch combines two kinds of updates; the first to use traditional
>> diamond available since JDK 7 and the second to use diamond with
>> anonymous classes, a feature now available in JDK 9. As with core
>> libraries (JDK-8078467), many of the uses of the new feature are
>> locations where "new PrivilegedAction" is used.
>>
>> The diamond location candidates were found using a finder built into 
>> javac.
>>
>> Thanks,
>>
>> -Joe



More information about the security-dev mailing list