Java Code Examples for com.sun.tools.javac.tree.TreeInfo#declarationFor()

The following examples show how to use com.sun.tools.javac.tree.TreeInfo#declarationFor() . 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: JavacElements.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the tree node and compilation unit corresponding to this
 * element, or null if they can't be found.
 */
private Pair<JCTree, JCCompilationUnit> getTreeAndTopLevel(Element e) {
    Symbol sym = cast(Symbol.class, e);
    Env<AttrContext> enterEnv = getEnterEnv(sym);
    if (enterEnv == null)
        return null;
    JCTree tree = TreeInfo.declarationFor(sym, enterEnv.tree);
    if (tree == null || enterEnv.toplevel == null)
        return null;
    return new Pair<JCTree,JCCompilationUnit>(tree, enterEnv.toplevel);
}
 
Example 2
Source File: JavacElements.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the tree node and compilation unit corresponding to this
 * element, or null if they can't be found.
 */
private Pair<JCTree, JCCompilationUnit> getTreeAndTopLevel(Element e) {
    Symbol sym = cast(Symbol.class, e);
    Env<AttrContext> enterEnv = getEnterEnv(sym);
    if (enterEnv == null)
        return null;
    JCTree tree = TreeInfo.declarationFor(sym, enterEnv.tree);
    if (tree == null || enterEnv.toplevel == null)
        return null;
    return new Pair<JCTree,JCCompilationUnit>(tree, enterEnv.toplevel);
}
 
Example 3
Source File: JavacElements.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the tree node and compilation unit corresponding to this
 * element, or null if they can't be found.
 */
private Pair<JCTree, JCCompilationUnit> getTreeAndTopLevel(Element e) {
    Symbol sym = cast(Symbol.class, e);
    Env<AttrContext> enterEnv = getEnterEnv(sym);
    if (enterEnv == null)
        return null;
    JCTree tree = TreeInfo.declarationFor(sym, enterEnv.tree);
    if (tree == null || enterEnv.toplevel == null)
        return null;
    return new Pair<JCTree,JCCompilationUnit>(tree, enterEnv.toplevel);
}
 
Example 4
Source File: JavacElements.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the tree node and compilation unit corresponding to this
 * element, or null if they can't be found.
 */
private Pair<JCTree, JCCompilationUnit> getTreeAndTopLevel(Element e) {
    Symbol sym = cast(Symbol.class, e);
    Env<AttrContext> enterEnv = getEnterEnv(sym);
    if (enterEnv == null)
        return null;
    JCTree tree = TreeInfo.declarationFor(sym, enterEnv.tree);
    if (tree == null || enterEnv.toplevel == null)
        return null;
    return new Pair<JCTree,JCCompilationUnit>(tree, enterEnv.toplevel);
}
 
Example 5
Source File: JavacElements.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Returns the tree node and compilation unit corresponding to this
 * element, or null if they can't be found.
 */
private Pair<JCTree, JCCompilationUnit> getTreeAndTopLevel(Element e) {
    Symbol sym = cast(Symbol.class, e);
    Env<AttrContext> enterEnv = getEnterEnv(sym);
    if (enterEnv == null)
        return null;
    JCTree tree = TreeInfo.declarationFor(sym, enterEnv.tree);
    if (tree == null || enterEnv.toplevel == null)
        return null;
    return new Pair<>(tree, enterEnv.toplevel);
}
 
Example 6
Source File: JavacElements.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the tree node and compilation unit corresponding to this
 * element, or null if they can't be found.
 */
private Pair<JCTree, JCCompilationUnit> getTreeAndTopLevel(Element e) {
    Symbol sym = cast(Symbol.class, e);
    Env<AttrContext> enterEnv = getEnterEnv(sym);
    if (enterEnv == null)
        return null;
    JCTree tree = TreeInfo.declarationFor(sym, enterEnv.tree);
    if (tree == null || enterEnv.toplevel == null)
        return null;
    return new Pair<JCTree,JCCompilationUnit>(tree, enterEnv.toplevel);
}
 
Example 7
Source File: JavacElements.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the tree node and compilation unit corresponding to this
 * element, or null if they can't be found.
 */
private Pair<JCTree, JCCompilationUnit> getTreeAndTopLevel(Element e) {
    Symbol sym = cast(Symbol.class, e);
    Env<AttrContext> enterEnv = getEnterEnv(sym);
    if (enterEnv == null)
        return null;
    JCTree tree = TreeInfo.declarationFor(sym, enterEnv.tree);
    if (tree == null || enterEnv.toplevel == null)
        return null;
    return new Pair<JCTree,JCCompilationUnit>(tree, enterEnv.toplevel);
}
 
Example 8
Source File: JavacElements.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the tree node and compilation unit corresponding to this
 * element, or null if they can't be found.
 */
private Pair<JCTree, JCCompilationUnit> getTreeAndTopLevel(Element e) {
    Symbol sym = cast(Symbol.class, e);
    Env<AttrContext> enterEnv = getEnterEnv(sym);
    if (enterEnv == null)
        return null;
    JCTree tree = TreeInfo.declarationFor(sym, enterEnv.tree);
    if (tree == null || enterEnv.toplevel == null)
        return null;
    return new Pair<>(tree, enterEnv.toplevel);
}
 
Example 9
Source File: JavacElements.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the tree node and compilation unit corresponding to this
 * element, or null if they can't be found.
 */
private Pair<JCTree, JCCompilationUnit> getTreeAndTopLevel(Element e) {
    Symbol sym = cast(Symbol.class, e);
    Env<AttrContext> enterEnv = getEnterEnv(sym);
    if (enterEnv == null)
        return null;
    JCTree tree = TreeInfo.declarationFor(sym, enterEnv.tree);
    if (tree == null || enterEnv.toplevel == null)
        return null;
    return new Pair<JCTree,JCCompilationUnit>(tree, enterEnv.toplevel);
}
 
Example 10
Source File: JavacElements.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the tree node and compilation unit corresponding to this
 * element, or null if they can't be found.
 */
private Pair<JCTree, JCCompilationUnit> getTreeAndTopLevel(Element e) {
    Symbol sym = cast(Symbol.class, e);
    Env<AttrContext> enterEnv = getEnterEnv(sym);
    if (enterEnv == null)
        return null;
    JCTree tree = TreeInfo.declarationFor(sym, enterEnv.tree);
    if (tree == null || enterEnv.toplevel == null)
        return null;
    return new Pair<JCTree,JCCompilationUnit>(tree, enterEnv.toplevel);
}
 
Example 11
Source File: JavacElements.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the tree node and compilation unit corresponding to this
 * element, or null if they can't be found.
 */
private Pair<JCTree, JCCompilationUnit> getTreeAndTopLevel(Element e) {
    Symbol sym = cast(Symbol.class, e);
    Env<AttrContext> enterEnv = getEnterEnv(sym);
    if (enterEnv == null)
        return null;
    JCTree tree = TreeInfo.declarationFor(sym, enterEnv.tree);
    if (tree == null || enterEnv.toplevel == null)
        return null;
    return new Pair<JCTree,JCCompilationUnit>(tree, enterEnv.toplevel);
}