Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » What preference controls compile warning about @Override
What preference controls compile warning about @Override [message #247178] Fri, 31 August 2007 20:22 Go to next message
Eclipse UserFriend
Originally posted by: eclipse5.rizzoweb.com

In my workspace, methods that have the @Override annotation but do not
actually override an inherited method produce a compiler error, The
method XXX must override a superclass method."
On coworkers' workspace this is not marked as an error. I've checked
that my preferences under Java > Compiler > Errors & Warnings >
Annotations are the same.

Any ideas what is making this an error instead of a warning or ignore?

Eric
Re: What preference controls compile warning about @Override [message #247184 is a reply to message #247178] Fri, 31 August 2007 20:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

Eric,

Are you sure? I think an @Override that's not really an @Override must
be treated as an error and there is no way to turn that off. Is it
possible that the other guy is using Java 6.0 and you're using Java
5.0. I believe (but I'm not sure) that in 6.0 that @Override can also
be used to indicate that you implement a method in an interface even
when you don't actually override a method declaration in another class...



Eric Rizzo wrote:
> In my workspace, methods that have the @Override annotation but do not
> actually override an inherited method produce a compiler error, The
> method XXX must override a superclass method."
> On coworkers' workspace this is not marked as an error. I've checked
> that my preferences under Java > Compiler > Errors & Warnings >
> Annotations are the same.
>
> Any ideas what is making this an error instead of a warning or ignore?
>
> Eric
Re: What preference controls compile warning about @Override [message #247188 is a reply to message #247184] Fri, 31 August 2007 21:27 Go to previous messageGo to next message
Olivier Thomann is currently offline Olivier ThomannFriend
Messages: 518
Registered: July 2009
Senior Member
Ed Merks a écrit :
> Eric,
>
> Are you sure? I think an @Override that's not really an @Override must
> be treated as an error and there is no way to turn that off. Is it
> possible that the other guy is using Java 6.0 and you're using Java
> 5.0. I believe (but I'm not sure) that in 6.0 that @Override can also
> be used to indicate that you implement a method in an interface even
> when you don't actually override a method declaration in another class...
That is right. @Override in 1.6 is less restrictive than in 1.5.
--
Olivier
Re: What preference controls compile warning about @Override [message #247197 is a reply to message #247184] Sat, 01 September 2007 03:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse5.rizzoweb.com

Ed Merks wrote:
> Eric,
>
> Are you sure? I think an @Override that's not really an @Override must
> be treated as an error and there is no way to turn that off. Is it
> possible that the other guy is using Java 6.0 and you're using Java
> 5.0. I believe (but I'm not sure) that in 6.0 that @Override can also
> be used to indicate that you implement a method in an interface even
> when you don't actually override a method declaration in another class...

That could very well be the case - I am definitely set up to JDK 1.5 and
at least some of my coworkers are running Eclipse under 1.6 so their
default is likely 1.6. I'll test out that theory next week.

Thanks,
Eric


> Eric Rizzo wrote:
>> In my workspace, methods that have the @Override annotation but do not
>> actually override an inherited method produce a compiler error, The
>> method XXX must override a superclass method."
>> On coworkers' workspace this is not marked as an error. I've checked
>> that my preferences under Java > Compiler > Errors & Warnings >
>> Annotations are the same.
>>
>> Any ideas what is making this an error instead of a warning or ignore?
>>
>> Eric
Re: What preference controls compile warning about @Override [message #247416 is a reply to message #247188] Wed, 05 September 2007 13:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: adam.giemza.gmx.de

Olivier Thomann schrieb:
> Ed Merks a écrit :
>> Eric,
>>
>> Are you sure? I think an @Override that's not really an @Override
>> must be treated as an error and there is no way to turn that off. Is
>> it possible that the other guy is using Java 6.0 and you're using Java
>> 5.0. I believe (but I'm not sure) that in 6.0 that @Override can also
>> be used to indicate that you implement a method in an interface even
>> when you don't actually override a method declaration in another class...
> That is right. @Override in 1.6 is less restrictive than in 1.5.
> --
> Olivier
Thanks for this hint. This is exactly the same problem, we had here. But
I am running Eclipse with Java 1.6, but I use 1.5 for my projects. My
compiler compliance level is also set to 5.0.

Now if I set the cleanup properties to add missing "@Overrides", it adds
the also to implemented interface methodes, that does not work with 1.5.
Is it a bug or a feature?

Greets,
Adam
Re: What preference controls compile warning about @Override [message #247530 is a reply to message #247416] Thu, 06 September 2007 13:31 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse5.rizzoweb.com

Adam Giemza wrote:
> Olivier Thomann schrieb:
>> Ed Merks a écrit :
>>> Eric,
>>>
>>> Are you sure? I think an @Override that's not really an @Override
>>> must be treated as an error and there is no way to turn that off. Is
>>> it possible that the other guy is using Java 6.0 and you're using
>>> Java 5.0. I believe (but I'm not sure) that in 6.0 that @Override
>>> can also be used to indicate that you implement a method in an
>>> interface even when you don't actually override a method declaration
>>> in another class...
>> That is right. @Override in 1.6 is less restrictive than in 1.5.
>> --
>> Olivier
> Thanks for this hint. This is exactly the same problem, we had here. But
> I am running Eclipse with Java 1.6, but I use 1.5 for my projects. My
> compiler compliance level is also set to 5.0.
>
> Now if I set the cleanup properties to add missing "@Overrides", it adds
> the also to implemented interface methodes, that does not work with 1.5.
> Is it a bug or a feature?

You should enter a bug for that, since Java 5 projects will immediately
mark such annotations as an error. Clean-up should not produce compile
errors, obviously.

http://bugs.eclipse.org/bugs

Eric
Previous Topic:def-use-chain
Next Topic:Programmatically switching to a view
Goto Forum:
  


Current Time: Sat Nov 09 23:13:17 GMT 2024

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

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

Back to the top