Search code examples
javaeclipseannotations

Error on @Override annotation with interface implementation


I am using JRE 1.6 version and aware of JRE 1.5 trouble while using @Override with interface.

I imported a new project (Spring + Maven ) and Eclipse giving error on every @Override annotation whenever any interface method is overridden.

Things I tried till now

  1. Checked project and workspace specific JRE and compliance level, It is set to 1.6 version.
    enter image description here
  2. Checked JRE library on build path, it is also same.
  3. Changed Java version in project facet to 1.6 (Dont know if it will help)
    enter image description here
  4. Did Maven clean and install (hundred times till now)
  5. Disabled error / warning for Annotations still no luck enter image description here
  6. Eclipse restart (Stupid thing but helps me lots of time)
  7. Last option will be deleting all .setting and .project files if I dont get anything else to try.

Edit 1:
I am getting following error

The method XXX of type XXX must override a superclass method.        

Edit 2:
Code Sample
Interface declaration

public interface HelperService {   
    public RequisitionTypeDTO getRequisitionTypeDTO(int id) throws Exception;  
}    

Implementation:

   @Service
   public class HelperServiceImpl implements HelperService{   
   @Override  // Getting error for this line
   public RequisitionTypeDTO getRequisitionTypeDTO(int id) throws Exception{
                         // Bla Bla Bla 
      }  
   }     

EDIT 3:
I am able to build and run my application successfully irrespective of this errors. Just not happy with red error flags all over the source code.


Solution

  • Realized no Builder is selected for current project. Selected Java Builder and boom. No more red flags all over the code.

    enter image description here