code: private void removeDeadMethods(String clazz, List<BodyDeclaration> declarations) {
      Iterator<BodyDeclaration> declarationsIter = declarations.iterator();
      while (declarationsIter.hasNext()) {
        BodyDeclaration declaration = declarationsIter.next();
        if (declaration instanceof MethodDeclaration) {
          MethodDeclaration method = (MethodDeclaration) declaration;
          ExecutableElement elem = method.getExecutableElement();
          String name = typeUtil.getReferenceName(elem);
          String signature = typeUtil.getReferenceSignature(elem);
          if (deadCodeMap.containsMethod(clazz, name, signature)) {
            if (method.isConstructor()) {
              deadCodeMap.addConstructorRemovedClass(clazz);
            }
            if (Modifier.isNative(method.getModifiers())) {
              removeMethodOCNI(method);
            }
            declarationsIter.remove();
          }
        }
      }
    }
docs: Remove dead methods from a type's body declarations.