private String getCommonSuperClass(final String type1, final ClassReader info1, final String type2, final ClassReader info2) { if (isInterface(info1)) { if (typeImplements(type2, info2, type1)) { return type1; } else { if (isInterface(info2)) { if (typeImplements(type1, info1, type2)) { return type2; } else {
/** * Returns true if the given type implements the given interface. * * @param type * the internal name of a class or interface. * @param info * the ClassReader corresponding to 'type'. * @param itf * the internal name of a interface. * @return true if 'type' implements directly or indirectly 'itf' */ private boolean typeImplements(String type, ClassReader info, final String itf) { final String cleanItf = itf.replace(".", "/"); while (!"java/lang/Object".equals(type)) { final String[] itfs = info.getInterfaces(); for (final String itf2 : itfs) { if (itf2.equals(cleanItf)) { return true; } } for (final String itf2 : itfs) { if (typeImplements(itf2, typeInfo(itf2), cleanItf)) { return true; } } type = info.getSuperName(); info = typeInfo(type); } return false; }
private String getCommonSuperClass(final String type1, final ClassReader info1, final String type2, final ClassReader info2) { if (isInterface(info1)) { if (typeImplements(type2, info2, type1)) { return type1; } else { if (isInterface(info2)) { if (typeImplements(type1, info1, type2)) { return type2; } else {
/** * Returns true if the given type implements the given interface. * * @param type * the internal name of a class or interface. * @param info * the ClassReader corresponding to 'type'. * @param itf * the internal name of a interface. * @return true if 'type' implements directly or indirectly 'itf' */ private boolean typeImplements(String type, ClassReader info, final String itf) { final String cleanItf = itf.replace(".", "/"); while (!"java/lang/Object".equals(type)) { final String[] itfs = info.getInterfaces(); for (final String itf2 : itfs) { if (itf2.equals(cleanItf)) { return true; } } for (final String itf2 : itfs) { if (typeImplements(itf2, typeInfo(itf2), cleanItf)) { return true; } } type = info.getSuperName(); info = typeInfo(type); } return false; }