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

John Rose john.r.rose at oracle.com
Thu Dec 7 19:50:01 UTC 2017

> On Dec 6, 2017, at 5:16 PM, Paul Sandoz <paul.sandoz at oracle.com> wrote:
> 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.

We could tweak the semantics of @Stable to omit the zero corner case for a final field. Then the annotation on a non-array field would mean “trust this final”.

It would be yet another stop gap before that far-off day when we fix finals (and arrays). Such new uses of @Stable would have to be evaluated for any interaction with deserialization, so it’s not a simple decision. 

More information about the core-libs-dev mailing list