Example:
class A {
void foo() {
System.out.println("in A.foo()");
}
}
class B extends A {
void foo() {
System.out.println("in B.foo()");
super.foo();
}
}
class C extends B {
void foo() {
System.out.println("in C.foo()");
super.foo();
}
public static void main(String[] args) {
C obj = new C();
obj.foo();
}
}
If there is only one level of method overriding, the
generated 'super$foo' method is sufficient to get the
correct behavior. But with two or more levels of
overriding, as in this example, both the super-class and
the super-super-class get a 'super$foo' method, and
there is no way to reach A's method using reflection
from an instance of C.
A possible solution might be to generate 'A$super$foo'
and 'B$super$foo' method names (or something like
that), though that makes the dependency between
subclasses and superclasses more fragile.
-- Dan Jacobs, President
ModelObjects Group
djacobs @ modelobjects . com
(spaces added to avoid email sniffing from robots)