Interface Segregation Principle in constructor I'm wondering if providing default behavior is ever worth the confusion caused by ignoring generic type passed in. Another question brought up this issue: 

public class Activate&lt;D extends CanQuack &amp; CanWalk&gt; {
    D d;

    //Must match D's type        
    Activate(D d) {
        this.d = d;
    }

    //Completely ignore D's type 
    Activate() {
        this.d = (D)new MyWaterFowl(); //Provide default behavior.   
    }

    void setDuckLikeThing(D d) {
        this.d = d;
    }

    void doDuckLikeThings() {
        d.quack();
        d.walk();
        //d.swim(); //Doesn't work 
        //And shouldn't since that was the whole point of ISP.
    }
}

interface CanWalk { public void walk(); }
interface CanQuack { public void quack(); }
interface CanSwim { public void swim(); }

public class MyWaterFowl implements CanWalk, CanQuack {

    public void walk() { System.out.println("I'm walkin` here!"); }
    public void quack() { System.out.println("Quack!"); }
    public void swim() { System.out.println("Stroke! Stroke! Stroke!"); }
}


public class MainClass {

    public static void main(String[] args) {
       //Works
       Activate&lt;MyWaterFowl&gt; a = new Activate&lt;&gt;(new MyWaterFowl());
       a.doDuckLikeThings();

       //Works
       Activate&lt;MyAmericanEagle&gt; ae = new Activate&lt;&gt;( new MyAmericanEagle() );
       ae.doDuckLikeThings();

       //Works but nothing to do with MyAmericanEagle is happening here 
       Activate&lt;MyAmericanEagle&gt; ad = new Activate&lt;&gt;();
       ad.doDuckLikeThings();

       //Rightly produces an error
       //Activate&lt;MyAmericanEagle&gt; aw = new Activate&lt;&gt;( new MyWaterFowl() );
       //ae.doDuckLikeThings();

       //Rightly produces an error
       //Activate&lt;MyWaterFowl&gt; wa = new Activate&lt;&gt;( new MyAmericanEagle() );
       //ae.doDuckLikeThings();

    }
}


So would you ever want a library to leave you wondering why MyAmericanEagle gets completely ignored just to provide some default behavior?
No, this is all broken. The basic issue is the cast-to-D in the following line:


this.d = (D)new MyWaterFowl();



That gives the warning:


Type safety: Unchecked cast from MyWaterFowl to D



Ignoring Generics warnings normally means you are doing something wrong. In this case, you are.

You are doing a cast to a type where you have no certainty, in fact, you are certain that it will fail.... 

.... the solution here, is to not have a default constructor. It does not make sense for you. Why do you think you need one?

Also, why does MyAmericanEagle extend CanQuack ?