classloaders: Java class loaders module (three built-in loaders and which modules each owns, parent delegation traced across a two-loader chain, child-first PluginLoader, class identity and the failing (Plugin) cast, Class.forName vs loadClass initialisation, ClassNotFoundException vs NoClassDefFoundError incl. 'Could not initialize class', hot reload, unloading and a Registry leak, context class loader, jcmd VM.classloaders), 18 contract tests
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b5pUjAyJuUaNEQqzGJ
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
74da9cd899
commit
cca173d104
@@ -0,0 +1,26 @@
|
||||
|
||||
== Which loader defined each class ==
|
||||
java.lang.String -> null (the bootstrap loader)
|
||||
java.util.ArrayList -> null (the bootstrap loader)
|
||||
java.sql.Driver -> 'platform' (jdk.internal.loader.ClassLoaders$PlatformClassLoader)
|
||||
javax.tools.JavaCompiler -> 'platform' (jdk.internal.loader.ClassLoaders$PlatformClassLoader)
|
||||
HierarchyDemo (this class) -> 'app' (jdk.internal.loader.ClassLoaders$AppClassLoader)
|
||||
int[] -> null (the bootstrap loader)
|
||||
HierarchyDemo[] -> 'app' (jdk.internal.loader.ClassLoaders$AppClassLoader)
|
||||
|
||||
== The parent chain, starting from the system (application) loader ==
|
||||
-> 'app' (jdk.internal.loader.ClassLoaders$AppClassLoader)
|
||||
-> 'platform' (jdk.internal.loader.ClassLoaders$PlatformClassLoader)
|
||||
-> null (the bootstrap loader has no parent object)
|
||||
|
||||
getPlatformClassLoader() == getSystemClassLoader().getParent(): true
|
||||
Thread context class loader of main: 'app' (jdk.internal.loader.ClassLoaders$AppClassLoader)
|
||||
|
||||
== Modules by defining loader (JDK 25) ==
|
||||
app 19 modules, e.g. [jdk.attach, jdk.compiler, jdk.editpad, jdk.internal.ed]
|
||||
bootstrap 21 modules, e.g. [java.base, java.datatransfer, java.desktop, java.instrument]
|
||||
platform 21 modules, e.g. [java.compiler, java.net.http, java.scripting, java.security.jgss]
|
||||
|
||||
== Named module vs unnamed module ==
|
||||
String.class.getModule() -> module java.base
|
||||
HierarchyDemo.class.getModule() -> named? false (class-path classes live in the loader's unnamed module)
|
||||
Reference in New Issue
Block a user