Mihail Stoynov's blog!
Surrender your ego
Friday, June 20, 2008
@Override in eclipse
When one implements an interface, the template in Eclipse puts an
@Override
and it does not complain about it. Ant
javac
task also compiles without warnings.
Sometimes other Eclipse instances start to complain exactly for that
@Override
stating that there's no method that's overridden. Well, Eclipse, please do make up your mind.
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Override.html
"Indicates that a method declaration is intended to override a method declaration in a superclass. If a method is annotated with this annotation type but does not override a superclass method, compilers are required to generate an error message."
Well, that's not very clear. As far as I remember an Interface is a pure abstract class, right? So, which one's correct.
P.S. Sometime ago I was having a similar problem with Eclipse and generics - Eclipse only gave a warning about something (can't remember what exactly), but the
javac
said that it was an error - Google said something like "eclipse uses
jikes
, you use
javac
". So what, aren't there specs?!
Update:
apparently JDK5 (or 1.5, suit yourself) does not allow that. So in order to get all the wrong
@Override
s - set the Compliance level to 5.0 (
Eclipse -> Window -> Preferences -> Java -> Compiler -> Compiler compliance level
) - and..... correct them. I have 29 left.
Sucks
Comments [3]
|
Trackback
Sunday, June 22, 2008 6:51:41 PM (GMT Standard Time, UTC+00:00)
<blockquote>Well, Eclipse, please do make up your mind.</blockquote>
In order for the Eclipse to make up their mind, it's crucial to report the problems you encounter in their bug tracking system.
For me implementing a method is different than overriding one - so I don't write @Override when implementing a method from interface.
Irina Marudina
Monday, June 23, 2008 8:36:01 AM (GMT Standard Time, UTC+00:00)
But Eclipse doesn't see the difference, and eclipse does put @Override by default.
I'll check the possibilities for reporting :)
mihail.stoynov
Wednesday, July 30, 2008 12:49:14 PM (GMT Standard Time, UTC+00:00)
Good, it works.
i've stted level to 1.6 and now work
ettore
Name
E-mail
(will show your
gravatar
icon)
Home page
Remember Me
Comment (Some html is allowed:
a@href@title, strike
) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.
Enter the code shown (prevents robots):
Live Comment Preview
dasBlog theme by
Mads Kristensen
RSS feed
Search
Archives
August, 2008 (14)
July, 2008 (14)
June, 2008 (26)
May, 2008 (6)
April, 2008 (21)
March, 2008 (14)
February, 2008 (28)
November, 2007 (5)
October, 2007 (7)
September, 2007 (1)
August, 2007 (7)
July, 2007 (3)
June, 2007 (1)
Blog Stats
Total Posts: 142
This Year: 118
This Month: 14
This Week: 4
Comments: 42
Categories
rulez
Sucks
БГ
Blogroll
Achim Oellers
Bart DePetrillo
Clemens Vasters
Harry Pierson
Jörg Freiberger
Joshua Flanagan
Omar Shahine
Scott Hanselman
Stephen Forte
Tom Mertens
Links
Home
newtelligence AG
dasBlog
SourceForge
Scott Hanselman
Omar Shahine
Disclaimer
© Copyright 2008 Mihail Stoynov