[Newbies] Code critics - Overrides super method without calling it

stan shepherd squeak414 at free.fr
Mon Jul 21 16:24:11 UTC 2008




Matthias Berth-2 wrote:
> 
> Hi,
> 
> The idea is that you should _maybe_ give the superclasses of Strand a
> chance to execute their method.
> In some situations this is really necessary, or just a good way to
> avoid code duplication.
> 
> HTH
> 
> Matthias
> 
> On Sat, Jul 19, 2008 at 5:47 PM, stan shepherd <squeak414 at free.fr> wrote:
>>
>> Hi, I get the possible bug 'Overrides super method without calling it'
>> for
>> things like:
>>
>> Strand>>size
>>        ^ genes size
>>
>> I can't find an explanation of this, in case there is some nasty that I'm
>> not aware of. It is not listed at:
>>
>> http://st-www.cs.uiuc.edu/users/brant/Refactory/LintChecks.html
>>
>> Is there a more complete list of code critics messages?
>>
>> Are there cases other than 'Overrides a "special" message' to look out
>> for?
>>
>> Thanks,   ...Stan
>> --
>> View this message in context:
>> http://www.nabble.com/Code-critics---Overrides-super-method-without-calling-it-tp18545882p18545882.html
>> Sent from the Squeak - Beginners mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Beginners mailing list
>> Beginners at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
> 
> 

Thanks Matthias.

I just worked out that to allow Strand to call super size, it needs to
implement 

isVariable
    ^ true

This doesn't do anything useful, but it does get code critics off my back
(until I implement Lukas's revised code critics package).

I was concerned that there might be less obvious repercussions, such as the
one at:
http://st-www.cs.uiuc.edu/users/brant/Refactory/LintChecks.html

"Has class instance variable but no initialize method

Checks that all classes that have class instance variables also have an
initialize method. This makes sure that all class instance variables are
initialized properly when the class is filed-into a new image. "

I hadn't thought about the file in implications; similarly I didn't know if
there were any unseen nasties in the 'Overrides super method without calling
it' case.

...Stan


-- 
View this message in context: http://www.nabble.com/Code-critics---Overrides-super-method-without-calling-it-tp18545882p18572312.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.



More information about the Beginners mailing list