Exemplo n.º 1
0
  /**
   * Classes from the classpath are lazyloaded most of the time, so if they are used e.g. inside the
   * method body only or as superclass of a binary class used, they will be added to the
   * corresponding package only after full visit and after recursive resolving of all supertypes.
   * <br>
   *
   * @param listener progress listener or null if listener is not used.
   */
  private synchronized void discoverAllUsedTypes(final ProgressListener listener) {
    // FIXME: implement ProgressListener using

    if (!getProjectLoader().loadingCompleted) {
      return;
    }

    if (this.allTypesDiscovered) {
      return;
    }

    // System.err.println("loaded types before: " + loadedTypes.size());

    // visit sources
    accept(new AbstractIndexer());

    // Switched off - doesn't help a lot, but slows down too much
    // discoverAllBinaryClasses(visitor);

    // System.err.println("loaded types after: " + loadedTypes.size());

    this.allTypesDiscovered = true;
    getPaths().getClassPath().release();
  }