Add lazy-constants module: LazyConstant (JEP 531) against the holder idiom and double-checked locking

Basics, failure semantics on 26 vs 27, lazy collections, API across 25/26/27, preview-flag traps and a JMH read-path benchmark (jars fetched and sha1-checked, not committed).

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TF9JWFvJSNm6HVzswzZU5a
This commit is contained in:
Claude
2026-09-24 12:27:27 +00:00
parent af44e59e7f
commit 814c32b5ce
25 changed files with 606 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
$ java --enable-preview org.openjdk.jmh.Main -f 3 -wi 3 -w 1 -i 5 -r 1 (27+35, JMH 1.37)
machine: 2 CPUs, Intel(R) Xeon(R) Processor @ 2.80GHz
Benchmark Mode Cnt Score Error Units
AccessBench.doubleCheckedLocking avgt 15 0.964 ± 0.028 ns/op
AccessBench.eagerStaticFinal avgt 15 0.648 ± 0.018 ns/op
AccessBench.holderIdiom avgt 15 0.639 ± 0.024 ns/op
AccessBench.lazyConstantInstanceField avgt 15 1.465 ± 0.065 ns/op
AccessBench.lazyConstantNonFinalStatic avgt 15 1.494 ± 0.064 ns/op
AccessBench.lazyConstantStaticFinal avgt 15 0.636 ± 0.019 ns/op