Array classes and class loaders
Bryce McKinlay
bryce@albatross.co.nz
Thu Jan 4 20:15:00 GMT 2001
_Jv_CreateArrayClass has a "loader" parameter:
jclass
_Jv_CreateArrayClass (jclass element, java::lang::ClassLoader *loader,
_Jv_VTable *array_vtable)
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
have:
"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.
regards
[ bryce ]
More information about the Java
mailing list