This class:
public class OuterChild extends OuterChild.InnerParent {
public static class InnerParent {
}
}
Fails to compile:
<
An educated SWAG: Because the JVM must first load the parent class, which includes a command to load the inner class. The inner class is defined by the CL after the outer class is defined so any refs to the outer class' fields or methods are resolvable. By trying to extend the outer by the inner, it asks the JVM to compile the inner before the outer, thus creating a chicken and egg problem. The problem has its roots in the fact that an inner class may reference its outer class' field values provided rules around scope and instantiation (static v. non-static) are followed. Because of this possibility, the JVM would need to be guaranteed that at no time anything in the inner class will try to access or mutate any field or object references in the outer class. It can only find this out by compiling both classes, outer first, but needs this information prior to compilation to be certain there won't be a scope or instance problem of some kind. So it's a catch-22.