Why do I get "must override a superclass method" with @Override?
Check the project's properties and verify that Java Compiler -> Compiler compliance level is set to 1.6 (or a later version).
It worked for me... i am using eclipse 2021.... and ..
This is most likely due to a source code level incompatibility between Java 1.5 and 1.6.
In Java 5, the
@Override
annotation requires that the method is actually overriding a method in a superclass.In Java 6 and later, the
@Override
annotation will also be satisfied if the method is implementing an abstract method in a superclass or interface.
So the most likely reason for seeing this in code that you expect to work is that you are compiling Java 6 (or later) code with a Java 5 compiler (or some other compiler with the compiler's source compliance level set to 5).