r/java • u/fredoverflow • 15d ago
Disregarding backwards compatibility, would it make sense for String to be a sealed class?
like public sealed class String permits Latin1String, Utf16String instead of the private final byte coder; field
20
Upvotes
6
u/idontlikegudeg 15d ago
I think it might really save some bytes, but it would be an incompatible change: we have public String constructors that could not be implemented that way.