title: Returning an objects subclass with generics
body: <p>With an abstract class I want to define a method that returns "this" for the subclasses:</p>
  
  <pre><code>public abstract class Foo {
      ...
      public &lt;T extends Foo&gt; T eat(String eatCake) {
          ...
          return this;
      }
  }  
  
  public class CakeEater extends Foo {}
  </code></pre>
  
  <p>I want to be able to do things like:</p>
  
  <pre><code>CakeEater phil = new CakeEater();
  phil.eat("wacky cake").eat("chocolate cake").eat("banana bread");
  </code></pre>
  
  <p>Arguably banana bread would throw an IllegalArgumentException with the message "Not a cake!"</p>