What to override and what now (original) (raw)
Mario Torre neugens.limasoftware at gmail.com
Wed Oct 26 10:19:51 PDT 2011
- Previous message: What to override and what now
- Next message: [OpenJDK 2D-Dev] What to override and what now
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Ok then, I'll upload you a webrew patch for JDK8 later for review :)
I need a bug id I guess.
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/
Il giorno 26/ott/2011, alle ore 17:27, Artem Ananiev ha scritto:
On 10/15/2011 12:30 AM, Mario Torre wrote: 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? I completely agree. This code seems to be never called, otherwise it would fail into an infinite recursion, it shouldn't be any problems with it returning "false". Why not simply provide a default implementation or just throw an exception or simply make the method abstract? Or maybe I'm missing something? Making it abstract is not a good idea: I know some rare cases when the Toolkit class is extended (e.g. for testing purposes), and adding a new abstract method will break such code at compile time. I hope there are not many more of those examples scattered around, or to know what to subclass and override will be a pain. Thanks, Artem Cheers, Mario --- pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF Fingerprint: BA39 9666 94EC 8B73 27FA FC7C 4086 63E3 80F2 40CF http://www.ladybug-studio.com 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: What to override and what now
- Next message: [OpenJDK 2D-Dev] What to override and what now
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]