code: public static void removeDeadClasses(CompilationUnit unit, CodeReferenceMap deadCodeMap) {
      ElementUtil elementUtil = unit.getEnv().elementUtil();
      Iterator<AbstractTypeDeclaration> iter = unit.getTypes().iterator();
      while (iter.hasNext()) {
        AbstractTypeDeclaration type = iter.next();
        TypeElement typeElement = type.getTypeElement();
        if (!ElementUtil.isGeneratedAnnotation(typeElement)) {
          if (deadCodeMap.containsClass(typeElement, elementUtil)) {
            type.setDeadClass(true);
          } else {
            // Keep class, remove dead interfaces.
            if (typeElement.getInterfaces().size() > 0) {
              GeneratedTypeElement replacement = GeneratedTypeElement.mutableCopy(typeElement);
              for (TypeElement intrface : ElementUtil.getInterfaces(typeElement)) {
                if (!deadCodeMap.containsClass(intrface, elementUtil)) {
                  replacement.addInterface(intrface.asType());
                }
              }
              if (typeElement.getInterfaces().size() > replacement.getInterfaces().size()) {
                type.setTypeElement(replacement);
              }
            }
          }
        }
      }
    }
docs: Remove empty classes marked as dead. This needs to be done after translation
  to avoid inner class references in the AST returned by DeadCodeEliminator.