[jdom-interest] Verifier finality

Jason Hunter jhunter at acm.org
Thu May 16 14:45:05 PDT 2002


When I look at the Verifier code this is what I see:

final public class Verifier {

The final declarations elsewhere are extraneous, but don't harm
anything.  Guess I can remove them for stylistic reasons.

-jh-

Elliotte Rusty Harold wrote:
> 
> About half the methods in Verifier are final.  About half aren't. I was
> wondering if this makes sense.
> 
> 1. I don't think this is an optimization. All the methods are static and
> can thus be inlined by the compiler already. We don't gain anything
> extra by making them final.
> 
> 2. Do we want to allow people to subclass this class? If not, we should
> probabaly just go ahead and declare the whole class final. The class is
> implicitly final now, because the only constructor is private.If that's
> our intention, we should make it more explicit.
> 
> 3. Even if a programmer could subclass this class, they still couldn't
> choose to use their own Verifier instead of ours.
> 
> 4. I can think of one use-case for subclassing Verifier: implementing
> the looser XML 1.1 rules for names.
> 
> We need a firm story on subclassing for Verifier. Either it can't be
> subclassed, in which case we should decalre it final and remove the
> final modifier from the indivudal methods; or it can be subclassed, in
> which case we still remove the final modifier from the individual
> methods and expose the constructor as at least protected.
> 
> Thoughts?
> 
> --
> +-----------------------+------------------------+-------------------+
> | Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
> +-----------------------+------------------------+-------------------+
> |           The XML Bible, 2nd Edition (IDG Books, 2001)             |
> |             http://www.cafeconleche.org/books/bible2/              |
> |   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
> +----------------------------------+---------------------------------+
> |  Read Cafe au Lait for Java News:   http://www.cafeaulait.org/     |
> |  Read Cafe con Leche for XML News:  http://www.cafeconleche.org/   |
> +----------------------------------+---------------------------------+
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com



More information about the jdom-interest mailing list