String (String type1, String type2) { try { InstrumentationClassFinder.PseudoClass cls1 = myFinder.loadClass(type1); InstrumentationClassFinder.PseudoClass cls2 = myFinder.loadClass(type2); if (cls1.isAssignableFrom(cls2)) { return cls1.getName(); } if (cls2.isAssignableFrom(cls1)) { return cls2.getName(); } if (cls1.isInterface() || cls2.isInterface()) { return "java/lang/Object"; } InstrumentationClassFinder.PseudoClass c = cls1; do { c = c.getSuperClass(); } while (!c.isAssignableFrom(cls2)); return c.getName(); } catch (Exception e) { throw new RuntimeException(e.toString(), e); } }