for (VM_Class current = type.asClass(); current != null; current = current.getSuperClass().asClass()) {
for (VM_Class current = type.asClass(); current != null; current = current.getSuperClass()) {
  public Method getMethod(String name, Class parameterTypes[]) throws NoSuchMethodException, SecurityException {    checkMemberAccess(Member.PUBLIC);    if (!type.isClassType()) throw new NoSuchMethodException(name + parameterTypes);    VM_Atom aName = VM_Atom.findUnicodeAtom(name);    if (aName == null || 	aName == VM_ClassLoader.StandardClassInitializerMethodName ||	aName == VM_ClassLoader.StandardObjectInitializerMethodName) {      // null means that we don't have such an atom; <init> and <clinit> are not methods.      throw new NoSuchMethodException(name + parameterTypes);    }        // (1) Scan the declared public methods of this class and each of its superclasses    for (VM_Class current = type.asClass(); current != null; current = current.getSuperClass().asClass()) {      VM_Method[] methods = current.getDeclaredMethods();       java.lang.reflect.Method answer = null;      for (int i = 0; i<methods.length; i++) {	VM_Method meth = methods[i];	if (meth.getName() == aName && meth.isPublic() &&	    parametersMatch(meth.getParameterTypes(), parameterTypes)) {	  if (answer == null) {	    answer = java.lang.reflect.JikesRVMSupport.createMethod(meth);	  } else {	    java.lang.reflect.Method m2 = java.lang.reflect.JikesRVMSupport.createMethod(meth);	    if (answer.getReturnType().isAssignableFrom(m2.getReturnType())) {	      answer = m2;	    }	  }	}      }      if (answer != null) return answer;    }    // (2) Now we need to consider methods inherited from interfaces.    //     Because we inject the requisite Miranda methods, we can do this simply    //     by looking at this class's virtual methods instead of searching interface hierarchies.    VM_Method[] methods = type.asClass().getVirtualMethods();     java.lang.reflect.Method answer = null;    for (int i = 0; i<methods.length; i++) {      VM_Method meth = methods[i];      if (meth.getName() == aName && meth.isPublic() &&	  parametersMatch(meth.getParameterTypes(), parameterTypes)) {	if (answer == null) {	  answer = java.lang.reflect.JikesRVMSupport.createMethod(meth);	} else {	  java.lang.reflect.Method m2 = java.lang.reflect.JikesRVMSupport.createMethod(meth);	  if (answer.getReturnType().isAssignableFrom(m2.getReturnType())) {	    answer = m2;	  }	}      }    }    if (answer != null) return answer;    throw new NoSuchMethodException(name + parameterTypes);  }