Example files

Article: https://youdozi.github.io/en/posts/2026-10-31-jdk25-scopedvalue/

Extract into a new empty directory and run commands from that directory.

Environment
JDK 25 with matching javac/java. Observed on Eclipse Temurin 25.0.5+8, macOS AArch64. No preview flags, external dependencies or network requests from the program.

Commands
javac --release 25 ScopedContextExample.java
java ScopedContextExample

Scope
Runs a request in a virtual thread; observes nested binding, normal/exception restoration, a plain virtual child without inheritance and unbound access. Does not execute StructuredTaskScope preview inheritance, framework/MDC/security integration, production rollout or performance measurements.

Read the article for outputs, conditions and failure cases. PROVENANCE.json records the source and file hashes; hashes establish identity, not correctness.
