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 boolean cullMethods(boolean found) { for (ByteCodeClass bc : classes) { bc.unmark(); if (bc.isIsInterface() || bc.getBaseClass() == null) { continue; } for (BytecodeMethod mtd : bc.getMethods()) { if (mtd.isEliminated() || mtd.isUsedByNative() || mtd.isMain() || mtd.getMethodName().equals("__CLINIT__") || mtd.getMethodName().equals("finalize") || mtd.isNative()) { continue; } if (!isMethodUsed(mtd)) { if (isMethodUsedByBaseClassOrInterface(mtd, bc)) { continue; } found = true; mtd.setEliminated(true); /*if(ByteCodeTranslator.verbose) { System.out.println("Eliminating method: " + mtd.getClsName() + "." + mtd.getMethodName()); }*/ } } } return found; }