Java Code Examples for com.sun.tools.javac.util.ListBuffer#contains()

The following examples show how to use com.sun.tools.javac.util.ListBuffer#contains() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClassDocImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds all inner classes of this class, and their
 * inner classes recursively, to the list l.
 */
void addAllClasses(ListBuffer<ClassDocImpl> l, boolean filtered) {
    try {
        if (isSynthetic()) return;
        // sometimes synthetic classes are not marked synthetic
        if (!JavadocTool.isValidClassName(tsym.name.toString())) return;
        if (filtered && !env.shouldDocument(tsym)) return;
        if (l.contains(this)) return;
        l.append(this);
        List<ClassDocImpl> more = List.nil();
        for (Symbol sym : tsym.members().getSymbols(NON_RECURSIVE)) {
            if (sym != null && sym.kind == TYP) {
                ClassSymbol s = (ClassSymbol)sym;
                ClassDocImpl c = env.getClassDoc(s);
                if (c.isSynthetic()) continue;
                if (c != null) more = more.prepend(c);
            }
        }
        // this extra step preserves the ordering from oldjavadoc
        for (; more.nonEmpty(); more=more.tail) {
            more.head.addAllClasses(l, filtered);
        }
    } catch (CompletionFailure e) {
        // quietly ignore completion failures
    }
}
 
Example 2
Source File: JavadocTool.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Recursively search all directories in path for subdirectory name.
 * Add all packages found in such a directory to packages list.
 */
private void searchSubPackage(String packageName,
                              ListBuffer<String> packages,
                              List<String> excludedPackages,
                              Collection<File> pathnames) {
    if (excludedPackages.contains(packageName))
        return;

    String packageFilename = packageName.replace('.', File.separatorChar);
    boolean addedPackage = false;
    for (File pathname : pathnames) {
        File f = new File(pathname, packageFilename);
        String filenames[] = f.list();
        // if filenames not null, then found directory
        if (filenames != null) {
            for (String filename : filenames) {
                if (!addedPackage
                        && (isValidJavaSourceFile(filename) ||
                            isValidJavaClassFile(filename))
                        && !packages.contains(packageName)) {
                    packages.append(packageName);
                    addedPackage = true;
                } else if (isValidClassName(filename) &&
                           (new File(f, filename)).isDirectory()) {
                    searchSubPackage(packageName + "." + filename,
                                     packages, excludedPackages, pathnames);
                }
            }
        }
    }
}
 
Example 3
Source File: JavadocTool.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Recursively search all directories in path for subdirectory name.
 * Add all packages found in such a directory to packages list.
 */
private void searchSubPackage(String packageName,
                              ListBuffer<String> packages,
                              List<String> excludedPackages,
                              Collection<File> pathnames) {
    if (excludedPackages.contains(packageName))
        return;

    String packageFilename = packageName.replace('.', File.separatorChar);
    boolean addedPackage = false;
    for (File pathname : pathnames) {
        File f = new File(pathname, packageFilename);
        String filenames[] = f.list();
        // if filenames not null, then found directory
        if (filenames != null) {
            for (String filename : filenames) {
                if (!addedPackage
                        && (isValidJavaSourceFile(filename) ||
                            isValidJavaClassFile(filename))
                        && !packages.contains(packageName)) {
                    packages.append(packageName);
                    addedPackage = true;
                } else if (isValidClassName(filename) &&
                           (new File(f, filename)).isDirectory()) {
                    searchSubPackage(packageName + "." + filename,
                                     packages, excludedPackages, pathnames);
                }
            }
        }
    }
}
 
Example 4
Source File: JavadocTool.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Recursively search all directories in path for subdirectory name.
 * Add all packages found in such a directory to packages list.
 */
private void searchSubPackage(String packageName,
                              ListBuffer<String> packages,
                              List<String> excludedPackages,
                              Collection<File> pathnames) {
    if (excludedPackages.contains(packageName))
        return;

    String packageFilename = packageName.replace('.', File.separatorChar);
    boolean addedPackage = false;
    for (File pathname : pathnames) {
        File f = new File(pathname, packageFilename);
        String filenames[] = f.list();
        // if filenames not null, then found directory
        if (filenames != null) {
            for (String filename : filenames) {
                if (!addedPackage
                        && (isValidJavaSourceFile(filename) ||
                            isValidJavaClassFile(filename))
                        && !packages.contains(packageName)) {
                    packages.append(packageName);
                    addedPackage = true;
                } else if (isValidClassName(filename) &&
                           (new File(f, filename)).isDirectory()) {
                    searchSubPackage(packageName + "." + filename,
                                     packages, excludedPackages, pathnames);
                }
            }
        }
    }
}
 
Example 5
Source File: JavadocTool.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Recursively search all directories in path for subdirectory name.
 * Add all packages found in such a directory to packages list.
 */
private void searchSubPackage(String packageName,
                              ListBuffer<String> packages,
                              List<String> excludedPackages,
                              Collection<File> pathnames) {
    if (excludedPackages.contains(packageName))
        return;

    String packageFilename = packageName.replace('.', File.separatorChar);
    boolean addedPackage = false;
    for (File pathname : pathnames) {
        File f = new File(pathname, packageFilename);
        String filenames[] = f.list();
        // if filenames not null, then found directory
        if (filenames != null) {
            for (String filename : filenames) {
                if (!addedPackage
                        && (isValidJavaSourceFile(filename) ||
                            isValidJavaClassFile(filename))
                        && !packages.contains(packageName)) {
                    packages.append(packageName);
                    addedPackage = true;
                } else if (isValidClassName(filename) &&
                           (new File(f, filename)).isDirectory()) {
                    searchSubPackage(packageName + "." + filename,
                                     packages, excludedPackages, pathnames);
                }
            }
        }
    }
}
 
Example 6
Source File: JavadocTool.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Recursively search all directories in path for subdirectory name.
 * Add all packages found in such a directory to packages list.
 */
private void searchSubPackage(String packageName,
                              ListBuffer<String> packages,
                              List<String> excludedPackages,
                              Collection<File> pathnames) {
    if (excludedPackages.contains(packageName))
        return;

    String packageFilename = packageName.replace('.', File.separatorChar);
    boolean addedPackage = false;
    for (File pathname : pathnames) {
        File f = new File(pathname, packageFilename);
        String filenames[] = f.list();
        // if filenames not null, then found directory
        if (filenames != null) {
            for (String filename : filenames) {
                if (!addedPackage
                        && (isValidJavaSourceFile(filename) ||
                            isValidJavaClassFile(filename))
                        && !packages.contains(packageName)) {
                    packages.append(packageName);
                    addedPackage = true;
                } else if (isValidClassName(filename) &&
                           (new File(f, filename)).isDirectory()) {
                    searchSubPackage(packageName + "." + filename,
                                     packages, excludedPackages, pathnames);
                }
            }
        }
    }
}
 
Example 7
Source File: JavadocTool.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Recursively search all directories in path for subdirectory name.
 * Add all packages found in such a directory to packages list.
 */
private void searchSubPackage(String packageName,
                              ListBuffer<String> packages,
                              List<String> excludedPackages,
                              Collection<File> pathnames) {
    if (excludedPackages.contains(packageName))
        return;

    String packageFilename = packageName.replace('.', File.separatorChar);
    boolean addedPackage = false;
    for (File pathname : pathnames) {
        File f = new File(pathname, packageFilename);
        String filenames[] = f.list();
        // if filenames not null, then found directory
        if (filenames != null) {
            for (String filename : filenames) {
                if (!addedPackage
                        && (isValidJavaSourceFile(filename) ||
                            isValidJavaClassFile(filename))
                        && !packages.contains(packageName)) {
                    packages.append(packageName);
                    addedPackage = true;
                } else if (isValidClassName(filename) &&
                           (new File(f, filename)).isDirectory()) {
                    searchSubPackage(packageName + "." + filename,
                                     packages, excludedPackages, pathnames);
                }
            }
        }
    }
}
 
Example 8
Source File: JavadocTool.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Recursively search all directories in path for subdirectory name.
 * Add all packages found in such a directory to packages list.
 */
private void searchSubPackage(String packageName,
                              ListBuffer<String> packages,
                              List<String> excludedPackages,
                              Collection<File> pathnames) {
    if (excludedPackages.contains(packageName))
        return;

    String packageFilename = packageName.replace('.', File.separatorChar);
    boolean addedPackage = false;
    for (File pathname : pathnames) {
        File f = new File(pathname, packageFilename);
        String filenames[] = f.list();
        // if filenames not null, then found directory
        if (filenames != null) {
            for (String filename : filenames) {
                if (!addedPackage
                        && (isValidJavaSourceFile(filename) ||
                            isValidJavaClassFile(filename))
                        && !packages.contains(packageName)) {
                    packages.append(packageName);
                    addedPackage = true;
                } else if (isValidClassName(filename) &&
                           (new File(f, filename)).isDirectory()) {
                    searchSubPackage(packageName + "." + filename,
                                     packages, excludedPackages, pathnames);
                }
            }
        }
    }
}