Why are contravariant parameter types in Java not allowed for overriding?
When overriding a method of a superclass, Java allows the return type to be covariant.
Why are contravariant parameter types in contrast not allowed when overriding methods?
Because that's called overloading.
In particular, the return type type can be covariant because it is not considered when overloading, and it therefore still matches the superclass or interface's implementation. Parameters are considered when overloading. You very well might have an optimization with Number doSomethingWithNumber(Integer value)
compared to Number doSomethingWithNumber(Number value)
.