private static boolean checkMethodUsedByBaseClassOrInterface( BytecodeMethod mtd, ByteCodeClass cls) { if (cls == null) { return false; } if (cls.getBaseInterfacesObject() != null) { for (ByteCodeClass bc : cls.getBaseInterfacesObject()) { for (BytecodeMethod m : bc.getMethods()) { if (m.getMethodName().equals(mtd.getMethodName())) { if (m.isUsedByNative()) { return true; } break; } } } } for (BytecodeMethod m : cls.getMethods()) { if (m.getMethodName().equals(mtd.getMethodName())) { if (m.isUsedByNative()) { return true; } break; } } return false; }
private static void appendClassOffset(ByteCodeClass bc, List<Integer> clsIds) { if (bc.getBaseClassObject() != null) { if (!clsIds.contains(bc.getBaseClassObject().getClassOffset())) { clsIds.add(bc.getBaseClassObject().getClassOffset()); appendClassOffset(bc.getBaseClassObject(), clsIds); } } if (bc.getBaseInterfacesObject() != null) { for (ByteCodeClass c : bc.getBaseInterfacesObject()) { if (c != null && !clsIds.contains(c.getClassOffset())) { clsIds.add(c.getClassOffset()); if (c.getBaseClassObject() != null) { appendClassOffset(c, clsIds); } } } } }
private static boolean isMethodUsedByBaseClassOrInterface(BytecodeMethod mtd, ByteCodeClass cls) { boolean b = checkMethodUsedByBaseClassOrInterface(mtd, cls.getBaseClassObject()); if (b) { return true; } for (ByteCodeClass bc : cls.getBaseInterfacesObject()) { b = checkMethodUsedByBaseClassOrInterface(mtd, bc); if (b) { return true; } } return false; }