On Wed, 15 May 2024 16:25:04 GMT, Chen Liang <li...@openjdk.org> wrote:

>> Per Minborg has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Switch to monomorphic StableValue and use lazy arrays
>
> src/java.base/share/classes/jdk/internal/lang/StableValue.java line 384:
> 
>> 382:      * @param <T>      the memoized type
>> 383:      */
>> 384:     static <T> Supplier<T> ofSupplier(Supplier<? extends T> original) {
> 
> `ofSupplier` sounds like this method returns a `StableValue` from a 
> `Supplier`. I recommend another name, such as `stableSupplier`, 
> `wrapSupplier`, or `memoize`, to better associate with the method's types.

One alternative would be to expose the types `StableList` and `StableMap`. This 
would allow detection of these types if declared. This would also allow us to 
expose the methods `computeIfUnset` as instance methods and remove the somewhat 
strange static counterparts. I agree strict finals are better in the long run.

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

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

Reply via email to