Java inner classes store the reference to the outer instance in a synthetic field:
class A {
class B {}
}
java.util.Arrays.toString(A.B.class.getDeclaredFields())
// [final A A$B.this$0]
What I am wondering is why this field isn't generated as private.
It can't be accessed by the programmer without reflection (outside B, where A.this refers to it).
The obvious guess is that you can write something in A (outside B) which needs to access it, but I can't think of any such case.