What to override and what now (original) (raw)
Mario Torre neugens.limasoftware at gmail.com
Fri Oct 14 13:30:04 PDT 2011
- Previous message: Request for review - change two include header files according to POSIX.1-2008
- Next message: What to override and what now
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
While working a bit on cacio, we just found some new nice addition to the Toolkit code, like this one:
public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
GraphicsEnvironment.checkHeadless();
return Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled();
}
Of course, this method is meant to be overridden, so it will end up doing nothing, but things like this may be very difficult to debug at times, and in any case, is definitely are not friendly code. Is there any reason for this smartness?
Why not simply provide a default implementation or just throw an exception or simply make the method abstract? Or maybe I'm missing something?
I hope there are not many more of those examples scattered around, or to know what to subclass and override will be a pain.
Cheers, Mario
pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF Fingerprint: BA39 9666 94EC 8B73 27FA FC7C 4086 63E3 80F2 40CF
IcedRobot: www.icedrobot.org Proud GNU Classpath developer: http://www.classpath.org/ Read About us at: http://planet.classpath.org OpenJDK: http://openjdk.java.net/projects/caciocavallo/
Please, support open standards: http://endsoftpatents.org/
- Previous message: Request for review - change two include header files according to POSIX.1-2008
- Next message: What to override and what now
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]