Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » override for interface question
override for interface question [message #248979] Fri, 19 October 2007 21:07 Go to next message
Eclipse UserFriend
Originally posted by: tdelorenzi.verizon.net

I'm looking for a way to have eclipse help me find missing @Override
statements in front of functions that come exclusively from an interface.
According to this post:
http://dev.eclipse.org/newslists/news.eclipse.tools.jdt/msg2 1317.html
Cleanup does it, but I cannot reproduce that using the latest eclipse.

Either a way to make cleanup add them, or a way to make the compiler
complain if you don't have one like it does for overrides on super class
functions when you turn that option on.

If anyone has any ideas id be grateful. Thanks.
Re: override for interface question [message #248989 is a reply to message #248979] Mon, 22 October 2007 07:37 Go to previous messageGo to next message
Eclipse UserFriend
There's a setting
Java->Compiler->Errors/Warnings->Missing @Override annotation

Setting that to warning/error - your choice - should do it.

Just type "Override" in the preferences search box...

N.

On 10/20/07 8:07 AM, in article
e69c7cacfaac803c9c2b47775922e9d5$1@www.eclipse.org, "Tom"
<tdelorenzi@verizon.net> wrote:

> I'm looking for a way to have eclipse help me find missing @Override
> statements in front of functions that come exclusively from an interface.
> According to this post:
> http://dev.eclipse.org/newslists/news.eclipse.tools.jdt/msg2 1317.html
> Cleanup does it, but I cannot reproduce that using the latest eclipse.
>
> Either a way to make cleanup add them, or a way to make the compiler
> complain if you don't have one like it does for overrides on super class
> functions when you turn that option on.
>
> If anyone has any ideas id be grateful. Thanks.
>
Re: override for interface question [message #248995 is a reply to message #248979] Mon, 22 October 2007 07:38 Go to previous messageGo to next message
Eclipse UserFriend
Err, sorry misunderstood your question - don't know how to do it exclusively
for interfaces....


On 10/20/07 8:07 AM, in article
e69c7cacfaac803c9c2b47775922e9d5$1@www.eclipse.org, "Tom"
<tdelorenzi@verizon.net> wrote:

> I'm looking for a way to have eclipse help me find missing @Override
> statements in front of functions that come exclusively from an interface.
> According to this post:
> http://dev.eclipse.org/newslists/news.eclipse.tools.jdt/msg2 1317.html
> Cleanup does it, but I cannot reproduce that using the latest eclipse.
>
> Either a way to make cleanup add them, or a way to make the compiler
> complain if you don't have one like it does for overrides on super class
> functions when you turn that option on.
>
> If anyone has any ideas id be grateful. Thanks.
>
Re: override for interface question [message #248999 is a reply to message #248995] Mon, 22 October 2007 08:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------070601000409070304060206
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Guys,

With Java 5.0 @Override is only allowed or required if you literally
override method in a base class. Only for Java 6.0 is @Override allowed
or required if you are only implementing an interface method. So the
behavior you get will depend on the source compatibility level you set
for your projects.


Nik Heger wrote:
> Err, sorry misunderstood your question - don't know how to do it exclusively
> for interfaces....
>
>
> On 10/20/07 8:07 AM, in article
> e69c7cacfaac803c9c2b47775922e9d5$1@www.eclipse.org, "Tom"
> <tdelorenzi@verizon.net> wrote:
>
>
>> I'm looking for a way to have eclipse help me find missing @Override
>> statements in front of functions that come exclusively from an interface.
>> According to this post:
>> http://dev.eclipse.org/newslists/news.eclipse.tools.jdt/msg2 1317.html
>> Cleanup does it, but I cannot reproduce that using the latest eclipse.
>>
>> Either a way to make cleanup add them, or a way to make the compiler
>> complain if you don't have one like it does for overrides on super class
>> functions when you turn that option on.
>>
>> If anyone has any ideas id be grateful. Thanks.
>>
>>
>
>


--------------070601000409070304060206
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Guys,<br>
<br>
With Java 5.0 @Override is only allowed or required if you literally
override method in a base class.&nbsp; Only for Java 6.0 is @Override
allowed or required if you are only implementing an interface method.&nbsp;
So the behavior you get will depend on the source compatibility level
you set for your projects.<br>
<br>
<br>
Nik Heger wrote:
<blockquote cite="mid:C3429E8A.5F8%25nheger@gmail.com" type="cite">
<pre wrap="">Err, sorry misunderstood your question - don't know how to do it exclusively
for interfaces....


On 10/20/07 8:07 AM, in article
<a class="moz-txt-link-abbreviated" href="mailto:e69c7cacfaac803c9c2b47775922e9d5$1@www.eclipse.org">e69c7cacfaac803c9c2b47775922e9d5$1@www.eclipse.org</a>, "Tom"
<a class="moz-txt-link-rfc2396E" href="mailto:tdelorenzi@verizon.net">&lt;tdelorenzi@verizon.net&gt;</a> wrote:

</pre>
<blockquote type="cite">
<pre wrap="">I'm looking for a way to have eclipse help me find missing @Override
statements in front of functions that come exclusively from an interface.
According to this post:
<a class="moz-txt-link-freetext" href=" http://dev.eclipse.org/newslists/news.eclipse.tools.jdt/msg2 1317.html"> http://dev.eclipse.org/newslists/news.eclipse.tools.jdt/msg2 1317.html</a>
Cleanup does it, but I cannot reproduce that using the latest eclipse.

Either a way to make cleanup add them, or a way to make the compiler
complain if you don't have one like it does for overrides on super class
functions when you turn that option on.

If anyone has any ideas id be grateful. Thanks.

</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
<br>
</body>
</html>

--------------070601000409070304060206--
Re: override for interface question [message #249036 is a reply to message #248999] Tue, 23 October 2007 18:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tdelorenzi.verizon.net

Yes that is true, but even set on java 6, it allows @Override for
interface only functions, but I cannot find a way to make it help me never
forget one. Thats what I am looking for.
Re: override for interface question [message #249044 is a reply to message #249036] Thu, 25 October 2007 08:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Tom,

Are you saying that if you set
Window->Preferences->General->Java->Compiler->Errors/Warnings- >Annotations->Missing
'@override' annotation to warning or error that it doesn't report when
they are missing for interface implementing methods for Java 6.0 source
compatibility? That would seem like a bug to me...


Tom wrote:
> Yes that is true, but even set on java 6, it allows @Override for
> interface only functions, but I cannot find a way to make it help me
> never forget one. Thats what I am looking for.
Re: override for interface question [message #249087 is a reply to message #249044] Sun, 28 October 2007 21:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tdelorenzi.verizon.net

Yes thats what I am saying Ed. If so I will report it. I had a co-worker
confirm this so its not just me ;)
Re: override for interface question [message #249092 is a reply to message #249044] Sun, 28 October 2007 21:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tdelorenzi.verizon.net

Seems like there is already a bug on this actually.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=163194

Ed Merks wrote:

> Tom,

> Are you saying that if you set
>
Window->Preferences->General->Java->Compiler->Errors/Warnings- >Annotations->Missing
> '@override' annotation to warning or error that it doesn't report when
> they are missing for interface implementing methods for Java 6.0 source
> compatibility? That would seem like a bug to me...
Re: override for interface question [message #249097 is a reply to message #249092] Mon, 29 October 2007 07:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Tom,

Thanks for finding it. I voted for it.


Tom wrote:
>
> Seems like there is already a bug on this actually.
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=163194
>
> Ed Merks wrote:
>
>> Tom,
>
>> Are you saying that if you set
> Window->Preferences->General->Java->Compiler->Errors/Warnings- >Annotations->Missing
>
>> '@override' annotation to warning or error that it doesn't report
>> when they are missing for interface implementing methods for Java 6.0
>> source compatibility? That would seem like a bug to me...
>
>
Re: override for interface question [message #249107 is a reply to message #249097] Mon, 29 October 2007 09:31 Go to previous message
Eclipse UserFriend
Originally posted by: tdelorenzi.verizon.net

Thanks Ed!
I know this will help minimize bugs during refactors.
Previous Topic:Insert code after a comment with ListRewrite
Next Topic:How to force Annotation Processing to be enabled?
Goto Forum:
  


Current Time: Thu May 22 03:51:47 EDT 2025

Powered by FUDForum. Page generated in 0.05029 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top