On Fri, Jun 25, 2010 at 8:00 PM, Raymond Feng <[email protected]> wrote:
> Hi,
> The @Override is used to annotate a method that overrides the method from
> the super class. In case of implementing methods from an interface, please
> don't use it. The Eclipse compiler will catch such problems and report as
> errors.
> For example,
> public interface A {
> String m1();
> }
>
> public class AImpl implements A {
> // DO NOT add @Override here
> public String m1() {
> return "A";
> }
> }
>
> public class BImpl extends AImpl {
> @Override // This is correct
> public String m1() {
> return "B";
> }
> }
>
> Thanks,
> Raymond
> ________________________________________________________________
> Raymond Feng
> [email protected]
> Apache Tuscany PMC member and committer: tuscany.apache.org
> Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com
> Personal Web Site: www.enjoyjava.com
> ________________________________________________________________
>

Hi Raymond

I agree that it's odd to have @Override mark a method that simply
implements an interface method.

However I just experimented and for me Eclipse (Ganymede) in its
default configuration doesn't complain about it and positively
encourages it by automatically adding them when I ask it to add
implementations for any methods from an interface that a class doesn't
yet implement.

Do you have local configuration that alters this behaviour?

Simon


-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com

Reply via email to