return loadClass(name, false);
}
+ private native Class loadClassFromSig(String name)
+ throws ClassNotFoundException;
+
/**
* Load a class using this ClassLoader or its parent, possibly resolving
* it as well using <code>resolveClass()</code>. It first tries to find
protected synchronized Class loadClass(String name, boolean resolve)
throws ClassNotFoundException
{
- // Have we already loaded this class?
- Class c = findLoadedClass(name);
- if (c == null)
+ // Arrays are handled specially.
+ Class c;
+ if (name.charAt(0) == '[')
+ c = loadClassFromSig(name);
+ else
{
- // Can the class be loaded by a parent?
- try
+ // Have we already loaded this class?
+ c = findLoadedClass(name);
+ if (c == null)
{
- if (parent == null)
+ // Can the class be loaded by a parent?
+ try
{
- c = VMClassLoader.loadClass(name, resolve);
- if (c != null)
- return c;
+ if (parent == null)
+ {
+ c = VMClassLoader.loadClass(name, resolve);
+ if (c != null)
+ return c;
+ }
+ else
+ {
+ return parent.loadClass(name, resolve);
+ }
}
- else
+ catch (ClassNotFoundException e)
{
- return parent.loadClass(name, resolve);
}
+ // Still not found, we have to do it ourself.
+ c = findClass(name);
}
- catch (ClassNotFoundException e)
- {
- }
- // Still not found, we have to do it ourself.
- c = findClass(name);
}
if (resolve)
resolveClass(c);