Is there a way to just comment out all the @Overrides that turn out to be Eclipse errors that prevent your app from building/running?
@Override @Override annotation informs the compiler that the element is meant to override an element declared in a superclass. Overriding methods will be discussed in Interfaces and Inheritance. While it is not required to use this annotation when overriding a method, it helps to prevent errors.
The @Override annotation indicates that the child class method is over-writing its base class method. It extracts a warning from the compiler if the annotated method doesn't actually override anything. It can improve the readability of the source code.
So if i understand you there are already @Override annotations in your source code, but you are getting compile errors on them?
If so you have the wrong jdk installed.
You need at least jdk1.5 to use those annotations on methods derived from classes.
You need at least jdk1.6 to use those annotations on methods derived from interfaces.
In
Window->Preferences->Java->Compiler->Errors/Warnings
There is a group called "Annotations
". Under there, check that the
"Missing '@Override' annotation is set to "Ignore" or "Warning" and not "Error".
Edit: I wanted to add that you can get Eclipse to automatically add @Override annotations on files that you save in the Save Actions.
Window->Preferences->Java->Editor->Save Actions
There is a checkbox for "Additional Actions
" and if you open the "Configure
" window you can select the "Missing Code
" tab and select "Add Missing Annotations
" where you can select which annotations to automatically add.
I assume you're compiling against Java 1.5 or earlier, where the compiler treats @Override annotations of interface methods as errors.
Use Eclipse to search and replace (remove) all instances of "@Override". Then add back the non-interface overrides using "Clean Up".
Steps:
I have Java 8 on my system and facing the same issue in eclipse. Problem is because JDK Compliance is 1.5
Here is how I fixed it
Open Eclipse, Preference -> Java -> Compiler -> JDK Compliance
Change it to 1.6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With