Class ScopedValuesIncubatorNotes

java.lang.Object
net.jrodolfo.java_evolution.java20.ScopedValuesIncubatorNotes

public class ScopedValuesIncubatorNotes extends Object
Explains scoped values, introduced as an incubating API in Java 20.

ThreadLocal can pass contextual data through a call stack without adding parameters everywhere, but mutable thread-local state is easy to leak or forget to clean up. Scoped values were introduced to provide a safer model for sharing immutable context within a bounded execution scope.

The Java 20 API was incubating, so this repository documents the problem and intent without depending on the incubator module.

  • Constructor Details

    • ScopedValuesIncubatorNotes

      public ScopedValuesIncubatorNotes()
  • Method Details

    • purpose

      public String purpose()
      Explains the basic goal of scoped values.
      Returns:
      a short explanation
    • relationToThreadLocal

      public String relationToThreadLocal()
      Compares scoped values with a common older approach.
      Returns:
      a short comparison
    • projectDecision

      public String projectDecision()
      Explains why this package keeps Java 20 scoped values as notes.
      Returns:
      the project decision