If I have this interface:
public interface Foo {
void bar();
}
Why can't I implement it like this?
public class FooImpl implements Foo {
@Override
public Object bar() {
return new Object();
}
}
It seems like void should be covariant with everything. Am I missing something?
Edit: I should have been clearer that I'm looking for the design justification, not the technical reason that it won't compile. Are there negative consequences to making void covariant to everything?