title: Why is there no sub-class visibility modifier in Java?
body: <p>On more than one occasion I have found myself desiring a variable visibility that is not possible in Java.  I wanted certain members to be visible within their own class and within any sub-classes, but not to the rest of the package or to the rest of the world.  In other words, I wanted this:</p>
  
  <pre><code>Modifier        Class     Package   Subclass  World
  sub-class       Y         N         Y         N
  </code></pre>
  
  <p>However, the designers of Java only gave me <a href="http://download.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html" rel="noreferrer">this</a>:</p>
  
  <pre><code>Modifier        Class     Package   Subclass  World
  public          Y         Y         Y         Y
  protected       Y         Y         Y         N
  no modifier     Y         Y         N         N
  private         Y         N         N         N
  </code></pre>
  
  <p>The typical case when I want something like this is when creating an abstract class.  Sometimes I find the abstract parent needs access to certain members, but concrete children do as well.  I can give them this access by making the members <code>protected</code>, but that opens up accessibility to the rest of the package when I don't really want to.</p>
  
  <p>To be fully clear, I know such a modifier is <em>not</em> possible in Java.  My question is why is such a modifier not included in Java?  It seems (to me) to be a more natural visibility level than either <code>protected</code> or the default.  Is the reason just along the lines of it not being sufficiently important to be included, or is it more related to possible side effects that I haven't considered?</p>