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


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

Re: @Override

From Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: @Override
Date 2012-07-23 23:40 +0200
Organization A noiseless patient Spider
Message-ID <jukgd7$k7n$1@dont-email.me> (permalink)
References <75036e8b-8b5f-4ea4-aef7-c063249f5707@googlegroups.com> <jukcik$t0m$1@dont-email.me> <9da89e66-d7df-47e1-84d4-2dddea7d744f@googlegroups.com>

Show all headers | View raw


On 23/07/2012 22:59, Lew allegedly wrote:
> Eric Sosman wrote:
>> bob smith wrote:
>>> Is it really necessary to write @Override when you override or is this just "a good thing"?
>>
>>      Two benefits of @Override appear to me, one from its presence
>> and one from its absence:
>>
>>      - If you write @Override and then misspell the method name or
>>        mess up the parameter list, Java will say "Hey, wait: There's
>>        nothing in the superclass with this signature; what do you
>>        think you're doing?"  And then you'll say "Oops!" and fix
>>        the problem, instead of wondering why your "overriding" method
>>        doesn't seem to work.
>>
>>      - If you write a method and your IDE starts suggesting that you
>>        ought to tag it with @Override, you'll be alerted that you've
>>        overridden something you didn't intend to.[*]
>>
>>      Two benefits; that's all I see.  Hence, like indentation and
> 
> And that wasn't enough?
> 
> Add the third benefit that I mentioned upthread. Aren't they enough now?
> 
> Is your disparaging tone rhetorical, or do you really find the 
> benefit of '@Override' to be that marginal?
> 
> Because it isn't.
> 
>> Javadoc comments, not "really necessary" ...
> 
> Dental patient:
>   Is flossing my teeth really necessary? Which ones do 
>   *really* need to floss?
> 
> Dentist:
>   Just the ones you want to keep!
> 
>>      [*] This actually happened to me earlier today.  I was writing
>> a little Swing doodad to edit the "locations" of inventory items,
>> and I gave it a getLocation() method.  NetBeans started clamoring
>> for @Override, and I realized that my doodad extended JPanel which
>> in turn extended JComponent, which already has a getLocation() ...
>> Time for "Facepalm!" and a quick name change.
> 
> That is an excellent anecdote to support the idea that the 
> '@Override' annotation is really necessary.
> 
> But only where you want to catch bugs at compile time before 
> they bite you in production.
> 

Uh... there was a (pretty long) time when people and programs *did*
manage to exist without that annotation, you know. No need to be overly
dramatic.

-- 
DF.

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


Thread

@Override bob smith <bob@coolfone.comze.com> - 2012-07-23 11:30 -0700
  Re: @Override Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-07-23 20:52 +0200
  Re: @Override markspace <-@.> - 2012-07-23 11:54 -0700
    Re: @Override Lew <lewbloch@gmail.com> - 2012-07-23 13:05 -0700
    Re: @Override Arne Vajhøj <arne@vajhoej.dk> - 2012-07-23 19:54 -0400
  Re: @Override "John B. Matthews" <nospam@nospam.invalid> - 2012-07-23 15:56 -0400
    Re: @Override Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-07-23 14:19 -0700
      Re: @Override rossum <rossum48@coldmail.com> - 2012-07-24 13:09 +0100
        Re: @Override Arne Vajhøj <arne@vajhoej.dk> - 2012-07-24 21:29 -0400
      Re: @Override Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-24 09:04 -0400
  Re: @Override Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-23 16:35 -0400
    Re: @Override Lew <lewbloch@gmail.com> - 2012-07-23 13:59 -0700
      Re: @Override Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-07-23 23:40 +0200
        Re: @Override Lew <lewbloch@gmail.com> - 2012-07-23 14:51 -0700
          Re: @Override Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-07-24 00:08 +0200
            Re: @Override Lew <lewbloch@gmail.com> - 2012-07-23 16:57 -0700
      Re: @Override Robert Klemme <shortcutter@googlemail.com> - 2012-07-24 09:46 +0200
    Re: @Override Arne Vajhøj <arne@vajhoej.dk> - 2012-07-23 19:58 -0400
      Re: @Override Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-23 22:16 -0400
        Re: @Override Arne Vajhøj <arne@vajhoej.dk> - 2012-07-23 22:57 -0400
          Re: @Override Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-23 23:47 -0400
            Re: @Override Arne Vajhøj <arne@vajhoej.dk> - 2012-07-24 21:35 -0400
    Re: @Override Jim Janney <jjanney@shell.xmission.com> - 2012-07-26 20:00 -0600
  Re: @Override Gene Wirchenko <genew@ocis.net> - 2012-07-23 14:01 -0700
  Re: @Override Silvio Bierman <silvio@moc.com> - 2012-07-24 00:22 +0200
    Re: @Override Arne Vajhøj <arne@vajhoej.dk> - 2012-07-23 19:53 -0400
      Re: @Override Gene Wirchenko <genew@ocis.net> - 2012-07-23 18:59 -0700
      Re: @Override Silvio Bierman <silvio@moc.com> - 2012-07-24 22:57 +0200
        Re: @Override Arne Vajhøj <arne@vajhoej.dk> - 2012-07-24 21:24 -0400
    Re: @Override Robert Klemme <shortcutter@googlemail.com> - 2012-07-24 15:36 +0200
      Re: @Override Gene Wirchenko <genew@ocis.net> - 2012-07-24 09:54 -0700
      Re: @Override Silvio Bierman <silvio@moc.com> - 2012-07-24 23:14 +0200
        Re: @Override Robert Klemme <shortcutter@googlemail.com> - 2012-07-25 07:57 +0200
          Re: @Override Gene Wirchenko <genew@ocis.net> - 2012-07-25 10:34 -0700
          Re: @Override Arne Vajhøj <arne@vajhoej.dk> - 2012-07-25 14:54 -0400
            Re: @Override Wanja Gayk <brixomatic@yahoo.com> - 2012-07-30 14:42 +0200
      Re: @Override Arne Vajhøj <arne@vajhoej.dk> - 2012-07-24 21:20 -0400
        Re: @Override Lew <noone@lewscanon.com> - 2012-07-25 06:26 -0700
          Re: @Override Arne Vajhøj <arne@vajhoej.dk> - 2012-07-25 17:16 -0400
  Re: @Override Roedy Green <see_website@mindprod.com.invalid> - 2012-07-23 20:59 -0700
  Re: @Override Wanja Gayk <brixomatic@yahoo.com> - 2012-07-24 16:06 +0200

csiph-web