[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix for Hashtable contains blowing up the stack
From: |
Chris Gray |
Subject: |
Re: [PATCH] Fix for Hashtable contains blowing up the stack |
Date: |
Fri, 28 Nov 2003 19:41:37 +0100 |
On Friday 28 November 2003 17:39, Dalibor Topic wrote:
> Hi Mark, hallo Jeroen,
>
> Mark Wielaard wrote:
> > Hi
> >
> > On Sat, 2003-11-22 at 13:06, Jeroen Frijters wrote:
> >>The fix is actually incorrect. containsValue() should call contains()
> >>because containsValue() is a new method (since 1.2) and contains()
> >>exists since 1.0. Older code may have overridden contains() and this
> >>should work with newer code that calls containsValue().
> >
> > Urgh. Yes, you are right. Wrote an additional test case for this:
> > gnu.testlet.java.util.Hashtable.ContainsHash (it currently fails).
The online API docs for 1.4.2 just say
Note that this method is identical in functionality to contains (which
predates the Map interface).
which would certainly lead one to believe that both-call-a-private-worker
would be the right thing to do. Nonetheless Jeroen's argument is compelling.
In that case the rule seems to be
- one API-visible method should not call another API-visible method, they
should both call some non-visible "worker" method,
- UNLESS it's actually documented thet this should happen,
- OR the methods are synonyms and one was added later just to retcon the
class into implementing some interface.
Hm, messy ...
--
Chris Gray /k/ Embedded Java Solutions
Embedded & Mobile Java, OSGi http://www.kiffer.be/k/
address@hidden +32 477 599 703