core classes still need to be declared final?
Nick Radov
nradov at axolotl.com
Mon Jan 7 21:31:58 UTC 2008
Is it still necessary for the core Java classes such as java.lang.Integer
to be declared final? I understand that may have been necessary in the
early days for performance reasons, but modern JVMs no longer provide much
of a performance benefit for final classes. For certain applications it
would really be helpful to be able to subclass some of those core classes.
For example, one application I'm working on deals with integer values that
must be between 0 and 9999 inclusive. I would like to be able to create a
custom Integer subclass which enforces that limit in the constructor, but
currently that isn't possible. While I could create a new class that acts
as a wrapper around Integer, the syntax would be much more awkward and
that would also make it much more difficult to interface with other
third-party classes.
Nick Radov | Research and Development Manager | Axolotl Corp
www.axolotl.com, d: 408.920.0800 x116, f: 408.920.0880
160 West Santa Clara St., Suite 1000, San Jose, CA, 95113
THE MARKET LEADER IN HEALTH INFORMATION EXCHANGE ? PROVIDING PATIENT
INFORMATION WHEN AND WHERE IT IS NEEDED.
The information contained in this e-mail transmission may contain
confidential information. It is intended for the use of the addressee. If
you are not the intended recipient, any disclosure, copying, or
distribution of this information is strictly prohibited. If you receive
this message in error, please inform the sender immediately and remove any
record of this message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/core-libs-dev/attachments/20080107/ae94951a/attachment.html>
More information about the core-libs-dev
mailing list