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


Java JCThrow类代码示例

本文整理汇总了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];
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:CasualDiff.java

示例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();
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:32,代码来源:HandleNonNull.java

示例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);
}
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:8,代码来源:PrintAstVisitor.java

示例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);
	}
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:10,代码来源:PrettyCommentsPrinter.java

示例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);
    }
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:10,代码来源:Pretty.java

示例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));
  }
}
 
开发者ID:bazelbuild,项目名称:bazel,代码行数:9,代码来源:TreePruner.java

示例7: Throw

import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
public JCThrow Throw(JCExpression expr) {
	return invoke(Throw, expr);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:4,代码来源:JavacTreeMaker.java

示例8: visitThrow

import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
@Override public void visitThrow(JCThrow tree) {
	aPrint("throw ");
	print(tree.expr);
	println(";", tree);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:6,代码来源:PrettyPrinter.java

示例9: AJCThrow

import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
public AJCThrow(JCThrow ltree) {
    super(ltree.expr);
}
 
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:4,代码来源:AJCThrow.java

示例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));
}
 
开发者ID:sivakumar-kailasam,项目名称:refactor-faster,代码行数:5,代码来源:UThrow.java

示例11: visitThrow

import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
@Override public void visitThrow(JCThrow tree) {
	printNode(tree);
	child("expr", tree.expr);
	indent--;
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:6,代码来源:JcTreePrinter.java

示例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())));
}
 
开发者ID:evant,项目名称:android-retrolambda-lombok,代码行数:4,代码来源:JcTreeConverter.java

示例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);
}
 
开发者ID:google,项目名称:error-prone,代码行数:5,代码来源:PlaceholderUnificationVisitor.java

示例14: visitThrow

import com.sun.tools.javac.tree.JCTree.JCThrow; //导入依赖的package包/类
public void visitThrow(JCThrow tree) {
    attribExpr(tree.expr, env, syms.throwableType);
    result = null;
}
 
开发者ID:sebastianoe,项目名称:s4j,代码行数:5,代码来源:Attr.java


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