Java – Why can’t I put an object of the B parent class (super class) into the Container<>?

Why can’t I put an object of the B parent class (super class) into the Container<>?… here is a solution to the problem.

Why can’t I put an object of the B parent class (super class) into the Container<>?

I have the code below. It seems that I can’t put objects of class Nonlife, which is the parent class of the class (super class) Vehicle put in Collection<? Super Vehicle> type of type in the ALTHOUGH wildcard type has a keyword “super”, And only Vehicle class objects and SUVs that are subclasses of the Vehicle class are possible. Can someone give me some advice?

public class SUV extends Vehicle

public class Vehicle extends Nonlife implements Externalizable

public class Nonlife extends Thing

public class Thing implements Comparable<Thing>, Serializable

public class SupperWildcardTest20200830 {
    
public static void main(String[] args) {
        Collection<Thing> coll = new ArrayList<>();
        appendVehicle2Collection(coll);
        appendSuv2Collection(coll);
        for (Thing el: coll) {
            System.out.println("" + el);
        }
    }
    
public static void appendVehicle2Collection(Collection<? super Vehicle> coll) {
        coll.add(new Vehicle());
    }
    
public static void appendSuv2Collection(Collection<? super Vehicle> coll) {
        coll.add(new SUV());
    }
    
public static void appendNolife2Collection(Collection<? super Vehicle> coll) {
        /**
         * incompatible types: Nonlife cannot be converted to CAP#1
         *  where CAP#1 is a fresh type-variable:
         *    CAP#1 extends Object super: Vehicle from capture of ? super Vehicle
         */
        coll.add(new Nonlife());
    }
}

Related Problems and Solutions