Java Code Examples for com.sun.source.doctree.DocTree#accept()

The following examples show how to use com.sun.source.doctree.DocTree#accept() . 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: DocTreePathScannerTest.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Void scan(final DocTree tree, Void ignore) {
    if (tree != null) {
        DocTree previous = null;
        for (DocTree current : getCurrentPath()) {
            if (previous != null) {
                final List<DocTree> children = new ArrayList<>();
                current.accept(new DocTreeScanner<Void, Void>() {
                    @Override public Void scan(DocTree node, Void p) {
                        children.add(node);
                        return null;
                    }
                }, null);

                if (!children.contains(previous)) {
                    error("Invalid DocTreePath for: " + tree);
                }
            }

            previous = current;
        }
    }
    return super.scan(tree, ignore);
}
 
Example 2
Source File: DocTreePathScannerTest.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Void scan(final DocTree tree, Void ignore) {
    if (tree != null) {
        DocTree previous = null;
        for (DocTree current : getCurrentPath()) {
            if (previous != null) {
                final List<DocTree> children = new ArrayList<>();
                current.accept(new DocTreeScanner<Void, Void>() {
                    @Override public Void scan(DocTree node, Void p) {
                        children.add(node);
                        return null;
                    }
                }, null);

                if (!children.contains(previous)) {
                    error("Invalid DocTreePath for: " + tree);
                }
            }

            previous = current;
        }
    }
    return super.scan(tree, ignore);
}
 
Example 3
Source File: DocTreePathScannerTest.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Void scan(final DocTree tree, Void ignore) {
    if (tree != null) {
        DocTree previous = null;
        for (DocTree current : getCurrentPath()) {
            if (previous != null) {
                final List<DocTree> children = new ArrayList<>();
                current.accept(new DocTreeScanner<Void, Void>() {
                    @Override public Void scan(DocTree node, Void p) {
                        children.add(node);
                        return null;
                    }
                }, null);

                if (!children.contains(previous)) {
                    error("Invalid DocTreePath for: " + tree);
                }
            }

            previous = current;
        }
    }
    return super.scan(tree, ignore);
}
 
Example 4
Source File: DocTreePathScannerTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Void scan(final DocTree tree, Void ignore) {
    if (tree != null) {
        DocTree previous = null;
        for (DocTree current : getCurrentPath()) {
            if (previous != null) {
                final List<DocTree> children = new ArrayList<>();
                current.accept(new DocTreeScanner<Void, Void>() {
                    @Override public Void scan(DocTree node, Void p) {
                        children.add(node);
                        return null;
                    }
                }, null);

                if (!children.contains(previous)) {
                    error("Invalid DocTreePath for: " + tree);
                }
            }

            previous = current;
        }
    }
    return super.scan(tree, ignore);
}
 
Example 5
Source File: DocTreePathScanner.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Scan a single node.
 * The current path is updated for the duration of the scan.
 */
@Override
public R scan(DocTree tree, P p) {
    if (tree == null)
        return null;

    DocTreePath prev = path;
    path = new DocTreePath(path, tree);
    try {
        return tree.accept(this, p);
    } finally {
        path = prev;
    }
}
 
Example 6
Source File: JavacTrees.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private DocTree getLastChild(DocTree tree) {
    final DocTree[] last = new DocTree[] {null};

    tree.accept(new DocTreeScanner<Void, Void>() {
        @Override public Void scan(DocTree node, Void p) {
            if (node != null) last[0] = node;
            return null;
        }
    }, null);

    return last[0];
}
 
Example 7
Source File: DocTreePathScanner.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Scan a single node.
 * The current path is updated for the duration of the scan.
 */
@Override
public R scan(DocTree tree, P p) {
    if (tree == null)
        return null;

    DocTreePath prev = path;
    path = new DocTreePath(path, tree);
    try {
        return tree.accept(this, p);
    } finally {
        path = prev;
    }
}
 
Example 8
Source File: DocTreePathHandle.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static List<DocTree> listChildren(@NonNull DocTree t) {
    final List<DocTree> result = new LinkedList<DocTree>();

    t.accept(new DocTreeScanner<Void, Void>() {
        @Override
        public Void scan(DocTree node, Void p) {
            result.add(node);
            return null;
        }
    }, null);

    return result;
}
 
Example 9
Source File: DocTreePathScanner.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Scans a single node.
 * The current path is updated for the duration of the scan.
 * @param tree the tree to be scanned
 * @param p a value to be passed to visitor methods
 * @return the result returned from the main visitor method
 */
@Override
public R scan(DocTree tree, P p) {
    if (tree == null)
        return null;

    DocTreePath prev = path;
    path = new DocTreePath(path, tree);
    try {
        return tree.accept(this, p);
    } finally {
        path = prev;
    }
}
 
Example 10
Source File: JavacTrees.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private DocTree getLastChild(DocTree tree) {
    final DocTree[] last = new DocTree[] {null};

    tree.accept(new DocTreeScanner<Void, Void>() {
        @Override @DefinedBy(Api.COMPILER_TREE)
        public Void scan(DocTree node, Void p) {
            if (node != null) last[0] = node;
            return null;
        }
    }, null);

    return last[0];
}
 
Example 11
Source File: JavacTrees.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private DocTree getLastChild(DocTree tree) {
    final DocTree[] last = new DocTree[] {null};

    tree.accept(new DocTreeScanner<Void, Void>() {
        @Override @DefinedBy(Api.COMPILER_TREE)
        public Void scan(DocTree node, Void p) {
            if (node != null) last[0] = node;
            return null;
        }
    }, null);

    return last[0];
}
 
Example 12
Source File: JavacTrees.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private DocTree getLastChild(DocTree tree) {
    final DocTree[] last = new DocTree[] {null};

    tree.accept(new DocTreeScanner<Void, Void>() {
        @Override public Void scan(DocTree node, Void p) {
            if (node != null) last[0] = node;
            return null;
        }
    }, null);

    return last[0];
}
 
Example 13
Source File: DocTreePathScanner.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Scan a single node.
 * The current path is updated for the duration of the scan.
 */
@Override
public R scan(DocTree tree, P p) {
    if (tree == null)
        return null;

    DocTreePath prev = path;
    path = new DocTreePath(path, tree);
    try {
        return tree.accept(this, p);
    } finally {
        path = prev;
    }
}
 
Example 14
Source File: DocTreePathScanner.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Scan a single node.
 * The current path is updated for the duration of the scan.
 */
@Override
public R scan(DocTree tree, P p) {
    if (tree == null)
        return null;

    DocTreePath prev = path;
    path = new DocTreePath(path, tree);
    try {
        return tree.accept(this, p);
    } finally {
        path = prev;
    }
}
 
Example 15
Source File: JavacTrees.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private DocTree getLastChild(DocTree tree) {
    final DocTree[] last = new DocTree[] {null};

    tree.accept(new DocTreeScanner<Void, Void>() {
        @Override public Void scan(DocTree node, Void p) {
            if (node != null) last[0] = node;
            return null;
        }
    }, null);

    return last[0];
}
 
Example 16
Source File: DocTreePathScanner.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Scan a single node.
 * The current path is updated for the duration of the scan.
 */
@Override
public R scan(DocTree tree, P p) {
    if (tree == null)
        return null;

    DocTreePath prev = path;
    path = new DocTreePath(path, tree);
    try {
        return tree.accept(this, p);
    } finally {
        path = prev;
    }
}
 
Example 17
Source File: SimpleDocTreeVisitorTest.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Void scan(DocTree tree, Void ignore) {
    if (tree != null)
        tree.accept(visitor, ignore);
    return super.scan(tree, ignore);
}
 
Example 18
Source File: SimpleDocTreeVisitorTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Void scan(DocTree tree, Void ignore) {
    if (tree != null)
        tree.accept(visitor, ignore);
    return super.scan(tree, ignore);
}
 
Example 19
Source File: SimpleDocTreeVisitorTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Void scan(DocTree tree, Void ignore) {
    if (tree != null)
        tree.accept(visitor, ignore);
    return super.scan(tree, ignore);
}
 
Example 20
Source File: SimpleDocTreeVisitorTest.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public Void scan(DocTree tree, Void ignore) {
    if (tree != null)
        tree.accept(visitor, ignore);
    return super.scan(tree, ignore);
}