RFR: 8330465: Stable Values and Collections (Internal) [v5]

Chen Liang liach at openjdk.org
Wed May 15 16:36:07 UTC 2024


On Mon, 6 May 2024 19:31:43 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/lang/StableArray.java line 25:
>> 
>>> 23:  * @since 23
>>> 24:  */
>>> 25: public sealed interface StableArray<V>
>> 
>> Do we have a use case for StableArray beyond those of StableList?
>
> I am trying to model multi-dimensional arrays that also provide flattening. Let's see if it becomes useful.

I think this StableArray can be used as an explicit field type to block reflection modifications and enforce constant-folding; the List interface cannot. Though in long term I still believe strict final fields are better.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18794#discussion_r1601931752


More information about the compiler-dev mailing list