com.sun.source.tree.BinaryTree Java Examples
The following examples show how to use
com.sun.source.tree.BinaryTree.
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: JavacParserTest.java From hottub with GNU General Public License v2.0 | 6 votes |
@Test void testPreferredPositionForBinaryOp() throws IOException { String code = "package test; public class Test {" + "private void test() {" + "Object o = null; boolean b = o != null && o instanceof String;" + "} private Test() {}}"; CompilationUnitTree cut = getCompilationUnitTree(code); ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0); MethodTree method = (MethodTree) clazz.getMembers().get(0); VariableTree condSt = (VariableTree) method.getBody().getStatements().get(1); BinaryTree cond = (BinaryTree) condSt.getInitializer(); JCTree condJC = (JCTree) cond; int condStartPos = code.indexOf("&&"); assertEquals("testPreferredPositionForBinaryOp", condStartPos, condJC.pos); }
Example #2
Source File: AddCastFix.java From netbeans with Apache License 2.0 | 6 votes |
@Override protected void performRewrite(TransformationContext ctx) throws Exception { TypeMirror resolvedTargetType = targetType.resolve(ctx.getWorkingCopy()); if (resolvedTargetType == null) { //cannot resolve anymore: return; } TreePath resolvedIdealTypeTree = idealTypeTree != null ? idealTypeTree.resolve(ctx.getWorkingCopy()) : null; TreeMaker make = ctx.getWorkingCopy().getTreeMaker(); ExpressionTree toCast = (ExpressionTree) ctx.getPath().getLeaf(); Class interf = toCast.getKind().asInterface(); boolean wrapWithBrackets = interf == BinaryTree.class || interf == ConditionalExpressionTree.class; if (/*TODO: replace with JavaFixUtilities.requiresparenthesis*/wrapWithBrackets) { toCast = make.Parenthesized(toCast); } ExpressionTree cast = make.TypeCast(resolvedIdealTypeTree != null ? resolvedIdealTypeTree.getLeaf() : make.Type(resolvedTargetType), toCast); ctx.getWorkingCopy().rewrite(ctx.getPath().getLeaf(), cast); }
Example #3
Source File: BoxedIdentityComparison.java From netbeans with Apache License 2.0 | 6 votes |
@Override protected void performRewrite(TransformationContext ctx) throws Exception { TreePath p = ctx.getPath(); if (p.getLeaf().getKind() != Tree.Kind.EQUAL_TO && p.getLeaf().getKind() != Tree.Kind.NOT_EQUAL_TO) { // TODO - report ? return; } BinaryTree bt = (BinaryTree)p.getLeaf(); TreeMaker mk = ctx.getWorkingCopy().getTreeMaker(); ExpressionTree replace = mk.MethodInvocation( Collections.<ExpressionTree>emptyList(), mk.MemberSelect( mk.QualIdent(JU_OBJECTS), "equals" // NOI18N ), Arrays.asList(bt.getLeftOperand(), bt.getRightOperand()) ); if (bt.getKind() == Tree.Kind.NOT_EQUAL_TO) { replace = mk.Unary(Tree.Kind.LOGICAL_COMPLEMENT, replace); } ctx.getWorkingCopy().rewrite(bt, replace); }
Example #4
Source File: ConvertToTextBlock.java From netbeans with Apache License 2.0 | 6 votes |
private static String getTextOrNull(TreePath tp) { StringBuilder text = new StringBuilder(); Tree current = tp.getLeaf(); while (current.getKind() == Kind.PLUS) { BinaryTree bt = (BinaryTree) current; if (bt.getRightOperand().getKind() == Kind.STRING_LITERAL) { text.insert(0, ((LiteralTree) bt.getRightOperand()).getValue()); } else { return null; } current = bt.getLeftOperand(); } if (current.getKind() == Kind.STRING_LITERAL) { text.insert(0, ((LiteralTree) current).getValue()); } else { return null; } String textString = text.toString(); if (!textString.contains("\n")) { return null; } return textString; }
Example #5
Source File: UnnecessaryBoxing.java From netbeans with Apache License 2.0 | 6 votes |
private static boolean checkBinaryOp(CompilationInfo ci, TreePath expr, Tree prev) { BinaryTree bt = (BinaryTree)expr.getLeaf(); Tree other = prev == bt.getLeftOperand() ? bt.getRightOperand() : bt.getLeftOperand(); Boolean b = checkTwoArguments(ci, expr, other, prev); if (Boolean.TRUE == b) { return true; } if (b == null) { return false; } TypeMirror tm = ci.getTrees().getTypeMirror(new TreePath(expr, other)); if (tm != null && tm.getKind() == TypeKind.DECLARED) { Element el = ((DeclaredType)tm).asElement(); if (el != null && el.getKind() == ElementKind.CLASS) { return ((TypeElement)el).getQualifiedName().contentEquals("java.lang.String"); // NOI18N } } return false; }
Example #6
Source File: NullAway.java From NullAway with MIT License | 6 votes |
@Override public Description matchBinary(BinaryTree tree, VisitorState state) { if (!matchWithinClass) { return Description.NO_MATCH; } ExpressionTree leftOperand = tree.getLeftOperand(); ExpressionTree rightOperand = tree.getRightOperand(); Type leftType = ASTHelpers.getType(leftOperand); Type rightType = ASTHelpers.getType(rightOperand); if (leftType == null || rightType == null) { throw new RuntimeException(); } if (leftType.isPrimitive() && !rightType.isPrimitive()) { return doUnboxingCheck(state, rightOperand); } if (rightType.isPrimitive() && !leftType.isPrimitive()) { return doUnboxingCheck(state, leftOperand); } return Description.NO_MATCH; }
Example #7
Source File: JavacParserTest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Test void testPreferredPositionForBinaryOp() throws IOException { String code = "package test; public class Test {" + "private void test() {" + "Object o = null; boolean b = o != null && o instanceof String;" + "} private Test() {}}"; CompilationUnitTree cut = getCompilationUnitTree(code); ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0); MethodTree method = (MethodTree) clazz.getMembers().get(0); VariableTree condSt = (VariableTree) method.getBody().getStatements().get(1); BinaryTree cond = (BinaryTree) condSt.getInitializer(); JCTree condJC = (JCTree) cond; int condStartPos = code.indexOf("&&"); assertEquals("testPreferredPositionForBinaryOp", condStartPos, condJC.pos); }
Example #8
Source File: JavaInputAstVisitor.java From javaide with GNU General Public License v3.0 | 6 votes |
/** * Accumulate the operands and operators. */ private static void walkInfix( int precedence, ExpressionTree expression, List<ExpressionTree> operands, List<String> operators) { if (expression instanceof BinaryTree) { BinaryTree binaryTree = (BinaryTree) expression; if (precedence(binaryTree) == precedence) { walkInfix(precedence, binaryTree.getLeftOperand(), operands, operators); operators.add(operatorName(expression)); walkInfix(precedence, binaryTree.getRightOperand(), operands, operators); } else { operands.add(expression); } } else { operands.add(expression); } }
Example #9
Source File: JavaInputAstVisitor.java From javaide with GNU General Public License v3.0 | 6 votes |
@Override public Void visitBinary(BinaryTree node, Void unused) { sync(node); /* * Collect together all operators with same precedence to clean up indentation. Eclipse's * extended operands help a little (to collect together the same operator), but they're applied * inconsistently, and don't apply to other operators of the same precedence. */ List<ExpressionTree> operands = new ArrayList<>(); List<String> operators = new ArrayList<>(); walkInfix(precedence(node), node, operands, operators); FillMode fillMode = hasOnlyShortItems(operands) ? INDEPENDENT : UNIFIED; builder.open(plusFour); scan(operands.get(0), null); int operatorsN = operators.size(); for (int i = 0; i < operatorsN; i++) { builder.breakOp(fillMode, " ", ZERO); builder.op(operators.get(i)); builder.space(); scan(operands.get(i + 1), null); } builder.close(); return null; }
Example #10
Source File: JavacParserTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Test void testPreferredPositionForBinaryOp() throws IOException { String code = "package test; public class Test {" + "private void test() {" + "Object o = null; boolean b = o != null && o instanceof String;" + "} private Test() {}}"; CompilationUnitTree cut = getCompilationUnitTree(code); ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0); MethodTree method = (MethodTree) clazz.getMembers().get(0); VariableTree condSt = (VariableTree) method.getBody().getStatements().get(1); BinaryTree cond = (BinaryTree) condSt.getInitializer(); JCTree condJC = (JCTree) cond; int condStartPos = code.indexOf("&&"); assertEquals("testPreferredPositionForBinaryOp", condStartPos, condJC.pos); }
Example #11
Source File: JavacParserTest.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Test void testPreferredPositionForBinaryOp() throws IOException { String code = "package test; public class Test {" + "private void test() {" + "Object o = null; boolean b = o != null && o instanceof String;" + "} private Test() {}}"; CompilationUnitTree cut = getCompilationUnitTree(code); ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0); MethodTree method = (MethodTree) clazz.getMembers().get(0); VariableTree condSt = (VariableTree) method.getBody().getStatements().get(1); BinaryTree cond = (BinaryTree) condSt.getInitializer(); JCTree condJC = (JCTree) cond; int condStartPos = code.indexOf("&&"); assertEquals("testPreferredPositionForBinaryOp", condStartPos, condJC.pos); }
Example #12
Source File: JavacParserTest.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Test void testPreferredPositionForBinaryOp() throws IOException { String code = "package test; public class Test {" + "private void test() {" + "Object o = null; boolean b = o != null && o instanceof String;" + "} private Test() {}}"; CompilationUnitTree cut = getCompilationUnitTree(code); ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0); MethodTree method = (MethodTree) clazz.getMembers().get(0); VariableTree condSt = (VariableTree) method.getBody().getStatements().get(1); BinaryTree cond = (BinaryTree) condSt.getInitializer(); JCTree condJC = (JCTree) cond; int condStartPos = code.indexOf("&&"); assertEquals("testPreferredPositionForBinaryOp", condStartPos, condJC.pos); }
Example #13
Source File: JavacParserTest.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Test void testPreferredPositionForBinaryOp() throws IOException { String code = "package test; public class Test {" + "private void test() {" + "Object o = null; boolean b = o != null && o instanceof String;" + "} private Test() {}}"; CompilationUnitTree cut = getCompilationUnitTree(code); ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0); MethodTree method = (MethodTree) clazz.getMembers().get(0); VariableTree condSt = (VariableTree) method.getBody().getStatements().get(1); BinaryTree cond = (BinaryTree) condSt.getInitializer(); JCTree condJC = (JCTree) cond; int condStartPos = code.indexOf("&&"); assertEquals("testPreferredPositionForBinaryOp", condStartPos, condJC.pos); }
Example #14
Source File: JavacParserTest.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Test void testPreferredPositionForBinaryOp() throws IOException { String code = "package test; public class Test {" + "private void test() {" + "Object o = null; boolean b = o != null && o instanceof String;" + "} private Test() {}}"; CompilationUnitTree cut = getCompilationUnitTree(code); ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0); MethodTree method = (MethodTree) clazz.getMembers().get(0); VariableTree condSt = (VariableTree) method.getBody().getStatements().get(1); BinaryTree cond = (BinaryTree) condSt.getInitializer(); JCTree condJC = (JCTree) cond; int condStartPos = code.indexOf("&&"); assertEquals("testPreferredPositionForBinaryOp", condStartPos, condJC.pos); }
Example #15
Source File: JavaInputAstVisitor.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
/** * Accumulate the operands and operators. */ private static void walkInfix( int precedence, ExpressionTree expression, List<ExpressionTree> operands, List<String> operators) { if (expression instanceof BinaryTree) { BinaryTree binaryTree = (BinaryTree) expression; if (precedence(binaryTree) == precedence) { walkInfix(precedence, binaryTree.getLeftOperand(), operands, operators); operators.add(operatorName(expression)); walkInfix(precedence, binaryTree.getRightOperand(), operands, operators); } else { operands.add(expression); } } else { operands.add(expression); } }
Example #16
Source File: JavaInputAstVisitor.java From java-n-IDE-for-Android with Apache License 2.0 | 6 votes |
@Override public Void visitBinary(BinaryTree node, Void unused) { sync(node); /* * Collect together all operators with same precedence to clean up indentation. Eclipse's * extended operands help a little (to collect together the same operator), but they're applied * inconsistently, and don't apply to other operators of the same precedence. */ List<ExpressionTree> operands = new ArrayList<>(); List<String> operators = new ArrayList<>(); walkInfix(precedence(node), node, operands, operators); FillMode fillMode = hasOnlyShortItems(operands) ? INDEPENDENT : UNIFIED; builder.open(plusFour); scan(operands.get(0), null); int operatorsN = operators.size(); for (int i = 0; i < operatorsN; i++) { builder.breakOp(fillMode, " ", ZERO); builder.op(operators.get(i)); builder.space(); scan(operands.get(i + 1), null); } builder.close(); return null; }
Example #17
Source File: JavaInputAstVisitor.java From google-java-format with Apache License 2.0 | 6 votes |
@Override public Void visitBinary(BinaryTree node, Void unused) { sync(node); /* * Collect together all operators with same precedence to clean up indentation. */ List<ExpressionTree> operands = new ArrayList<>(); List<String> operators = new ArrayList<>(); walkInfix(precedence(node), node, operands, operators); FillMode fillMode = hasOnlyShortItems(operands) ? INDEPENDENT : UNIFIED; builder.open(plusFour); scan(operands.get(0), null); int operatorsN = operators.size(); for (int i = 0; i < operatorsN; i++) { builder.breakOp(fillMode, " ", ZERO); builder.op(operators.get(i)); builder.space(); scan(operands.get(i + 1), null); } builder.close(); return null; }
Example #18
Source File: JavacParserTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Test void testPreferredPositionForBinaryOp() throws IOException { String code = "package test; public class Test {" + "private void test() {" + "Object o = null; boolean b = o != null && o instanceof String;" + "} private Test() {}}"; CompilationUnitTree cut = getCompilationUnitTree(code); ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0); MethodTree method = (MethodTree) clazz.getMembers().get(0); VariableTree condSt = (VariableTree) method.getBody().getStatements().get(1); BinaryTree cond = (BinaryTree) condSt.getInitializer(); JCTree condJC = (JCTree) cond; int condStartPos = code.indexOf("&&"); assertEquals("testPreferredPositionForBinaryOp", condStartPos, condJC.pos); }
Example #19
Source File: JavaInputAstVisitor.java From google-java-format with Apache License 2.0 | 6 votes |
/** Accumulate the operands and operators. */ private static void walkInfix( int precedence, ExpressionTree expression, List<ExpressionTree> operands, List<String> operators) { if (expression instanceof BinaryTree) { BinaryTree binaryTree = (BinaryTree) expression; if (precedence(binaryTree) == precedence) { walkInfix(precedence, binaryTree.getLeftOperand(), operands, operators); operators.add(operatorName(expression)); walkInfix(precedence, binaryTree.getRightOperand(), operands, operators); } else { operands.add(expression); } } else { operands.add(expression); } }
Example #20
Source File: ModelBuilder.java From vertx-codetrans with Apache License 2.0 | 5 votes |
@Override public CodeModel visitForLoop(ForLoopTree node, VisitContext context) { if (node.getInitializer().size() != 1) { throw new UnsupportedOperationException(); } if (node.getUpdate().size() != 1) { throw new UnsupportedOperationException(); } StatementModel body = scan(node.getStatement(), context); if (node.getInitializer().size() == 1 && node.getInitializer().get(0).getKind() == Tree.Kind.VARIABLE && node.getCondition().getKind() == Tree.Kind.LESS_THAN && node.getUpdate().size() == 1 && node.getUpdate().get(0).getKind() == Tree.Kind.EXPRESSION_STATEMENT && node.getUpdate().get(0).getExpression().getKind() == Tree.Kind.POSTFIX_INCREMENT) { VariableTree init = (VariableTree) node.getInitializer().get(0); BinaryTree lessThan = (BinaryTree) node.getCondition(); UnaryTree increment = (UnaryTree) node.getUpdate().get(0).getExpression(); if (lessThan.getLeftOperand().getKind() == Tree.Kind.IDENTIFIER && increment.getExpression().getKind() == Tree.Kind.IDENTIFIER) { String id1 = init.getName().toString(); String id2 = ((IdentifierTree) lessThan.getLeftOperand()).getName().toString(); String id3 = ((IdentifierTree) increment.getExpression()).getName().toString(); if (id1.equals(id2) && id2.equals(id3)) { ExpressionModel from = scan(init.getInitializer(), context); ExpressionModel to = scan(lessThan.getRightOperand(), context); return context.builder.sequenceForLoop(id1, from, to, body); } } } StatementModel initializer = scan(node.getInitializer().get(0), context); ExpressionModel update = scan(node.getUpdate().get(0).getExpression(), context); ExpressionModel condition = scan(node.getCondition(), context); return context.builder.forLoop(initializer, condition, update, body); }
Example #21
Source File: TreePruner.java From bazel with Apache License 2.0 | 5 votes |
@Override public Boolean visitBinary(BinaryTree node, Void p) { switch (node.getKind()) { case MULTIPLY: case DIVIDE: case REMAINDER: case PLUS: case MINUS: case LEFT_SHIFT: case RIGHT_SHIFT: case UNSIGNED_RIGHT_SHIFT: case LESS_THAN: case LESS_THAN_EQUAL: case GREATER_THAN: case GREATER_THAN_EQUAL: case AND: case XOR: case OR: case CONDITIONAL_AND: case CONDITIONAL_OR: case EQUAL_TO: case NOT_EQUAL_TO: break; default: // non-constant binary expression return false; } return reduce( node.getLeftOperand().accept(this, null), node.getRightOperand().accept(this, null)); }
Example #22
Source File: UBinary.java From Refaster with Apache License 2.0 | 5 votes |
@Override @Nullable public Unifier visitBinary(BinaryTree binary, @Nullable Unifier unifier) { unifier = getKind().equals(binary.getKind()) ? unifier : null; unifier = getLeftOperand().unify(binary.getLeftOperand(), unifier); return getRightOperand().unify(binary.getRightOperand(), unifier); }
Example #23
Source File: TreeConverter.java From j2objc with Apache License 2.0 | 5 votes |
private TreeNode convertBinary(BinaryTree node, TreePath parent) { TreePath path = getTreePath(parent, node); InfixExpression newNode = new InfixExpression(); newNode .setTypeMirror(getTypeMirror(path)) .setOperator(InfixExpression.Operator.from(node.getKind())); // Flatten this tree to avoid stack overflow with very deep trees. This // code traverses the subtree non-recursively and merges all children // that have the same operator into this node. List<StackState> stack = Lists.newArrayList(); stack.add(new StackState(node)); while (!stack.isEmpty()) { StackState currentState = stack.get(stack.size() - 1); ExpressionTree child = currentState.nextChild(); if (child == null) { stack.remove(stack.size() - 1); continue; } if (child instanceof BinaryTree) { BinaryTree infixChild = (BinaryTree) child; if (infixChild.getKind() == node.getKind()) { stack.add(new StackState(infixChild)); continue; } } newNode.addOperand((Expression) convert(child, path)); } return newNode; }
Example #24
Source File: NullAway.java From NullAway with MIT License | 5 votes |
/** * @param path tree path to read operation * @return true if it is permissible to perform this read before the field has been initialized, * false otherwise */ private boolean okToReadBeforeInitialized(TreePath path) { TreePath parentPath = path.getParentPath(); Tree leaf = path.getLeaf(); Tree parent = parentPath.getLeaf(); if (parent instanceof AssignmentTree) { // ok if it's actually a write AssignmentTree assignment = (AssignmentTree) parent; return assignment.getVariable().equals(leaf); } else if (parent instanceof BinaryTree) { // ok if we're comparing to null BinaryTree binaryTree = (BinaryTree) parent; Tree.Kind kind = binaryTree.getKind(); if (kind.equals(Tree.Kind.EQUAL_TO) || kind.equals(Tree.Kind.NOT_EQUAL_TO)) { ExpressionTree left = binaryTree.getLeftOperand(); ExpressionTree right = binaryTree.getRightOperand(); return (left.equals(leaf) && right.getKind().equals(Tree.Kind.NULL_LITERAL)) || (right.equals(leaf) && left.getKind().equals(Tree.Kind.NULL_LITERAL)); } } else if (parent instanceof MethodInvocationTree) { // ok if it's invoking castToNonNull and the read is the argument MethodInvocationTree methodInvoke = (MethodInvocationTree) parent; Symbol.MethodSymbol methodSymbol = ASTHelpers.getSymbol(methodInvoke); String qualifiedName = ASTHelpers.enclosingClass(methodSymbol) + "." + methodSymbol.getSimpleName().toString(); if (qualifiedName.equals(config.getCastToNonNullMethod())) { List<? extends ExpressionTree> arguments = methodInvoke.getArguments(); return arguments.size() == 1 && leaf.equals(arguments.get(0)); } } return false; }
Example #25
Source File: Ifs.java From netbeans with Apache License 2.0 | 5 votes |
private ExpressionTree negateBinaryOperator(WorkingCopy copy, Tree original, Kind newKind, boolean negateOperands) { BinaryTree bt = (BinaryTree) original; if (negateOperands) { negate(copy, bt.getLeftOperand(), original); negate(copy, bt.getRightOperand(), original); } return copy.getTreeMaker().Binary(newKind, bt.getLeftOperand(), bt.getRightOperand()); }
Example #26
Source File: TreeDiffer.java From compile-testing with Apache License 2.0 | 5 votes |
@Override public Void visitBinary(BinaryTree expected, Tree actual) { Optional<BinaryTree> other = checkTypeAndCast(expected, actual); if (!other.isPresent()) { addTypeMismatch(expected, actual); return null; } scan(expected.getLeftOperand(), other.get().getLeftOperand()); scan(expected.getRightOperand(), other.get().getRightOperand()); return null; }
Example #27
Source File: FlipOperands.java From netbeans with Apache License 2.0 | 5 votes |
@Override protected void performRewrite(TransformationContext ctx) throws Exception { BinaryTree orig = (BinaryTree) ctx.getPath().getLeaf(); BinaryTree nue = ctx.getWorkingCopy().getTreeMaker().Binary(targetKind, orig.getRightOperand(), orig.getLeftOperand()); ctx.getWorkingCopy().rewrite(orig, nue); }
Example #28
Source File: WrongStringComparison.java From netbeans with Apache License 2.0 | 5 votes |
ExpressionTree matchSign(TreeMaker make, BinaryTree oldTree, ExpressionTree et) { if (oldTree.getKind() == Tree.Kind.NOT_EQUAL_TO) { return make.Unary(Tree.Kind.LOGICAL_COMPLEMENT, et); } else { return et; } }
Example #29
Source File: Utilities.java From netbeans with Apache License 2.0 | 5 votes |
private static ExpressionTree negateBinaryOperator(TreeMaker make, Tree original, Kind newKind, boolean negateOperands) { BinaryTree bt = (BinaryTree) original; ExpressionTree left = bt.getLeftOperand(); ExpressionTree right = bt.getRightOperand(); if (negateOperands) { left = negate(make, left, original); right = negate(make, right, original); } return make.Binary(newKind, left, right); }
Example #30
Source File: JavaFixUtilities.java From netbeans with Apache License 2.0 | 5 votes |
private ExpressionTree negateBinaryOperator(Tree original, Kind newKind, boolean negateOperands) { BinaryTree bt = (BinaryTree) original; BinaryTree nonNegated = make.Binary(newKind, bt.getLeftOperand(), bt.getRightOperand()); if (negateOperands) { ExpressionTree lo = negate(bt.getLeftOperand(), nonNegated, false); ExpressionTree ro = negate(bt.getRightOperand(), nonNegated, false); return make.Binary(newKind, lo != null ? lo : bt.getLeftOperand(), ro != null ? ro : bt.getRightOperand()); } return nonNegated; }