Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8366179

Implement JEP 8359894: Stable Values (Second Preview)

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • core-libs
    • None
    • source, binary, behavioral
    • high
    • Clients using Stable Values are guaranteed to come across incompatibility issues for the reasons described.
    • Java API
    • SE

      Summary

      Introduce the second preview of Stable Values. The following issues will change compared to the initial preview:

      • Move the class java.lang.StableValue to the package java.lang.invoke, to better reflect its low-level characteristics;
      • Move factory methods for lazy suppliers, lists, and maps into java.util.function.Supplier, java.util.List, and java.util.Map to enhance discoverability;
      • Disallow null as stable value contents, to improve performance and better align stable values with constructs such as unmodifiable collections and ScopedValue;
      • Remove the method StableValue::setOrThrow(), as it provides little utility over using StableValue::trySet() directly;
      • Rename StableValue::getOrThrow to the more idiomatic StableValue::get;
      • Remove stable functions as they provide marginal benefits over using stable lists and maps, and
      • Add factories for creating dense, stable value lists/arrays, allowing clients to build custom higher-order stable constructs.

      Problem

      Several factories have moved and been renamed, thus impacting existing code. The StableValue class itself has moved from java.lang to java.lang.invoke, requiring explicit import. The StableValue::setOrThrow method was removed. Null is disallowed as contents for a stable value and all its derivatives.

      Solution

      Move factories and rename methods.

      Specification

      TBW

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

              Created:
              Updated: