Well, this is a tangled web of partially constructed objects and
polymorphism among inner classes.
But I believe the outer reference is available to the extended inner class when super() returns.
In my
test code below, I've commented the NullPointerExceptions. Here's what I think is happening...
We're trying to make an Outside object. In the process of initializing the members, we try to make an instance of an inner class that extends another inner class. So the constructor of the extended class implicitly calls the constructor of its parent class. Within the constructor of that parent class, a method is called (via polymorphism) in the not-yet-constructed extended class. And that method attempts to reference a variable of the outer class. This is where the problem occurs (regardless of whether that variable is private). However, if we simply comment out the polymorphic method call in the inner parent constructor and allow the extended constructor's super() to return, then we're okay. The constructor of the extended class is then able to access the variable in the outer class.
NOTE: I was only able to do this with inner class constructors calling polymorphic methods that reference outer class variables.
I was unable to reproduce the problem in a simpler context.
[ September 11, 2004: Message edited by: marc weber ]