Doesn’t mean it has to be mandatory; it could be optional (theoretically - I’m not claiming it would have been easy to integrate with the other requirements of the original spec).
Given how many java programmers don’t use RMI nor Jini (although probably many more should use the latter, and many fewer should use the former), but do use isInstance(), I think it’s fair enough to say this part of the design could have been done better. I’m not claiming the current behaviour isn’t valuable, just that IMHO it would be more intuitive NOT to be the default.
I agree entirely, and this is a large part of why I consider the current design “flawed”. Since it does “much more than load classes” it should NOT be named “ClassLoader”.
IMHO, a better API design would start from the concept of splitting the namespace-management, the class-loading, and the class-management (i.e. for stuff like type comparisons) into two, or possibly three, separate classes / sets of classes. I suspect that “hierarchy” namespace-management and “class” namespace management are two separate things, hence the need for three rather than two classes. The former deals with sandboxing, and separating differently-sourced class hierarchies; the latter is sort-of aspect-oriented, and cuts across sandboxes. Using both in conjunction, abstracted into separate classes, could give you all the benefits of both.
This could lead to a worse design, of course; as a systems architect, I don’t feel that’s a reason not to try :). I live in hope that the ClassLoader’s etc will get a “refresh” in some future release of java…
Yes, sorry, I wasn’t as precise as I could have been :(. The important point, of course, is the gotcha, and there’s more than one way to skin the cat :).