On Wed, 13 Aug 2025 11:51:29 GMT, Per Minborg <pminb...@openjdk.org> wrote:
>> This PR proposes to release the underlying function if a stable function or >> collection has invoked its underlying supplier exhaustively so that it can >> be collected. >> >> This PR passes tier1, tier2, and tier3 testing on multiple platforms. > > Per Minborg has updated the pull request incrementally with two additional > commits since the last revision: > > - Update > src/java.base/share/classes/jdk/internal/lang/stable/StableFunction.java > > Co-authored-by: Viktor Klang <viktor.kl...@oracle.com> > - Update > src/java.base/share/classes/jdk/internal/lang/stable/StableEnumFunction.java > > Co-authored-by: Viktor Klang <viktor.kl...@oracle.com> src/java.base/share/classes/java/util/ImmutableCollections.java line 140: > 138: public <E> List<E> stableList(int size, IntFunction<? > extends E> mapper) { > 139: // A stable list is not Serializable, so we cannot > return `List.of()` if `size == 0` > 140: return new StableList<>(size, new > UnderlyingHolder<>(mapper, size)); I personally think it's better (if possible) that the constructor instantiates the UnderlyingHolder, it also makes it much more tractable to ensure that there's consistency between what's in the class and what goes into the UnderlyingHolder. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25878#discussion_r2273312209