Confusion with collections of nested generics
问题 Please help me understand why add1() and add4() report errors and why add2() and add3() don't. Specifically, please show examples of undesired consequences if the compiler allowed each of these to compile. class InnerTypeConfusion { interface Animal {} class Dog implements Animal {} class Room<T> { void add(T t) {} } void add1(Room<? extends Animal> room) { // Error: The method add(capture#1-of ? extends Animal) in the type // Room<capture#1-of ? extends Animal> is not applicable for the //