RFR: 8216403: Allocate fewer EnumSets in JavacFileManager#list

Liam Miller-Cushon cushon at google.com
Wed Jan 9 16:50:00 UTC 2019

On Wed, Jan 9, 2019 at 1:42 AM Claes Redestad <claes.redestad at oracle.com>

> not really a langtools reviewer, but I generally avoid using raw
> static EnumSets due their mutable nature (not saying there's a bug
> here - just that we should consider all possible futures and treat them
> kindly).
> Set.of() / Set.of(FOLLOW_LINKS) is a compact, performant and safer
> alternative.

Done, thanks: http://cr.openjdk.java.net/~cushon/8216403/webrev.01/ (I also
gave 'sourceOrClass' the same treatment.)

I used EnumSet initially because it usually performs better than
general-purpose sets, but I suppose it doesn't have much of an advantage
over Set.of for a one-element set.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20190109/7ce81256/attachment.html>

More information about the compiler-dev mailing list