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

Implementation of Scoped Values (Fourth Preview)

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 24
    • core-libs
    • None
    • source, binary
    • minimal
    • Changes to preview features have minimal compatibility risk.
    • Java API
    • SE

      Summary

      Remove the old java.lang.ScopedValue "convenience methods" runWhere and callWhere, leaving only the "fluent" API.

      Problem

      There are currently two ways to bind a scoped value:

      ScopedValue.runWhere(aScopedValue, aValue, aRunnable);

      and

      ScopedValue.where(aScopedValue, aValue).run(aRunnable);

      The latter has the advantage that it can be chained;

      ScopedValue.where(aScopedValue, aValue).where(anotherScopedValue, anotherValue).run(aRunnable);

      We can make the ScopedValue API smaller and simpler, as well as making code using scoped values easier to read, by only retaining the latter of the two ways to do it.

      Solution

      Remove ScopedValue.runWhere(ScopedValue, Object, Runnable) and ScopedValue.callWhere(ScopedValue, Object, CallableOp).

      Specification

      See the attached apidiff.

            aph Andrew Haley
            aph Andrew Haley
            Alan Bateman, Chen Liang
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: