Designing for value types

David Lloyd david.lloyd at redhat.com
Wed Jun 6 13:51:08 UTC 2018


There are various classes in the JDK which follow certain practices,
seemingly in the hopes of being "value-ready".  These practices
include things like:

• No public constructors (use static factory methods instead)
• Make the type `final`
• No inheritance (probably? prefer composition I guess?)
• No mutable state

Understanding that it is still "early days" and that things can still
change dramatically, is it realistic to expect that classes designed
to the above rules can more or less seamlessly transition to value
classes in a future JDK?  Is there a definitive list of additional
things an API can do to anticipate value types, minimizing the
likelihood of transition problems, or is it categorically too soon to
tell?

-- 
- DML


More information about the amber-dev mailing list