Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #28462

Re: @java.lang.DontOverride

Date 2014-05-13 20:47 -0400
From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: @java.lang.DontOverride
References <override-20140511031054@ram.dialup.fu-berlin.de> <12zudaw3npuad.18yyakqa7rmfw$.dlg@40tude.net> <537026b7$0$295$14726298@news.sunsite.dk> <gglnx1tnyvjr.ev5wpv4z7d9n$.dlg@40tude.net>
Message-ID <5372bd2a$0$295$14726298@news.sunsite.dk> (permalink)
Organization SunSITE.dk - Supporting Open source

Show all headers | View raw


On 5/12/2014 12:33 PM, Joerg Meier wrote:
> On Sun, 11 May 2014 21:41:11 -0400, Arne Vajhøj wrote:
>
>> On 5/11/2014 5:23 AM, Joerg Meier wrote:
>>> On 11 May 2014 01:16:53 GMT, Stefan Ram wrote:
>>>> class Example extends javax.swing.JComponent
>>>> { public boolean isValid(){ return true; }}
>
>>>>     I do not want to override any method of JComponent with my method.
>>>>     I just want to add a new method. But now or in future versions of
>>>>     Swing there might be an »isValid« method in JComponent. So I'd like
>>>>     to have a @java.lang.DontOverride annotation with the following
>>>>     meaning: »Aborts compilation if any base class has a non-private
>>>>     method of the same name.« Why do we have @java.lang.Ovverride, but
>>>>     not the opposite? Or have I missed something?
>>> It seems to me like if you simply don't put @Override on this method, then
>>> even if JComponent gets a method with that signature later, you will still
>>> get a compiler warning or error, depending on your configuration.
>>> Basically, all methods not tagged with @Override already are tagged with an
>>> invisible @DontOverride.
>> Are you saying that this could be done or that it has been done?
>
>> If the latter when what is the configuration to enable this?
>
> It has been done, but it seems to be an Eclipse feature, not a Java
> feature, so my bad.

I was not even aware that Eclipse could do that.

I assume it is:
- properties
- java compiler
- errors/warnings
- annotations
- missing @Override annotation
that does the trick.

Arne

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: @java.lang.DontOverride Joerg Meier <joergmmeier@arcor.de> - 2014-05-11 11:23 +0200
  Re: @java.lang.DontOverride Arne Vajhøj <arne@vajhoej.dk> - 2014-05-11 21:41 -0400
    Re: @java.lang.DontOverride Joerg Meier <joergmmeier@arcor.de> - 2014-05-12 18:33 +0200
      Re: @java.lang.DontOverride Arne Vajhøj <arne@vajhoej.dk> - 2014-05-13 20:47 -0400
        Re: @java.lang.DontOverride Joerg Meier <joergmmeier@arcor.de> - 2014-05-14 11:34 +0200

csiph-web