File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes @override error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "@override error" Watch "@override error" New topic
Author

@override error

Matt Swaggi
Ranch Hand

Joined: May 29, 2008
Posts: 61
Hey Folks

The error I am right know facing is stated below

method commandCompleted(CommandEvent) of type new CommandListener(){} must override
a superclass method.


Even though I have included @ override in the method , still it show as error .

My developement is RAD IDE version 7.0.0 . I installed jdk 1.6 .

what else i have to do , please help me .

Any information is highly appreciable.

CSG

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39784
    
  28
It is @Override with a capital O.
You need to find the details of the superclass method you are trying to override, and compare them with your new method. Print both their headings.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19759
    
  20

Are you sure you've named the method correctly? That you're using the right CommandEvent class? That the CommandEvent is properly imported?
Java 6 added support for @Override for methods implemented for an interface as well, so that couldn't be the issue.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Matt Swaggi
Ranch Hand

Joined: May 29, 2008
Posts: 61
Rob

The file was imported . It is actually the production code which I checked out .
I still dont why I face this problem even though I use the higher version of jdk 1.6
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39784
    
  28
Please print the method headers for the method you are trying to override, and your overriding method.
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3737
    
  16
Guna Ranjan wrote:My developement is RAD IDE version 7.0.0 . I installed jdk 1.6 .

Have you configured RAD to use JDK 1.6. According to this it appears to use IBM's JDK 5 by default - can't remember when annotations were introduced.


Joanne
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39784
    
  28
Annotations came in with Java5, but @Override works differently in Java5 and Java6.
Matt Swaggi
Ranch Hand

Joined: May 29, 2008
Posts: 61
Joanne Neal wrote:
Guna Ranjan wrote:My developement is RAD IDE version 7.0.0 . I installed jdk 1.6 .

Have you configured RAD to use JDK 1.6. According to this it appears to use IBM's JDK 5 by default - can't remember when annotations were introduced.



Yes I configured like windows->preference->java compiler Level - > 6.0

Matt Swaggi
Ranch Hand

Joined: May 29, 2008
Posts: 61
Campbell Ritchie wrote:Annotations came in with Java5, but @Override works differently in Java5 and Java6.


Hey can you please tell me the @ override difference in java5 and java 6
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Guna Ranjan wrote:
Campbell Ritchie wrote:Annotations came in with Java5, but @Override works differently in Java5 and Java6.


Hey can you please tell me the @ override difference in java5 and java 6


In Java 6, we can @Override a method that we're implementing that's declared in an interface. Prior to that, it was only allowed on methods we inherited from a parent class.
Matt Swaggi
Ranch Hand

Joined: May 29, 2008
Posts: 61
Jeff Verdegan wrote:
Guna Ranjan wrote:
Campbell Ritchie wrote:Annotations came in with Java5, but @Override works differently in Java5 and Java6.


Hey can you please tell me the @ override difference in java5 and java 6


In Java 6, we can @Override a method that we're implementing that's declared in an interface. Prior to that, it was only allowed on methods we inherited from a parent class.



When we implement a method in a Interface , why would we want to use @ override .
Please clarify this .
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Guna Ranjan wrote:
Jeff Verdegan wrote:
Guna Ranjan wrote:
Campbell Ritchie wrote:Annotations came in with Java5, but @Override works differently in Java5 and Java6.


Hey can you please tell me the @ override difference in java5 and java 6


In Java 6, we can @Override a method that we're implementing that's declared in an interface. Prior to that, it was only allowed on methods we inherited from a parent class.



When we implement a method in a Interface , why would we want to use @ override .
Please clarify this .


Same reasons as when using it for a method overridden from a class: 1) So that readers of that code will know that the method is inherited from another type, and 2) So that if we make a mistake in the method's signature (or if the parent type's signature changes), we'll get a compilation error.
John Jai
Bartender

Joined: May 31, 2011
Posts: 1776
I ran into a similar error while using Eclipse when the project specific compiler was pointing to 1.5 version. Check the project specific compiler version if present in RAD.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @override error