• Post Reply Bookmark Topic Watch Topic
  • New Topic

@override error  RSS feed

 
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

 
Marshal
Posts: 56858
174
  • X Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 21182
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Matt Swaggi
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Marshal
Posts: 56858
174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please print the method headers for the method you are trying to override, and your overriding method.
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Campbell Ritchie
Marshal
Posts: 56858
174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Annotations came in with Java5, but @Override works differently in Java5 and Java6.
 
Matt Swaggi
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!