private void keepAnnotated(Path path) throws FileNotFoundException {
    for (ClassPathElement element : path.getElements()) {
      forClazz:
      for (String name : element.list()) {
        if (name.endsWith(CLASS_EXTENSION)) {
          DirectClassFile clazz = path.getClass(name);
          if (hasRuntimeVisibleAnnotation(clazz)) {
            filesToKeep.add(name);
          } else {
            MethodList methods = clazz.getMethods();
            for (int i = 0; i < methods.size(); i++) {
              if (hasRuntimeVisibleAnnotation(methods.get(i))) {
                filesToKeep.add(name);
                continue forClazz;
              }
            }
            FieldList fields = clazz.getFields();
            for (int i = 0; i < fields.size(); i++) {
              if (hasRuntimeVisibleAnnotation(fields.get(i))) {
                filesToKeep.add(name);
                continue forClazz;
              }
            }
          }
        }
      }
    }
  }
Keep classes annotated with runtime annotations.
android/android_framework/dex-maker/src/main/java/com/android/multidex/MainDexListBuilder.java