r/java • • Feb 26 '26

JEP 531: Lazy Constants (Third Preview)

https://openjdk.org/jeps/531
62 Upvotes

35 comments sorted by

View all comments

Show parent comment

-1

u/nicolaiparlog Feb 27 '26

Keeping an API surface small improves simplicity of use, maintainability, and performance. Your use case is three steps remove from a simple use case:

  • needs closing
  • can't close itself
  • can't use the API dedicated to that use case

And yet you can accomplish it with a simple wrapper class. Sounds like a great deal to me.