-
Notifications
You must be signed in to change notification settings - Fork 63
Description
The discussion about issue #69 and #72 revealed that the operations isSubtypeOf
and isAssignableTo
are quite demanding in terms of reflection support, because they require that all the supertypes of the receiver resp. the receiver and the argument are covered. This is because, for instance, aMirror.isSubtypeOf(bMirror)
will search through all supertypes of aMirror
until it encounters bMirror
(returning true
) or the supertype graph has been visited completely (returning false
), and the latter scenario calls for complete coverage of all the direct and indirect supertypes of aMirror
.
With non-generic classes only, it would be rather easy to generate a matrix where the subtyping relationship is specified for every pair of covered classes, without needing reflection support for all the intermediate classes nor all other supertypes of the involved types. However, that strategy does not extend easily to generic classes.
At this point the best advice is probably to use isSubtypeOf
and isAssignableTo
sparingly, especially in cases where the reflection support is requested for a complete subtype hierarchy. In cases that differ substantially from this it is likely to be rather expensive in terms of program size to cover all the classes needed.