Object obj = VM_Runtime.resolvedNewScalar(cls);
T obj = (T)VM_Runtime.resolvedNewScalar(cls);
  public Object newInstance() throws IllegalAccessException,                                      InstantiationException,                                     ExceptionInInitializerError,                                     SecurityException {    // Basic checks    checkMemberAccess(Member.PUBLIC);    if (!type.isClassType())       throw new InstantiationException();    VM_Class cls = type.asClass();    if (cls.isAbstract() || cls.isInterface())      throw new InstantiationException();    if (!cls.isInitialized()) {      cls.resolve();      cls.instantiate();      cls.initialize();    }    // Find the defaultConstructor    VM_Method defaultConstructor = null;    VM_Method methods[] = type.asClass().getConstructorMethods();    for (int i = 0; i < methods.length; i++) {      VM_Method method = methods[i];      if (method.getParameterTypes().length == 0) {        defaultConstructor = method;        break;      }    }    if (defaultConstructor == null)       throw new InstantiationException();    // Check that caller is allowed to access it    if (!defaultConstructor.isPublic()) {      VM_Class accessingClass = VM_Class.getClassFromStackFrame(1);      JikesRVMSupport.checkAccess(defaultConstructor, accessingClass);    }    // Ensure that the class is initialized    if (!cls.isInitialized()) {      try {        VM_Runtime.initializeClassForDynamicLink(cls);      } catch (Throwable e) {        ExceptionInInitializerError ex = new ExceptionInInitializerError();        ex.initCause(e);        throw ex;      }    }    // Allocate an uninitialized instance;    Object obj = VM_Runtime.resolvedNewScalar(cls);    // Run the default constructor on the it.    VM_Reflection.invoke(defaultConstructor, obj, null);    return obj;  }