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:
@@ -0,0 +1,20 @@
|
||||
$ javac --enable-preview --release 27 src/Basics.java && java --enable-preview Basics (27+35)
|
||||
supplier calls before get: 0
|
||||
get() returns: loaded
|
||||
get() again: loaded
|
||||
supplier calls after two gets: 1
|
||||
16 threads asked at once, supplier calls: 1
|
||||
|
||||
$ javac --enable-preview --release 27 src/ToStringStates.java && java --enable-preview ToStringStates (27+35)
|
||||
before get: [computing function=ToStringStates$$Lambda]
|
||||
after get: [loaded]
|
||||
after failed get: [failed with=java.lang.IllegalStateException]
|
||||
|
||||
$ javac --enable-preview --release 27 src/Service.java && java --enable-preview Service (27+35)
|
||||
service created
|
||||
[load] reading configuration
|
||||
url: https://example.test
|
||||
url again: https://example.test
|
||||
[compile] building the e-mail pattern
|
||||
isEmail([email protected]): true
|
||||
isEmail(nope): false
|
||||
Reference in New Issue
Block a user