[10?] RFR: 8193128: Reduce number of implementation classes returned by List/Set/Map.of()

Paul Sandoz paul.sandoz at oracle.com
Thu Dec 7 01:16:18 UTC 2017

> On 6 Dec 2017, at 16:12, Claes Redestad <claes.redestad at oracle.com> wrote:
>>   and i do not understand why the field size is not declared @Stable anymore,
>>   ok, it can be equals to zero, but in that case the JIT will emit a move
>>   so it's better than always asking for a move (or i do not understand the semantics of @Stable ?)
> Hmm, I'm under the impression @Stable brings no additional value to a final non-array fields (definitely important for arrays).

It can, since final fields are not treated as really final (unless in java.lang.invoke package, where it’s as if all such fields are annotated with @Stable). C2 will treat the field value a constant value if the collection is held in a static final field.


> I might have been guilty of adding @Stable to more fields than necessary in these implementations in the first place. I've
> reverted this removal and will add a note to investigate separately if we can more systematically clean them up.
> http://cr.openjdk.java.net/~redestad/8193128/open.01/
> Thanks!
> /Claes

More information about the core-libs-dev mailing list