Java 类com.sun.tools.javac.tree.JCTree.JCThrow 实例源码

项目:incubator-netbeans    文件:CasualDiff.java   
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];
}
项目:lombok-ianchiu    文件:HandleNonNull.java   
/**
 * 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();
    }
}
项目:javaparser2jctree    文件:PrintAstVisitor.java   
public void visitThrow(JCThrow that) {
    try {
        print("JCThrow:");
    } catch (Exception e) {
    }
    super.visitThrow(that);
}
项目:EasyMPermission    文件:PrettyCommentsPrinter.java   
public void visitThrow(JCThrow tree) {
    try {
        print("throw ");
        printExpr(tree.expr);
        print(";");
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
项目:EasyMPermission    文件:HandleNonNull.java   
/**
 * 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();
    }
}
项目:s4j    文件:Pretty.java   
public void visitThrow(JCThrow tree) {
    try {
        print("throw ");
        printExpr(tree.expr);
        print(";");
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
项目:bazel    文件:TreePruner.java   
@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));
  }
}
项目:lombok    文件:PrettyCommentsPrinter.java   
public void visitThrow(JCThrow tree) {
    try {
        print("throw ");
        printExpr(tree.expr);
        print(";");
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}
项目:lombok-ianchiu    文件:JavacTreeMaker.java   
public JCThrow Throw(JCExpression expr) {
    return invoke(Throw, expr);
}
项目:lombok-ianchiu    文件:PrettyPrinter.java   
@Override public void visitThrow(JCThrow tree) {
    aPrint("throw ");
    print(tree.expr);
    println(";", tree);
}
项目:javaparser2jctree    文件:AJCThrow.java   
public AJCThrow(JCThrow ltree) {
    super(ltree.expr);
}
项目:javaparser2jctree    文件:AJCThrow.java   
public AJCThrow(JCThrow ltree, String lcomment) {
    this(ltree);
    setComment(lcomment);
}
项目:EasyMPermission    文件:JavacTreeMaker.java   
public JCThrow Throw(JCExpression expr) {
    return invoke(Throw, expr);
}
项目:refactor-faster    文件:UThrow.java   
@Override
public JCThrow inline(Inliner inliner) throws CouldNotResolveImportException {
  return inliner.maker().Throw(getExpression().inline(inliner));
}
项目:android-retrolambda-lombok    文件:JcTreePrinter.java   
@Override public void visitThrow(JCThrow tree) {
    printNode(tree);
    child("expr", tree.expr);
    indent--;
}
项目:android-retrolambda-lombok    文件:JcTreeConverter.java   
@Override public void visitThrow(JCThrow node) {
    set(node, new Throw().rawThrowable(toTree(node.getExpression())));
}
项目:error-prone    文件:PlaceholderUnificationVisitor.java   
@Override
public Choice<State<JCThrow>> visitThrow(ThrowTree node, State<?> state) {
  return chooseSubtrees(state, s -> unifyExpression(node.getExpression(), s), maker()::Throw);
}
项目:error-prone    文件:UThrow.java   
@Override
public JCThrow inline(Inliner inliner) throws CouldNotResolveImportException {
  return inliner.maker().Throw(getExpression().inline(inliner));
}
项目:s4j    文件:Attr.java   
public void visitThrow(JCThrow tree) {
    attribExpr(tree.expr, env, syms.throwableType);
    result = null;
}
项目:Refaster    文件:UThrow.java   
@Override
public JCThrow inline(Inliner inliner) throws CouldNotResolveImportException {
  return inliner.maker().Throw(getExpression().inline(inliner));
}