public static SootMethod resolve(SootMethodRef ref) throws CannotFindMethodException {
  SootClass cl=ref.declaringClass();
  while (true) {
    if (cl.declaresMethod(ref.getSubSignature())) {
      SootMethod possibleTarget=cl.getMethod(ref.getSubSignature());
      if (ref.isStatic() == possibleTarget.isStatic())       return possibleTarget;
    }
    if (cl.hasSuperclass())     cl=cl.getSuperclass();
 else     break;
  }
  cl=ref.declaringClass();
  while (true) {
    LinkedList<SootClass> queue=new LinkedList<SootClass>();
    queue.addAll(cl.getInterfaces());
    while (!queue.isEmpty()) {
      SootClass iface=queue.removeFirst();
      if (iface.declaresMethod(ref.getSubSignature())) {
        SootMethod possibleTarget=iface.getMethod(ref.getSubSignature());
        if (ref.isStatic() == possibleTarget.isStatic())         return possibleTarget;
      }
      queue.addAll(iface.getInterfaces());
    }
    if (cl.hasSuperclass())     cl=cl.getSuperclass();
 else     break;
  }
  throw new CannotFindMethodException(cl,ref);
}

public static SootMethod resolve ( SootMethodRef ref ) throws CannotFindMethodException { SootClass cl = ref . declaringClass ( ) ; while ( true ) { if ( cl . declaresMethod ( ref . getSubSignature ( ) ) ) { SootMethod possibleTarget = cl . getMethod ( ref . getSubSignature ( ) ) ; if ( ref . isStatic ( ) == possibleTarget . isStatic ( ) ) return possibleTarget ; } if ( cl . hasSuperclass ( ) ) cl = cl . getSuperclass ( ) ; else break ; } cl = ref . declaringClass ( ) ; while ( true ) { LinkedList < SootClass > queue = new LinkedList < SootClass > ( ) ; queue . addAll ( cl . getInterfaces ( ) ) ; while ( ! queue . isEmpty ( ) ) { SootClass iface = queue . removeFirst ( ) ; if ( iface . declaresMethod ( ref . getSubSignature ( ) ) ) { SootMethod possibleTarget = iface . getMethod ( ref . getSubSignature ( ) ) ; if ( ref . isStatic ( ) == possibleTarget . isStatic ( ) ) return possibleTarget ; } queue . addAll ( iface . getInterfaces ( ) ) ; } if ( cl . hasSuperclass ( ) ) cl = cl . getSuperclass ( ) ; else break ; } throw new CannotFindMethodException ( cl , ref ) ; }
resolve a method ref to the first defined method of its ancestors . search superclasses first , then search interfaces of superclasses . so this search tries to find concrete methods first . copied from sootmethodrefimpl , but crap about phantom refs and ignore resolution errors excised .
