public void visitLibraryClass(LibraryClass libraryClass) {
    // Visit the superclass and interfaces.
    libraryClass.superClassAccept(classVisitor);
    libraryClass.interfacesAccept(classVisitor);

    // Visit the fields and methods.
    libraryClass.fieldsAccept(this);
    libraryClass.methodsAccept(this);
  }
Example #2
0
  public void visitLibraryClass(LibraryClass libraryClass) {
    if (shouldBeMarkedAsUsed(libraryClass)) {
      markAsUsed(libraryClass);

      // We're not going to analyze all library code. We're assuming that
      // if this class is being used, all of its methods will be used as
      // well. We'll mark them as such (here and in all subclasses).

      // Mark the superclass.
      Clazz superClass = libraryClass.superClass;
      if (superClass != null) {
        superClass.accept(this);
      }

      // Mark the interfaces.
      Clazz[] interfaceClasses = libraryClass.interfaceClasses;
      if (interfaceClasses != null) {
        for (int index = 0; index < interfaceClasses.length; index++) {
          if (interfaceClasses[index] != null) {
            interfaceClasses[index].accept(this);
          }
        }
      }

      // Mark all methods.
      libraryClass.methodsAccept(this);
    }
  }