This is the mail archive of the
mailing list for the Java project.
Array classes and class loaders
- To: java-discuss at sources dot redhat dot com
- Subject: Array classes and class loaders
- From: Bryce McKinlay <bryce at albatross dot co dot nz>
- Date: Fri, 05 Jan 2001 17:17:52 +1300
_Jv_CreateArrayClass has a "loader" parameter:
_Jv_CreateArrayClass (jclass element, java::lang::ClassLoader *loader,
And it seems that the classloader of the class creating the array is
used as the classloader of the array type:
// vmspec, section 5.3.3 describes this
if (element->loader != loader)
_Jv_RegisterInitiatingLoader (array_class, loader);
But in the JDK 1.3 html documentation for java.lang.ClassLoader we
"Class objects for array classes are not created by class loaders, but
are created automatically as required by the Java runtime. The class
loader for an array class, as returned by Class.getClassLoader() is
the same as the class loader for its element type; if the element type
is a primitive type, then the array class has no class loader. "
Who's right? The later approach would make life a lot easier.
[ bryce ]