public static Class forName(String typeName) throws ClassNotFoundException { boolean DEBUG = false; if (DEBUG) VM.sysWrite("Class.forName starting", typeName); SecurityManager security = System.getSecurityManager(); if (security != null) throw new VM_UnimplementedError("Classloading with security manager"); ClassLoader defaultClassLoader = VM_Class.getClassLoaderFromStackFrame(1);   if (defaultClassLoader != null && defaultClassLoader != VM_SystemClassLoader.getVMClassLoader()) { if (DEBUG) VM.sysWrite("Class.forName loading with special class loader ", typeName); return defaultClassLoader.loadClass(typeName); } else { if (DEBUG) VM.sysWrite("Class.forName loading with default class loader ", typeName); Class guess = (Class) classCache.get( typeName ); if (guess != null)  return guess;  synchronized (VM_ClassLoader.lock) { try { if (typeName.startsWith("[")) { if (!validArrayDescriptor(typeName)) throw new IllegalArgumentException(); else classCache.put(typeName, VM_Array.forName(typeName).getClassForType()); } else classCache.put(typeName, VM_Class.forName(typeName).getClassForType()); if (DEBUG) VM.sysWrite("Class.forName returning for ", typeName); return (Class) classCache.get( typeName ); } catch (VM_ResolutionException e) { throw new ClassNotFoundException(typeName); }
public static Class forName(String className, boolean initialize, ClassLoader classLoader) throws ClassNotFoundException { SecurityManager security = System.getSecurityManager(); boolean DEBUG = false; if (security != null) throw new VM_UnimplementedError("Classloading with security manager");  if ( (initialize == true) && ( (classLoader == null) || (classLoader instanceof VM_SystemClassLoader) ) ) {  Class guess = (Class) classCache.get( className ); if (guess != null) { VM_Callbacks.notifyForName( guess.type ); return guess; }  synchronized (VM_ClassLoader.lock) { try { if (className.startsWith("[")) { if (!validArrayDescriptor(className)) throw new IllegalArgumentException(); classCache.put(className, VM_Array.forName(className).getClassForType()); VM_Callbacks.notifyForName(((Class)classCache.get(className)).type); return (Class) classCache.get( className ); } else { classCache.put(className, VM_Class.forName(className).getClassForType()); VM_Callbacks.notifyForName(((Class)classCache.get(className)).type); return (Class) classCache.get( className ); } } catch (VM_ResolutionException e) { throw new ClassNotFoundException(className); } }
  public static Class forName(String typeName) throws ClassNotFoundException {    boolean DEBUG = false;    if (DEBUG) VM.sysWrite("Class.forName starting", typeName);    SecurityManager security = System.getSecurityManager();    if (security != null)      throw new VM_UnimplementedError("Classloading with security manager");    ClassLoader defaultClassLoader = VM_Class.getClassLoaderFromStackFrame(1);    // If requestor was loaded by a user's classloader, invoke it for load    //     if (defaultClassLoader != null && defaultClassLoader !=         VM_SystemClassLoader.getVMClassLoader()) {      if (DEBUG) VM.sysWrite("Class.forName loading with special class loader ", typeName);      return defaultClassLoader.loadClass(typeName);    }    else {      if (DEBUG) VM.sysWrite("Class.forName loading with default class loader ", typeName);      Class guess = (Class) classCache.get( typeName );      if (guess != null)  return guess;      synchronized (VM_ClassLoader.lock) {        try {          if (typeName.startsWith("[")) {            if (!validArrayDescriptor(typeName)) throw new IllegalArgumentException();            else classCache.put(typeName, VM_Array.forName(typeName).getClassForType());          }          else            classCache.put(typeName, VM_Class.forName(typeName).getClassForType());          if (DEBUG) VM.sysWrite("Class.forName returning for ", typeName);          return (Class) classCache.get( typeName );        }        catch (VM_ResolutionException e) {          throw new ClassNotFoundException(typeName);        }      }    }  }