Implement JEP 8376595: Lazy Constants (Third Preview)

XMLWordPrintable

    • Type: CSR
    • Resolution: Unresolved
    • Priority: P4
    • 27
    • Component/s: core-libs
    • None
    • medium
    • Usage of the removed methods `LazyConstant::isInitialized` and `LazyConstant::orElse` would result in a compile-time error.
    • Java API
    • SE

      Summary

      This API was first previewed in JDK 25 via JEP 502: Stable Values and then in JDK 26 via JEP 526 Lazy Constants. Based on experience and feedback, we propose to remove two methods from LazyConstant and add support for lazy sets.

      Problem

      The methods LazyConstant::isInitialized and LazyConstant::orElse could result in usages that were outside the design goals of the Lazy Constant API.

      There was support for lazy lists and maps, but not for lazy sets.

      Solution

      • Remove the LazyConstant::isInitialized and LazyConstant::orElse methods.

      • Add a new factory method Set::ofLazy that allows the creation of lazy sets.

      Specification

      See attachment.

            Assignee:
            Per-Ake Minborg
            Reporter:
            Per-Ake Minborg
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: