当前位置: 首页>>代码示例>>Java>>正文


Java JCTree.accept方法代码示例

本文整理汇总了Java中com.sun.tools.javac.tree.JCTree.accept方法的典型用法代码示例。如果您正苦于以下问题:Java JCTree.accept方法的具体用法?Java JCTree.accept怎么用?Java JCTree.accept使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.tools.javac.tree.JCTree的用法示例。


在下文中一共展示了JCTree.accept方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseRClass

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
private void parseRClass(String respectivePackageName, String rClass) {
  Element element;

  try {
    element = elementUtils.getTypeElement(rClass);
  } catch (MirroredTypeException mte) {
    element = typeUtils.asElement(mte.getTypeMirror());
  }

  JCTree tree = (JCTree) trees.getTree(element);
  if (tree != null) { // tree can be null if the references are compiled types and not source
    IdScanner idScanner = new IdScanner(symbols, elementUtils.getPackageOf(element)
        .getQualifiedName().toString(), respectivePackageName);
    tree.accept(idScanner);
  } else {
    parseCompiledR(respectivePackageName, (TypeElement) element);
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:ButterKnifeProcessor.java

示例2: parseRClass

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
private void parseRClass(String respectivePackageName, String rClass) {
    Element element;

    try {
        element = elementUtils.getTypeElement(rClass);
    } catch (MirroredTypeException mte) {
        element = typeUtils.asElement(mte.getTypeMirror());
    }

    JCTree tree = (JCTree) trees.getTree(element);
    if (tree != null) {
        IdScanner idScanner = new IdScanner(symbols, elementUtils.getPackageOf(element)
                .getQualifiedName().toString(), respectivePackageName);
        tree.accept(idScanner);
    } else {
        parseCompiledR(respectivePackageName, (TypeElement) element);
    }
}
 
开发者ID:WellingtonCosta,项目名称:convalida,代码行数:19,代码来源:ConvalidaProcessor.java

示例3: scan

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
@Override
public void scan(JCTree tree) {
    if (tree == null ||
            excludeTags.contains(treeUtil.nameFromTag(tree.getTag()))) {
        return;
    }

    Info self = new Info(tree, endPosTable);
    if (mandatoryType(tree)) {
        check(tree.type != null,
                "'null' field 'type' found in tree ", self);
        if (tree.type==null)
            Thread.dumpStack();
    }

    Field errField = checkFields(tree);
    if (errField!=null) {
        check(false,
                "'null' field '" + errField.getName() + "' found in tree ", self);
    }

    Info prevEncl = encl;
    encl = self;
    tree.accept(this);
    encl = prevEncl;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:CheckAttributedTree.java

示例4: width

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
private void width(JCTree tree, int prec) {
if (tree != null) {
    int prevPrec = this.prec;
    this.prec = prec;
    tree.accept(this);
    this.prec = prevPrec;
}
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:WidthEstimator.java

示例5: parseRClass

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
private void parseRClass(String respectivePackageName, String rClass) {
    Element element;
    try {
        element = elementUtils.getTypeElement(rClass);
    } catch (MirroredTypeException mte) {
        element = typeUtils.asElement(mte.getTypeMirror());
    }
    JCTree tree = (JCTree) trees.getTree(element);
    if (tree != null) { // tree can be null if the references are compiled types and not source
        IdScanner idScanner = new IdScanner(symbols, elementUtils.getPackageOf(element).getQualifiedName().toString(), respectivePackageName, supportedTypes);
        tree.accept(idScanner);
    } else {
        parseCompiledR(respectivePackageName, (TypeElement) element);
    }
}
 
开发者ID:hendraanggrian,项目名称:r-parser,代码行数:16,代码来源:RParser.java

示例6: classEnter

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
/** Visitor method: enter all classes in given tree, catching any
 *  completion failure exceptions. Return the tree's type.
 *
 *  @param tree    The tree to be visited.
 *  @param env     The environment visitor argument.
 */
Type classEnter(JCTree tree, Env<AttrContext> env) {
    Env<AttrContext> prevEnv = this.env;
    try {
        this.env = env;
        tree.accept(this);
        return result;
    }  catch (CompletionFailure ex) {
        return chk.completionError(tree.pos(), ex);
    } finally {
        this.env = prevEnv;
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:19,代码来源:Enter.java

示例7: attribArg

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
/**
 * Main entry point for attributing an argument with given tree and attribution environment.
 */
Type attribArg(JCTree tree, Env<AttrContext> env) {
    Env<AttrContext> prevEnv = this.env;
    try {
        this.env = env;
        tree.accept(this);
        return result;
    } finally {
        this.env = prevEnv;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:ArgumentAttr.java

示例8: printTree

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
protected void printTree(String label, JCTree tree) {
    if (tree == null) {
        printNull(label);
    } else {
        indent();
        String ext;
        try {
            ext = tree.getKind().name();
        } catch (Throwable t) {
            ext = "n/a";
        }
        out.print(label + ": " + info(tree.getClass(), tree.getTag(), ext));
        if (showPositions) {
            // We can always get start position, but to get end position
            // and/or line+offset, we would need a JCCompilationUnit
            out.print(" pos:" + tree.pos);
        }
        if (showTreeTypes && tree.type != null)
            out.print(" type:" + toString(tree.type));
        Symbol sym;
        if (showTreeSymbols && (sym = TreeInfo.symbolFor(tree)) != null)
            out.print(" sym:" + toString(sym));
        out.println();

        indent(+1);
        if (showSrc) {
            indent();
            out.println("src: " + Pretty.toSimpleString(tree, maxSrcLength));
        }
        tree.accept(treeVisitor);
        indent(-1);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:DPrinter.java

示例9: hasDanglingElse

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
public boolean hasDanglingElse(JCTree t) {
if(t==null) return false;
foundDanglingElse = false;
t.accept(this);
return foundDanglingElse;
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:DanglingElseChecker.java

示例10: estimateWidth

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
public int estimateWidth(JCTree t, int maxwidth) {
width = 0;
this.maxwidth = maxwidth;
t.accept(this);
return width;
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:WidthEstimator.java

示例11: scan

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
public void scan(JCTree tree) {
    // short circuit scan when end result is definitely false
    if (maybeConstantExpr && tree != null)
        tree.accept(this);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:JavadocMemberEnter.java

示例12: visitTree

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
@Override
public void visitTree(JCTree that) {
    //delegates to Attr
    that.accept(attr);
    result = attr.result;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:ArgumentAttr.java

示例13: scan

import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
@Override
public void scan(JCTree tree) {
    if (tree == null)
        return;

    Info self = new Info(tree, endPosTable);
    if (check(encl, self)) {
        // Modifiers nodes are present throughout the tree even where
        // there is no corresponding source text.
        // Redundant semicolons in a class definition can cause empty
        // initializer blocks with no positions.
        if ((self.tag == MODIFIERS || self.tag == BLOCK)
                && self.pos == NOPOS) {
            // If pos is NOPOS, so should be the start and end positions
            check("start == NOPOS", encl, self, self.start == NOPOS);
            check("end == NOPOS", encl, self, self.end == NOPOS);
        } else {
            // For this node, start , pos, and endpos should be all defined
            check("start != NOPOS", encl, self, self.start != NOPOS);
            check("pos != NOPOS", encl, self, self.pos != NOPOS);
            check("end != NOPOS", encl, self, self.end != NOPOS);
            // The following should normally be ordered
            // encl.start <= start <= pos <= end <= encl.end
            // In addition, the position of the enclosing node should be
            // within this node.
            // The primary exceptions are for array type nodes, because of the
            // need to support legacy syntax:
            //    e.g.    int a[];    int[] b[];    int f()[] { return null; }
            // and because of inconsistent nesting of left and right of
            // array declarations:
            //    e.g.    int[][] a = new int[2][];
            if (!(encl.tag == REFERENCE && self.tag == ANNOTATED_TYPE)) {
            check("encl.start <= start", encl, self, encl.start <= self.start);
            }
            check("start <= pos", encl, self, self.start <= self.pos);
            if (!( (self.tag == TYPEARRAY ||
                    isAnnotatedArray(self.tree))
                    && (encl.tag == VARDEF ||
                        encl.tag == METHODDEF ||
                        encl.tag == TYPEARRAY ||
                        isAnnotatedArray(encl.tree))
                   ||
                    encl.tag == ANNOTATED_TYPE && self.tag == SELECT
                   ||
                    encl.tag == REFERENCE && self.tag == ANNOTATED_TYPE
                 )) {
                check("encl.pos <= start || end <= encl.pos",
                        encl, self, encl.pos <= self.start || self.end <= encl.pos);
            }
            check("pos <= end", encl, self, self.pos <= self.end);
            if (!( (self.tag == TYPEARRAY || isAnnotatedArray(self.tree)) &&
                    (encl.tag == TYPEARRAY || isAnnotatedArray(encl.tree))
                   ||
                    encl.tag == MODIFIERS && self.tag == ANNOTATION
                 ) ) {
                check("end <= encl.end", encl, self, self.end <= encl.end);
            }
        }
    }

    Info prevEncl = encl;
    encl = self;
    tree.accept(this);
    encl = prevEncl;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:66,代码来源:TreePosTest.java


注:本文中的com.sun.tools.javac.tree.JCTree.accept方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。