title: Can I force the type of a variabile in a extended class to a subtype in Java?
body: <p>Having this: </p>
  
  <pre><code>public class A{}
  public class B extends A{}
  public class C{
      protected A x;
  }
  </code></pre>
  
  <p>Is there any way to create a class D which extends C such that the type of <code>x</code> must be <code>B</code> in all D's instances? Note that C is a class I'm writing, so I could edit it on purpose to accomplish D needs. </p>