I use jdk 6.
I have an interface:
public interface DisplayValueListener<P> {
...
void setDisplayValue(P value, String reprValue);
}
I have an abstract class named Widget that implements DisplayValueListener and is declared like this:
public abstract class Widget<P> implements DisplayValueListener<P> {
...
@Override
public void setDisplayValue(final Object value, final String reprValue) {
...
}
}
I also have another abstract class that extends Widget like this:
public abstract class CameraWidget extends Widget<Void> {
...
@Override
public void setDisplayValue(final Void value, final String reprValue) {
}
}
This is the message that I get from the compiler in NetBeans:
name clash: setDisplayValue(Void,String) in CameraWidget overrides a method whose erasure is the same as another method, yet neither overrides the other first method: setDisplayValue(Object,String) in Widget second method: setDisplayValue(P,String) in DisplayValueListener where P is a type-variable: P extends Object declared in interface DisplayValueListener
Can anyone tell me what is the problem and why the compiler in Eclipse (same jdk 6) is happy with this?