RFR: 8356080: Address post-integration comments for Stable Values [v3]

Luca Kellermann duke at openjdk.org
Mon May 12 21:15:04 UTC 2025


On Mon, 12 May 2025 19:53:41 GMT, Luca Kellermann <duke at openjdk.org> wrote:

>> Per Minborg has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 386 commits:
>> 
>>  - Address comments
>>  - Merge branch 'master' into jep502-followup
>>  - Fix an issue with toString on nested constructs
>>  - Merge branch 'master' into jep502-followup
>>  - Merge branch 'master' into jep502-followup
>>  - Update src/java.base/share/classes/java/lang/StableValue.java
>>    
>>    Co-authored-by: Chen Liang <liach at openjdk.org>
>>  - Simplify furhter
>>  - Address comments in PR
>>  - Merge master
>>  - Remove unused method and add comment
>>  - ... and 376 more: https://git.openjdk.org/jdk/compare/43008b42...a2826336
>
> src/java.base/share/classes/java/util/ImmutableCollections.java line 518:
> 
>> 516: 
>> 517:         private boolean allowNulls() {
>> 518:             return root instanceof ListN<?> listN && listN.allowNulls;
> 
> I think this should stay here (or some other change is needed). `StableSubList` doesn't override `indexOf` and `lastIndexOf`, so they will throw when given `null`, even though the list could contain `null`.

Example code that I think will fail with the changes in this PR:

var list = StableValue.list(42, x -> x == 23 ? null : x);
IO.println(list.indexOf(null)); // 23
IO.println(list.subList(10, 30).indexOf(null)); // NPE, should be 13

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25004#discussion_r2085512298


More information about the core-libs-dev mailing list