Java Code Examples for com.sun.source.tree.LambdaExpressionTree.BodyKind#STATEMENT
The following examples show how to use
com.sun.source.tree.LambdaExpressionTree.BodyKind#STATEMENT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TreePruner.java From bazel with Apache License 2.0 | 5 votes |
@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)); } }
Example 2
Source File: JCTree.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override public BodyKind getBodyKind() { return body.hasTag(BLOCK) ? BodyKind.STATEMENT : BodyKind.EXPRESSION; }
Example 3
Source File: JCTree.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Override public BodyKind getBodyKind() { return body.hasTag(BLOCK) ? BodyKind.STATEMENT : BodyKind.EXPRESSION; }
Example 4
Source File: JCTree.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public BodyKind getBodyKind() { return body.hasTag(BLOCK) ? BodyKind.STATEMENT : BodyKind.EXPRESSION; }
Example 5
Source File: VeryPretty.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void visitLambda(JCLambda tree) { boolean useParens = cs.parensAroundSingularLambdaParam() || tree.params.size() != 1 || tree.paramKind != JCLambda.ParameterKind.IMPLICIT; if (useParens) { print(cs.spaceWithinLambdaParens() && tree.params.nonEmpty() ? "( " : "("); } boolean oldPrintingMethodParams = printingMethodParams; printingMethodParams = true; suppressVariableType = tree.paramKind == JCLambda.ParameterKind.IMPLICIT; wrapTrees(tree.params, cs.wrapLambdaParams(), cs.alignMultilineLambdaParams() ? out.col : out.leftMargin + cs.getContinuationIndentSize(), true); suppressVariableType = false; printingMethodParams = oldPrintingMethodParams; if (useParens) { if (cs.spaceWithinLambdaParens() && tree.params.nonEmpty()) needSpace(); print(')'); } print(cs.spaceAroundLambdaArrow() ? " ->" : "->"); if (tree.getBodyKind() == BodyKind.STATEMENT) { printBlock(tree.body, cs.getOtherBracePlacement(), cs.spaceAroundLambdaArrow()); } else { int rm = cs.getRightMargin(); switch(cs.wrapBinaryOps()) { case WRAP_IF_LONG: if (widthEstimator.estimateWidth(tree.body, rm - out.col) + out.col <= cs.getRightMargin()) { if(cs.spaceAroundLambdaArrow()) print(' '); break; } case WRAP_ALWAYS: newline(); toColExactly(out.leftMargin + cs.getContinuationIndentSize()); break; case WRAP_NEVER: if(cs.spaceAroundLambdaArrow()) print(' '); break; } printExpr(tree.body, TreeInfo.notExpression); } }
Example 6
Source File: JCTree.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override public BodyKind getBodyKind() { return body.hasTag(BLOCK) ? BodyKind.STATEMENT : BodyKind.EXPRESSION; }
Example 7
Source File: JCTree.java From hottub with GNU General Public License v2.0 | 4 votes |
@Override public BodyKind getBodyKind() { return body.hasTag(BLOCK) ? BodyKind.STATEMENT : BodyKind.EXPRESSION; }
Example 8
Source File: JCTree.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override public BodyKind getBodyKind() { return body.hasTag(BLOCK) ? BodyKind.STATEMENT : BodyKind.EXPRESSION; }
Example 9
Source File: JCTree.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Override public BodyKind getBodyKind() { return body.hasTag(BLOCK) ? BodyKind.STATEMENT : BodyKind.EXPRESSION; }