R
Roedy Green
I am about the describe one of the most frustrating features of Java
-- the total lack of safety nets when it comes to overriding methods.
Tracking these down take me days.
Any hints on techniques for ensuring the error never happens are
welcome or for finding them when suspected.
I love abstract methods. The compiler dutifully checked that I
remembered to implement every last one, to spell it perfectly and to
get the signature bang on.
But sometimes I want to provide a default implementation that I
occasionally override.
I tend to screw up and make a teensy spelling error in the name, or
get the method signature off by a hair. The compiler gives me no
warning at all. Basically my new methods is totally ignored and that
class uses the default implementation.
I wish there were syntax like this:
in my implementation, I use the keyword override to indicate I am
deliberately overriding a method in the base class. The compiler will
then warn me if I get the name or signature off.
There might be a keyword "original" to do the opposite, ensure I am
not overriding inadvertently a method in the base class or one
inserted later into the base class.
In the base class allow you to say something like
abstract for Dalmatian, Chow, BigDog
To force those classes to provide their own implementation and not
rely on the default one.
--
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm
Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
-- the total lack of safety nets when it comes to overriding methods.
Tracking these down take me days.
Any hints on techniques for ensuring the error never happens are
welcome or for finding them when suspected.
I love abstract methods. The compiler dutifully checked that I
remembered to implement every last one, to spell it perfectly and to
get the signature bang on.
But sometimes I want to provide a default implementation that I
occasionally override.
I tend to screw up and make a teensy spelling error in the name, or
get the method signature off by a hair. The compiler gives me no
warning at all. Basically my new methods is totally ignored and that
class uses the default implementation.
I wish there were syntax like this:
in my implementation, I use the keyword override to indicate I am
deliberately overriding a method in the base class. The compiler will
then warn me if I get the name or signature off.
There might be a keyword "original" to do the opposite, ensure I am
not overriding inadvertently a method in the base class or one
inserted later into the base class.
In the base class allow you to say something like
abstract for Dalmatian, Chow, BigDog
To force those classes to provide their own implementation and not
rely on the default one.
--
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm
Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes