Hi,

The documentation [2] of @Override is incorrect in Java 6, it's identical to 
Java 5 [1]: An interface is not a "superclass" it's only a "supertype". 
According to a blog post of Oracle they fixed @Override documentation in Java 7 
[3]: http://blogs.oracle.com/ahe/entry/override_snafu
According to Java 6 docs [2], it's invalid to add @Override to interface 
implementations, as no method from a "superclass" is "overridden".

And personally I don’t agree that @Override on interfaces is useful, it's 
itself a bug as there is nothing overridden. I would prefer @Implements - 
that’s my opinion.

[1] http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Override.html
[2] http://docs.oracle.com/javase/6/docs/api/java/lang/Override.html
[3] http://docs.oracle.com/javase/7/docs/api/java/lang/Override.html

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: [email protected]


> -----Original Message-----
> From: Robert Muir [mailto:[email protected]]
> Sent: Monday, November 28, 2011 10:49 AM
> To: [email protected]
> Subject: Re: svn commit: r1206916 - in /lucene/dev/branches/branch_3x: ./
> lucene/ lucene/backwards/src/ lucene/backwards/src/test-framework/
> lucene/backwards/src/test/ solr/ solr/core/src/java/org/apache/solr/analysis/
> solr/core/src/java/org/apache/solr/schem
> 
> On Mon, Nov 28, 2011 at 2:51 AM, Uwe Schindler <[email protected]> wrote:
> 
> > In Java 5 interfaces do not support @Override (which is in my opinion
> > correct and is horrible that it was introduced in Java 6: @Override on
> > interfaces is wrong, as nothing is overridden)
> 
> Actually its a bug in java 5: the javadoc for @Override is unchanged in java6:
> 'Indicates that a method declaration is intended to override a method
> declaration in a superclass.'
> 
> However the bug is fixed, so that if during refactoring if we removed some
> method declarations from an interface during refactoring, you get a compile
> error for all the implementing subclasses that should still be fixed: this 
> seems
> genuinely useful.
> 
> --
> lucidimagination.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected] For additional
> commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to