What methods should go into a java.util.Objects class in JDK 7?
Thomas.Hawtin at Sun.COM
Mon Oct 12 04:54:38 PDT 2009
Joseph D. Darcy wrote:
> Classes with only private constructors, like j.u.Objects, are
> effectively final. Adding final is harmless but unnecessary in these
> cases. The platform is a bit inconsistent here; j.u.Collections is
> *not* marked final while j.l.Math is.
For a certain value of effective. *Current* *Java* *source* may not
subclass a non-final class with only private constructors. I believe a
verfiable subclass can be created as a class file that does not have a
constructor (or possibly definitely throws an exception?). Unless
something is seriously wrong, that shouldn't cause a security issue. It
might be an issue for other languages on the JVM.
> In practice, it doesn't matter
> very much; I'll consider final-izing j.u.Objects on the next round of
Oh don't put a finalizer on it. ;)
More information about the core-libs-dev