In a repository that was created in Ubuntu Linux and compiled under OpenJDK 6, when implementing LocationListener and SensorListener, adding the @Override tag above the inherited methods compiles fine.
But when the repo is cloned onto a Windows system with Oracle Java, some of the @Override generates errors. Example below:
The method onAccuracyChanged(Sensor, int) of type ExpeditionActivity must override a superclass method
It seems that this error occurs only when you add @Override above a method that is inherited from implementing an interface. Adding @Override above a method inherited from a base class does not generate the error. This actually makes sense, because you are actually overriding the logic of the original method.
SO, is it syactically correct to write @Override above inherited interface methods?
@Overrideis limited to base class methods in JDK 5.JDK 6 introduced the ability to apply
@Overrideto interface methods.Eclipse must be set to use JDK6/JDK6 language level to use
@Overrideon interface methods.To answer your question, “yes, if you’re compiling under JDK 6+”.