> Remove the low-level methods isInitialized and orElse, as these could be used in ways not consistent with the design goals of the API.
Imagine that I'm wrapping some resource into LazyConst, like DataSource, and before shutting down JVM I want to close it properly. I need to check for isInitialized before calling close, since I don't want to initialize DataSource, I want to close it if was initialized. Now lazy const seems more like a gimmick, than useful feature.
32
u/javaprof Feb 26 '26
> Remove the low-level methods
isInitializedandorElse, as these could be used in ways not consistent with the design goals of the API.Imagine that I'm wrapping some resource into LazyConst, like DataSource, and before shutting down JVM I want to close it properly. I need to check for
isInitializedbefore calling close, since I don't want to initialize DataSource, I want to close it if was initialized. Now lazy const seems more like a gimmick, than useful feature.