Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Must I remove the @Override annotation?

Following code giving an error near the public void control() {.

EClipse giives a tip to remove the @Override annotation also. I went throudh the docs.oracle and found that If a method marked with @Override fails to correctly override a method in one of its superclasses, the compiler generates an error.

I don't understand what is meaning of "fails to correctly override"?

public class PersistenceFlowController implements controllers.FlowController {
   @Override
   public void control() {
      // Do some works here
   }
}


package controllers;
public interface FlowController {   
   void control();  
}
like image 852
namalfernandolk Avatar asked Dec 01 '22 00:12

namalfernandolk


1 Answers

In JDK 1.5, @Override could be applied only to methods from a parent class. In JDK 1.6 and up, it can be used for interface methods, too. My guess is that you have Eclipse set for JDK 1.5 compiler compliance. You can check or change this in the "Java Compiler" tab of the project properties dialog.

like image 117
Ernest Friedman-Hill Avatar answered Dec 05 '22 08:12

Ernest Friedman-Hill