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

Implementation of Scoped Values (Fourth Preview)

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 24
    • None
    • core-libs
    • b23

      Implementation changes for 4th preview of Scoped Values. The API is proposed to continue as a preview API in this release.

      We have tried a few ways to bind a scoped value, and currently have two ways to do it. These are

      ScopedValue.runWhere(aScopedValue, aValue, aRunnable);

      and

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

      The latter has the advantage that it can be chained thusly:

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

      We can make the scoped value 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.

            aph Andrew Haley
            aph Andrew Haley
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: