Superpackages and final
Paulo Levi
i30817 at gmail.com
Wed Mar 24 01:26:50 UTC 2010
Do superpackages can mark exported classes as final?
What do i mean is can i export a class "as final" instead of marking it
final.
I ask because in some situations separating a unusual object capability into
a sub-type would be advantageous memory-wise, but the type has to be final,
because of backward compatibility or design.
I'm going to give a rather radical example from java.lang: String has a
substring capability and it uses two int fields (of 3 + a char array) to do
it, when it could return a private subclass of string on substring. It
doesn't, besides serialization complications, i guess because string is
designed not be extended for immutability concerns.
Problem is final has no granularity, and is all or nothing, namespace-wise.
Well, i asked the question, but i don't have much hope.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20100324/154558f6/attachment.html>
More information about the core-libs-dev
mailing list