2.9. Inversion and the Context Class Loader
Thanks to the delegation model, one class can reference another without both classes having to come from the same class loader. In particular, a class A can reference any class B that is visible to A's class loader's delegation. More concretely, an application class Main can refer to java.lang.String even though Main comes from the classpath class loader and String comes from the bootstrap loader. However, this relationship is not bidirectional. The String class cannot refer to the application Main class, because the classpath class loader is not part of the bootstrap loader's delegation. The problem is one of inversion— a class from a parent loader cannot reference a class from a child loader. Some ...
Get Component Development for the Java™ Platform now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.