title: Java: Cannot access protected methods of nested class subclass in subclass of outer class
body: <p>I'm decomposing a class to allow for reuse, different info-hided implementations etc.</p>
  
  <p>It was:</p>
  
  <pre><code>public class Outer
  {
      public static class Inner
      {
          // ...
          protected static void innerDoSomething()
          {
              // ...
          }
      }
  
      public outerDoSomething()
      {
          //...   
          Inner.innerDoSomething();
          //...
      }
  }
  </code></pre>
  
  <p>And all was well and good, since the outer Outer class is allowed to access protected members of nested Inner class.</p>
  
  <p>But trying to decompose as such:</p>
  
  <pre><code>public class SuperOuter
  {
      public static class SuperInner
      {
          // ...
          protected static void innerDoSomething()
          {
              // ...
          }
      }
  
      // ...
  }
  
  public class SubOuter extends SuperOuter
  {
      public static class SubInner extends SuperInner
      {
          // ...
          protected static void innerDoSomethingElse()
          {
              // ...
          }
      }
  
      public outerDoSomething()
      {
          //...   
          SubInner.innerDoSomethingElse(); // OK
          SubInner.innerDoSomething();     // Error: cannnot access!
          //...
      }
  }
  </code></pre>
  
  <p>innerDoSomething() is not accessible, even if protected members of SubInner are accessible by SubOuter, and all protected members of SuperInner should be part of SubInner protected interface.</p>
  
  <p>The only way to make it work, seems to be to add explicit delegation for each method, such as:</p>
  
  <pre><code>    public static class SubInner extends SuperInner
      {
          // ...
          protected static void innerDoSomethingElse()
          {
              // ...
          }
  
          protected static void innerDoSomething()
          {
              SuperInner.innerDoSomething();
          }
      }
  </code></pre>
  
  <p>Which is annoying, error-prone and time-wasting. I'm tempted to just declare innerDoSomething() as public, but it's not really correct since it's meant to be used only by SubOuter and its subclasses.</p>
  
  <p>How come? Shouldn't innerDoSomething() protected access be ihnerited and accessibile by SubOuter?</p>