On Wed, Nov 17, 2021 at 7:05 PM Dan Heidinga <heidi...@redhat.com> wrote:
Let me turn the question around: What do we gain by allowing > subclassing of B2 classes? > I'm not claiming it's much. I'm just coming into this from a different direction. In my experience most immutable (or stateless) classes have no real interest in exposing identity, but just get defaulted into it. Any dependency on the distinction between one instance and another that equals() it would be a probable bug. When B2 exists I see myself advocating that a developer's first instinct should be to make new classes in B2 except when they *need* something from B1 like mutability (and perhaps subclassability belongs in this list too!). As far as I can tell, this makes sense whether there are even *any *performance benefits at all, and the performance benefits just make it a lot more *motivating* to do what is already probably technically best anyway. Now, if subclassability legitimately belongs in that list of B1-forcing-factors, that'll be fine, I just hadn't fully thought it through and was implicitly treating it like an open question, which probably made my initial question in this subthread confusing. -- Kevin Bourrillion | Java Librarian | Google, Inc. | kev...@google.com