private void removeFields(Predicate<JNode> shouldRemove, JDeclaredType type) { for (int i = 0; i < type.getFields().size(); ++i) { JField field = type.getFields().get(i); if (!shouldRemove.apply(field)) { continue; } wasRemoved(field); type.removeField(i); madeChanges(); --i; } }
private void removeMethods(Predicate<JNode> shouldRemove, JDeclaredType type) { // Skip method 0 which is clinit and is assumed to exist. assert type.getMethods().get(0) == type.getClinitMethod(); for (int i = 1; i < type.getMethods().size(); ++i) { JMethod method = type.getMethods().get(i); if (!shouldRemove.apply(method)) { continue; } prunedMethods.add(method); wasRemoved(method); type.removeMethod(i); program.removeStaticImplMapping(method); madeChanges(); --i; } }