本文整理汇总了Java中com.sun.tools.javac.tree.JCTree.JCParens类的典型用法代码示例。如果您正苦于以下问题:Java JCParens类的具体用法?Java JCParens怎么用?Java JCParens使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JCParens类属于com.sun.tools.javac.tree.JCTree包,在下文中一共展示了JCParens类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: visitDoLoop
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
@Override public void visitDoLoop(JCDoWhileLoop tree) {
aPrint("do ");
if (tree.body instanceof JCBlock) {
println("{");
indent++;
print(((JCBlock) tree.body).stats, "");
indent--;
aPrint("}");
} else print(tree.body);
print(" while ");
if (tree.cond instanceof JCParens) {
print(tree.cond);
} else {
print("(");
print(tree.cond);
print(")");
}
println(";", tree);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:21,代码来源:PrettyPrinter.java
示例2: isThereInMiniTree
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
/**
* This function walks into a tree with nodes of type JCBinary to search for
* a string as one of the elements of the tree.
* @param toTest The String searched as Element in the tree.
* @param expression The bifurcation tree searched.
* @return True if the string was found, or False.
*/
private boolean isThereInMiniTree(String toTest, JCTree expression) {
if(expression instanceof JCParens){
if(isThereInMiniTree(toTest, ((JCParens) expression).expr))
return true;
} else if(expression instanceof JCIdent){
if(((JCIdent) expression).name.toString().equals(toTest))
return true;
} else if(expression instanceof JCBinary){
if(isThereInMiniTree(toTest, ((JCBinary) expression).rhs))
return true;
if(isThereInMiniTree(toTest, ((JCBinary) expression).lhs))
return true;
}
return false;
}
开发者ID:alyssonfm,项目名称:jmlok,代码行数:23,代码来源:Examinator.java
示例3: hasTrueValue
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
/**
* Verify if the boolean expression have a true value despite of any variable values.
* @param expression The boolean expression examined.
* @return 1 When the expression is always true.
*/
private int hasTrueValue(JCTree expression) {
if(expression instanceof JCParens){
if(hasTrueValue(((JCParens)expression).expr) != 0)
return 1;
}else if(expression instanceof JCLiteral){
if(((JCLiteral) expression).value == null)
return VAR_FALSE_VALUE;
return (int) ((JCLiteral) expression).value;
}else if(expression instanceof JmlSingleton){
return 1;
}else if(expression instanceof JCBinary){
return resolveBooleanOperations(expression);
}
return VAR_FALSE_VALUE;
}
开发者ID:alyssonfm,项目名称:jmlok,代码行数:21,代码来源:Examinator.java
示例4: matchWhileLoop
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
@Override
public Description matchWhileLoop(WhileLoopTree tree, VisitorState state) {
JCWhileLoop whileLoop = (JCWhileLoop) tree;
JCExpression whileExpression = ((JCParens) whileLoop.getCondition()).getExpression();
if (whileExpression instanceof MethodInvocationTree) {
MethodInvocationTree methodInvocation = (MethodInvocationTree) whileExpression;
if (methodSelect(isDescendantOfMethod("java.util.Iterator", "hasNext()")).matches(
methodInvocation, state)) {
IdentifierTree identifier = getIncrementedIdentifer(extractSingleStatement(whileLoop.body));
if (identifier != null) {
return describeMatch(tree, new SuggestedFix());
}
}
}
return Description.NO_MATCH;
}
开发者ID:diy1,项目名称:error-prone-aspirator,代码行数:17,代码来源:ElementsCountedInLoop.java
示例5: diffParens
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
protected int diffParens(JCParens oldT, JCParens newT, int[] bounds) {
int localPointer = bounds[0];
copyTo(localPointer, getCommentCorrectedOldPos(oldT.expr));
localPointer = diffTree(oldT.expr, newT.expr, getBounds(oldT.expr));
copyTo(localPointer, bounds[1]);
return bounds[1];
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:CasualDiff.java
示例6: visitWhileLoop
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
@Override public void visitWhileLoop(JCWhileLoop tree) {
aPrint("while ");
if (tree.cond instanceof JCParens) {
print(tree.cond);
} else {
print("(");
print(tree.cond);
print(")");
}
print(" ");
print(tree.body);
// make sure to test while (true) ; and while(true){} and while(true) x = 5;
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:14,代码来源:PrettyPrinter.java
示例7: visitIf
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
@Override public void visitIf(JCIf tree) {
aPrint("if ");
if (tree.cond instanceof JCParens) {
print(tree.cond);
} else {
print("(");
print(tree.cond);
print(")");
}
print(" ");
if (tree.thenpart instanceof JCBlock) {
println("{");
indent++;
print(((JCBlock) tree.thenpart).stats, "");
indent--;
if (tree.elsepart == null) {
aPrintln("}", tree);
} else {
aPrint("}");
}
} else {
print(tree.thenpart);
}
if (tree.elsepart != null) {
aPrint(" else ");
print(tree.elsepart);
}
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:29,代码来源:PrettyPrinter.java
示例8: visitSynchronized
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
@Override public void visitSynchronized(JCSynchronized tree) {
aPrint("synchronized ");
if (tree.lock instanceof JCParens) {
print(tree.lock);
} else {
print("(");
print(tree.lock);
print(")");
}
print(" ");
print(tree.body);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:13,代码来源:PrettyPrinter.java
示例9: visitSwitch
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
@Override public void visitSwitch(JCSwitch tree) {
aPrint("switch ");
if (tree.selector instanceof JCParens) {
print(tree.selector);
} else {
print("(");
print(tree.selector);
print(")");
}
println(" {");
print(tree.cases, "\n");
aPrintln("}", tree);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:14,代码来源:PrettyPrinter.java
示例10: returnVarNameIfNullCheck
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的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
示例11: visitParens
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
public void visitParens(JCParens that) {
try {
print("JCParens:");
} catch (Exception e) {
}
super.visitParens(that);
}
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:8,代码来源:PrintAstVisitor.java
示例12: visitParens
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
public void visitParens(JCParens tree) {
try {
print("(");
printExpr(tree.expr);
print(")");
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:10,代码来源:PrettyCommentsPrinter.java
示例13: visitParens
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
public void visitParens(JCParens tree) {
try {
print("(");
printExpr(tree.expr);
print(")");
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
开发者ID:sebastianoe,项目名称:s4j,代码行数:10,代码来源:Pretty.java
示例14: visitParens
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
public void visitParens(JCParens tree) {
Type owntype = attribTree(tree.expr, env, pkind, pt);
result = check(tree, owntype, pkind, pkind, pt);
Symbol sym = TreeInfo.symbol(tree);
if (sym != null && (sym.kind&(TYP|PCK)) != 0)
log.error(tree.pos(), "illegal.start.of.type");
}
开发者ID:sebastianoe,项目名称:s4j,代码行数:8,代码来源:Attr.java
示例15: visitParens
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
@Override
public void visitParens(JCParens that) {
processArg(that, speculativeTree -> new ParensType(that, env, speculativeTree));
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:ArgumentAttr.java
示例16: ParensType
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
ParensType(JCExpression tree, Env<AttrContext> env, JCParens speculativeParens) {
this(tree, env, speculativeParens, new HashMap<>());
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:ArgumentAttr.java
示例17: dup
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
@Override
ArgumentType<JCParens> dup(JCParens tree, Env<AttrContext> env) {
return new ParensType(tree, env, speculativeTree, speculativeTypes);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:ArgumentAttr.java
示例18: Parens
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
public JCParens Parens(JCExpression expr) {
return invoke(Parens, expr);
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:4,代码来源:JavacTreeMaker.java
示例19: visitParens
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
@Override public void visitParens(JCParens tree) {
print("(");
print(tree.expr);
print(")");
}
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:6,代码来源:PrettyPrinter.java
示例20: AJCParens
import com.sun.tools.javac.tree.JCTree.JCParens; //导入依赖的package包/类
public AJCParens(JCParens ltree) {
super(ltree.expr);
}
开发者ID:pcgomes,项目名称:javaparser2jctree,代码行数:4,代码来源:AJCParens.java
注:本文中的com.sun.tools.javac.tree.JCTree.JCParens类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论