What is the reasoning behind not allowing supertypes on Java method overrides?
问题 The following code is considered invalid by the compiler: class Foo { void foo(String foo) { ... } } class Bar extends Foo { @Override void foo(Object foo) { ... } } I think that this is described in the JLS 8.4.8.1: "The signature of m1 is a subsignature (§8.4.2) of the signature of m2." and in 8.4.2: "the bounds of corresponding type variables are the same". My question is: why can't the parameter in the subtype (Bar) be a supertype of the parameter in the supertype (Foo). In the example