A bit of sugar for j.u.c.locks with try-with-resources?

joe darcy joe.darcy at oracle.com
Sat Sep 3 16:33:34 UTC 2016


On 9/3/2016 12:27 AM, Krystal Mok wrote:
> Hi David,
>
> Thanks for the link! I'd reckon it's been brought up before, but I guess I
> didn't use the right keywords to get a good search. That's good enough
> history for me. It explains every issue I've thought about.
>
> The new Java 9 TWR syntax is still fairly limited, in that it still doesn't
> support the try (locker(lock)) { ... } usage. The new TWR syntax was just
> extended to allow effectively final variables in the TWR header...
>
>

Originally try-with-resources allowed a general expression to be given 
for the resource. This was found to be problematic and thus the 
structure was limited to working on variables, originally fresh 
variables as in 7, now alternatively final and effectively final 
variables as of 9.

Please see the coin-dev archives for discussions of this point.

Cheers,

-Joe


More information about the core-libs-dev mailing list