-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
@gbracha In section 10.9 (3rd edition), we have:
It is a compile-time error if a class C is a superclass of itself.
And just above that is the definition of the "is a superclass" relation:
A class S is a superclass of a class C iff either:
• S is the superclass of C, or
• S is a superclass of a class S0 and S0 is a superclass of C.
This admits reflexive relations. An implementation that tries to check if C is a superclass of itself using the second case of the definition will get that C is a superclass of itself iff. C is a superclass of itself (by choosing C for the class S0).
We should disallow such compile-time errors unless there is really a transitive chain of "the superclass" from C to C. The second clause should be changed to:
• S is a superclass of a class S0 and S0 is the superclass of C.