Question about Value Classes and inheritance

David Alayachew davidalayachew at gmail.com
Tue Sep 23 12:19:40 UTC 2025


Hello @valhalla-dev <valhalla-dev at openjdk.java.net>,

I read through JEP 401, and the subsection about subtyping surprised me.

It appears that Abstract Value Classes can permit both Value child classes
and Identity child classes. The example of BigInteger helps explain why.

Ok, but there doesn't seem to be any way to say "only value classes can
extend me!"

Why is that?

And to be clear, I am not bothered by Abstract Value Classes permitting
Identity children, that's fine. I'm moreso confused by lack of ability to
say "only value children".

Thank you for your time and consideration.
David Alayachew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/valhalla-dev/attachments/20250923/0e0b5da0/attachment.htm>


More information about the valhalla-dev mailing list