The below code Eclipse is giving me "'hi' from class 'com.test.SubClass' does not override method from its superclass or interfaces but is annotated with @Override." error. But if I remove the @Override in the SubClass, it won't complain and treats the method as an Overriding method. Is there any way in Eclipse so I could ignore these annotation errors with generics?
interface Base<T extends Object> {
void hi(T t);
}
class SubClass implements Base<String> {
@Override
public void hi(Object o) {
}
}
You need to change
public void hi(Object o)
to
public void hi(String o) // or String s
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.