本文整理汇总了Java中com.sun.tools.javac.tree.JCTree.JCThrow类的典型用法代码示例。如果您正苦于以下问题:Java JCThrow类的具体用法?Java JCThrow怎么用?Java JCThrow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JCThrow类属于com.sun.tools.javac.tree.JCTree包,在下文中一共展示了JCThrow类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: diffThrow
import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
protected int diffThrow(JCThrow oldT, JCThrow newT, int[] bounds) {
int localPointer = bounds[0];
// expr
int[] exprBounds = getBounds(oldT.expr);
copyTo(localPointer, exprBounds[0]);
localPointer = diffTree(oldT.expr, newT.expr, exprBounds);
copyTo(localPointer, bounds[1]);
return bounds[1];
}
示例2: returnVarNameIfNullCheck
import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
/**
* Checks if the statement is of the form 'if (x == null) {throw WHATEVER;},
* where the block braces are optional. If it is of this form, returns "x".
* If it is not of this form, returns null.
*/
public String returnVarNameIfNullCheck(JCStatement stat) {
if (!(stat instanceof JCIf)) return null;
/* Check that the if's statement is a throw statement, possibly in a block. */ {
JCStatement then = ((JCIf) stat).thenpart;
if (then instanceof JCBlock) {
List<JCStatement> stats = ((JCBlock) then).stats;
if (stats.length() == 0) return null;
then = stats.get(0);
}
if (!(then instanceof JCThrow)) return null;
}
/* Check that the if's conditional is like 'x == null'. Return from this method (don't generate
a nullcheck) if 'x' is equal to our own variable's name: There's already a nullcheck here. */ {
JCExpression cond = ((JCIf) stat).cond;
while (cond instanceof JCParens) cond = ((JCParens) cond).expr;
if (!(cond instanceof JCBinary)) return null;
JCBinary bin = (JCBinary) cond;
if (!CTC_EQUAL.equals(treeTag(bin))) return null;
if (!(bin.lhs instanceof JCIdent)) return null;
if (!(bin.rhs instanceof JCLiteral)) return null;
if (!CTC_BOT.equals(typeTag(bin.rhs))) return null;
return ((JCIdent) bin.lhs).name.toString();
}
}
示例3: visitThrow
import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
public void visitThrow(JCThrow that) {
try {
print("JCThrow:");
} catch (Exception e) {
}
super.visitThrow(that);
}
示例4: visitThrow
import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
public void visitThrow(JCThrow tree) {
try {
print("throw ");
printExpr(tree.expr);
print(";");
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
示例5: visitThrow
import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
public void visitThrow(JCThrow tree) {
try {
print("throw ");
printExpr(tree.expr);
print(";");
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
示例6: visitLambda
import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
@Override
public void visitLambda(JCLambda tree) {
if (tree.getBodyKind() == BodyKind.STATEMENT) {
JCExpression ident = make.at(tree).QualIdent(symtab.assertionErrorType.tsym);
JCThrow throwTree = make.Throw(make.NewClass(null, List.nil(), ident, List.nil(), null));
tree.body = make.Block(0, List.of(throwTree));
}
}
示例7: Throw
import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
public JCThrow Throw(JCExpression expr) {
return invoke(Throw, expr);
}
示例8: visitThrow
import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
@Override public void visitThrow(JCThrow tree) {
aPrint("throw ");
print(tree.expr);
println(";", tree);
}
示例9: AJCThrow
import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
public AJCThrow(JCThrow ltree) {
super(ltree.expr);
}
示例10: inline
import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
@Override
public JCThrow inline(Inliner inliner) throws CouldNotResolveImportException {
return inliner.maker().Throw(getExpression().inline(inliner));
}
示例11: visitThrow
import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
@Override public void visitThrow(JCThrow tree) {
printNode(tree);
child("expr", tree.expr);
indent--;
}
示例12: visitThrow
import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
@Override public void visitThrow(JCThrow node) {
set(node, new Throw().rawThrowable(toTree(node.getExpression())));
}
示例13: visitThrow
import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
@Override
public Choice<State<JCThrow>> visitThrow(ThrowTree node, State<?> state) {
return chooseSubtrees(state, s -> unifyExpression(node.getExpression(), s), maker()::Throw);
}
示例14: visitThrow
import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
public void visitThrow(JCThrow tree) {
attribExpr(tree.expr, env, syms.throwableType);
result = null;
}