r/java • u/nlisker • Jul 14 '26
New candidate JEP: 401: Value Objects (Preview)
https://mail.openjdk.org/archives/list/valhalla-dev@openjdk.org/thread/IUNJJ3WP3X3XHP3QZTXXSSCPKFDNTK3W/
87
Upvotes
View all comments
Show parent comment
4
u/vytah Jul 15 '26
I guess you could stuff all the other fields of String into the beginning of its data array, leaving only a single final field, and therefore make it eligible for Valhalla treatment. But:
==anyway (it'd only compare data array references)Also I suspect there's more code that locks on strings than on any candidate value type, so valhallizing strings would break stuff.