Java Code Examples for com.sun.source.doctree.DocTree#Kind

The following examples show how to use com.sun.source.doctree.DocTree#Kind . 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: Utils.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public List<? extends DocTree> filteredList(List<? extends DocTree> dlist, DocTree.Kind... select) {
    List<DocTree> list = new ArrayList<>(dlist.size());
    if (select == null)
        return dlist;
    for (DocTree dt : dlist) {
        if (dt.getKind() != ERRONEOUS) {
            for (DocTree.Kind kind : select) {
                if (dt.getKind() == kind) {
                    list.add(dt);
                }
            }
        }
    }
    return list;
}
 
Example 2
Source File: SimpleDocTreeVisitorTest.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
void run() throws Exception {
    List<File> files = new ArrayList<File>();
    File testSrc = new File(System.getProperty("test.src"));
    for (File f: testSrc.listFiles()) {
        if (f.isFile() && f.getName().endsWith(".java"))
            files.add(f);
    }

    JavacTool javac = JavacTool.create();
    StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);

    Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);

    JavacTask t = javac.getTask(null, fm, null, null, null, fos);
    DocTrees trees = DocTrees.instance(t);

    Iterable<? extends CompilationUnitTree> units = t.parse();

    Set<DocTree.Kind> found = EnumSet.noneOf(DocTree.Kind.class);
    DeclScanner ds = new DeclScanner(trees, found);
    for (CompilationUnitTree unit: units) {
        ds.scan(unit, null);
    }

    for (DocTree.Kind k: DocTree.Kind.values()) {
        if (!found.contains(k) && k != DocTree.Kind.OTHER)
            error("not found: " + k);
    }

    if (errors > 0)
        throw new Exception(errors + " errors occurred");
}
 
Example 3
Source File: SimpleDocTreeVisitorTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
void run() throws Exception {
    List<File> files = new ArrayList<File>();
    File testSrc = new File(System.getProperty("test.src"));
    for (File f: testSrc.listFiles()) {
        if (f.isFile() && f.getName().endsWith(".java"))
            files.add(f);
    }

    JavacTool javac = JavacTool.create();
    StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);

    Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);

    JavacTask t = javac.getTask(null, fm, null, null, null, fos);
    DocTrees trees = DocTrees.instance(t);

    Iterable<? extends CompilationUnitTree> units = t.parse();

    Set<DocTree.Kind> found = EnumSet.noneOf(DocTree.Kind.class);
    DeclScanner ds = new DeclScanner(trees, found);
    for (CompilationUnitTree unit: units) {
        ds.scan(unit, null);
    }

    for (DocTree.Kind k: DocTree.Kind.values()) {
        if (!found.contains(k) && k != DocTree.Kind.OTHER)
            error("not found: " + k);
    }

    if (errors > 0)
        throw new Exception(errors + " errors occurred");
}
 
Example 4
Source File: Utils.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private List<? extends DocTree> getBlockTags0(Element element, DocTree.Kind... kinds) {
    DocCommentTree dcTree = getDocCommentTree(element);
    if (dcTree == null)
        return Collections.emptyList();

    return filteredList(dcTree.getBlockTags(), kinds);
}
 
Example 5
Source File: SimpleDocTreeVisitorTest.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
CommentScanner(Set<DocTree.Kind> found) {
    visitor = new Visitor(found);
}
 
Example 6
Source File: ChangeParamsTransformer.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public DocTree.Kind getKind() {
    return PARAM;
}
 
Example 7
Source File: DocTreePathHandle.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public DocTree.Kind getKind() {
    return kind;
}
 
Example 8
Source File: DocTreePathHandle.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public CountingDelegate(TreePathHandle parent, int index, DocTree.Kind kind) {
    this.parent = parent;
    this.index = index;
    this.kind = kind;
}
 
Example 9
Source File: DocTreePathHandle.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public DocTree.Kind getKind() {
    return DocTree.Kind.DOC_COMMENT;
}
 
Example 10
Source File: DocTreePathHandle.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public ArrayList<DocTree.Kind> getList() {
    return kindPath;
}
 
Example 11
Source File: SimpleDocTreeVisitorTest.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
Visitor(Set<DocTree.Kind> found) {
    this.found = found;
}
 
Example 12
Source File: SimpleDocTreeVisitorTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
DeclScanner(DocTrees trees, final Set<DocTree.Kind> found) {
    this.trees = trees;
    cs = new CommentScanner(found);
}
 
Example 13
Source File: SimpleDocTreeVisitorTest.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
Visitor(Set<DocTree.Kind> found) {
    this.found = found;
}
 
Example 14
Source File: SimpleDocTreeVisitorTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
Visitor(Set<DocTree.Kind> found) {
    this.found = found;
}
 
Example 15
Source File: Utils.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public boolean hasBlockTag(Element element, DocTree.Kind kind) {
    return hasBlockTag(element, kind, null);
}
 
Example 16
Source File: SimpleDocTreeVisitorTest.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
CommentScanner(Set<DocTree.Kind> found) {
    visitor = new Visitor(found);
}
 
Example 17
Source File: SimpleDocTreeVisitorTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
CommentScanner(Set<DocTree.Kind> found) {
    visitor = new Visitor(found);
}
 
Example 18
Source File: DocTreePathHandle.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the {@link DocTree.Kind} of this DocTreePathHandle, it returns the kind
 * of the {@link DocTree} from which the handle was created.
 *
 * @return {@link Tree.Kind}
 */
public DocTree.Kind getKind() {
    return this.delegate.getKind();
}
 
Example 19
Source File: DocTreePathHandle.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the {@link Tree.Kind} of this TreePathHandle, it returns the
 * kind of the {@link Tree} from which the handle was created.
 *
 * @return {@link Tree.Kind}
 */
public DocTree.Kind getKind() {
    return kind;
}
 
Example 20
Source File: DocTreePathHandle.java    From netbeans with Apache License 2.0 votes vote down vote up
public DocTree.Kind getKind();