I don't understand why the following code does compile.
public class House<T> {
static <T> void live(House<T> a) {}
static {
new House<Integer>() {
{
this.live(new House<String>());
}
};
}
}
type T
in static code in new House is an Integer, so the required type of argument to live
function is House<Integer>
, whereas it compiles with House<String>
.
Please explain.