At 04:08 AM 7/30/2003 -0400, you wrote:
It's worth noting that of the 12 people* I have posed this question to only one got it right.
Making the utility class final does prevent confusion (and viciously hard to debug errors) for lower standard devlopers - at the cost of preventing some more aware developers subclassing just to add more static utility methods.
Since this is the sort of thing only some one who knows what they are doing should be up to they hopefully would know enough to either
a) change the source to add the new methods themselves b) the above but pass the patches back to Jakarta
question comes down to how prescriptive the commiters feel like being in the intersts of reducing error reports and users problems on Commons User...
*all with min 3 months java knowledge some considered themselves excellent java developers
Matt
> -----Original Message----- > From: Gary Gregory [mailto:[EMAIL PROTECTED] > Sent: 29 July 2003 23:01 > To: 'Jakarta Commons Developers List' > Subject: RE: [lang] DEVELOPERS-GUIDE.html > > > Ah, but not really... ;-) > > A subclass cannot override methods that are declared static in the > superclass. In other words, a subclass cannot override a > class method. A > subclass can /hide/ a static method in the superclass by > declaring a static > method in the subclass with the same signature as the static > method in the > superclass. Overriding only applies to instance methods, class methods > behave differently (ah, longing for Smalltalk). A class method can be > /shadowed/ by a subclass but not overridden (not to be > confused with method > overloading of course ;-) > > Here is a fun experiment with statics that always comes and > bites you in the > you-know-where: > > package test; > > class SubC extends SuperC { > static String hi() { > return "I am Sub"; > } > } > > class SuperC extends Object { > static String hi() { > return "I am Super"; > } > } > > public class TestSuperStatic { > > public static void main(String[] args) { > SuperC a = new SuperC(); > SubC b = new SubC(); > SuperC c = b; > System.out.println(a.hi() + ", " + a.getClass()); > System.out.println(b.hi() + ", " + b.getClass()); > System.out.println(c.hi() + ", " + c.getClass()); > } > > } > > Can you guess what gets printed out? :-) > > (and no cheating by running the code!) > > Gary > > -----Original Message----- > From: Stephen Colebourne [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 29, 2003 14:30 > To: Jakarta Commons Developers List > Subject: Re: [lang] DEVELOPERS-GUIDE.html > > In this use case, everybody uses UString, so you can > effectively override. > > If you code the same method in the 'subclass', and refer to > it using the > subclass class then it will be called. > > Stephen > > ----- Original Message ----- > From: "Gary Gregory" <[EMAIL PROTECTED]> > > When you do that, do remember that you cannot override > static methods in > the > > same way that you can with instance methods. > > > > Gary > > > > -----Original Message----- > > From: Stephen Colebourne [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, July 29, 2003 14:07 > > To: Jakarta Commons Developers List > > Subject: Re: [lang] DEVELOPERS-GUIDE.html > > > > Because I want to create a subclass of StringUtils. > > > > Use case: > > I curently have a string utility class named UString. > > I plan to change that to extend StringUtils once 2.0 is released. > > (Because I'll get lots of extra methods for free) > > But I can only do that if StringUtils is not final. > > > > Stephen > > > > > > ----- Original Message ----- > > From: "Henri Yandell" <[EMAIL PROTECTED]> > > To: "Jakarta Commons Developers List" > <[EMAIL PROTECTED]> > > Sent: Tuesday, July 29, 2003 7:46 PM > > Subject: Re: [lang] DEVELOPERS-GUIDE.html > > > > > > > > > > Question just came up on [io]. > > > > > > Why do we not make our XxxUtil classes final again? :) > Anyone remember > or > > > should I trawl through the mail from last year? > > > > > > Hen > > > > > > On Tue, 29 Jul 2003 [EMAIL PROTECTED] wrote: > > > > > > > Plus1 > > > > Stephen > > > > > > > > > from: Henri Yandell <[EMAIL PROTECTED]> > > > > > date: Tue, 29 Jul 2003 14:00:23 > > > > > to: [EMAIL PROTECTED] > > > > > subject: Re: [lang] DEVELOPERS-GUIDE.html > > > > > > > > > > > > > > > Just noticed that DEVELOPERS-GUIDE.html doesn't > mention whether our > > > > > XxxUtils class should be final or not. I'm pretty > sure we ended up > > making > > > > > them not final. Anyone object to this before I add a > line to the > > guide? > > > > > > > > > > Hen > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > > > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] >
************************************************************************** The information transmitted herewith is sensitive information intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
LEGAL NOTICE
This electronic mail transmission and any accompanying documents contain information belonging to the sender which may be confidential and legally privileged. This information is intended only for the use of the individual or entity to whom this electronic mail transmission was sent as indicated above. If you are not the intended recipient, any disclosure, copying, distribution, or action taken in reliance on the contents of the information contained in this transmission is strictly prohibited. If you have received this transmission in error, please delete the message. Thank you
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]