List of usage examples for org.eclipse.jdt.core.dom InfixExpression getOperator
public InfixExpression.Operator getOperator()
From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java
License:Open Source License
@Override public boolean visit(InfixExpression node) { node.getLeftOperand().accept(this); this.fBuffer.append(' '); // for cases like x= i - -1; or x= i++ + ++i; this.fBuffer.append(node.getOperator().toString()); this.fBuffer.append(' '); node.getRightOperand().accept(this); final List<Expression> extendedOperands = node.extendedOperands(); if (extendedOperands.size() != 0) { this.fBuffer.append(' '); for (Iterator<Expression> it = extendedOperands.iterator(); it.hasNext();) { this.fBuffer.append(node.getOperator().toString()).append(' '); Expression e = it.next(); e.accept(this); }/*from w w w .j a va2 s .co m*/ } return false; }
From source file:boa.datagen.util.Java7Visitor.java
License:Apache License
@Override public boolean visit(InfixExpression node) { boa.types.Ast.Expression.Builder b = boa.types.Ast.Expression.newBuilder(); // b.setPosition(pos.build()); if (node.getOperator() == InfixExpression.Operator.AND) b.setKind(boa.types.Ast.Expression.ExpressionKind.BIT_AND); else if (node.getOperator() == InfixExpression.Operator.CONDITIONAL_AND) b.setKind(boa.types.Ast.Expression.ExpressionKind.LOGICAL_AND); else if (node.getOperator() == InfixExpression.Operator.CONDITIONAL_OR) b.setKind(boa.types.Ast.Expression.ExpressionKind.LOGICAL_OR); else if (node.getOperator() == InfixExpression.Operator.DIVIDE) b.setKind(boa.types.Ast.Expression.ExpressionKind.OP_DIV); else if (node.getOperator() == InfixExpression.Operator.EQUALS) b.setKind(boa.types.Ast.Expression.ExpressionKind.EQ); else if (node.getOperator() == InfixExpression.Operator.GREATER) b.setKind(boa.types.Ast.Expression.ExpressionKind.GT); else if (node.getOperator() == InfixExpression.Operator.GREATER_EQUALS) b.setKind(boa.types.Ast.Expression.ExpressionKind.GTEQ); else if (node.getOperator() == InfixExpression.Operator.LEFT_SHIFT) b.setKind(boa.types.Ast.Expression.ExpressionKind.BIT_LSHIFT); else if (node.getOperator() == InfixExpression.Operator.LESS) b.setKind(boa.types.Ast.Expression.ExpressionKind.LT); else if (node.getOperator() == InfixExpression.Operator.LESS_EQUALS) b.setKind(boa.types.Ast.Expression.ExpressionKind.LTEQ); else if (node.getOperator() == InfixExpression.Operator.MINUS) b.setKind(boa.types.Ast.Expression.ExpressionKind.OP_SUB); else if (node.getOperator() == InfixExpression.Operator.NOT_EQUALS) b.setKind(boa.types.Ast.Expression.ExpressionKind.NEQ); else if (node.getOperator() == InfixExpression.Operator.OR) b.setKind(boa.types.Ast.Expression.ExpressionKind.BIT_OR); else if (node.getOperator() == InfixExpression.Operator.PLUS) b.setKind(boa.types.Ast.Expression.ExpressionKind.OP_ADD); else if (node.getOperator() == InfixExpression.Operator.REMAINDER) b.setKind(boa.types.Ast.Expression.ExpressionKind.OP_MOD); else if (node.getOperator() == InfixExpression.Operator.RIGHT_SHIFT_SIGNED) b.setKind(boa.types.Ast.Expression.ExpressionKind.BIT_RSHIFT); else if (node.getOperator() == InfixExpression.Operator.RIGHT_SHIFT_UNSIGNED) b.setKind(boa.types.Ast.Expression.ExpressionKind.BIT_UNSIGNEDRSHIFT); else if (node.getOperator() == InfixExpression.Operator.TIMES) b.setKind(boa.types.Ast.Expression.ExpressionKind.OP_MULT); else if (node.getOperator() == InfixExpression.Operator.XOR) b.setKind(boa.types.Ast.Expression.ExpressionKind.BIT_XOR); node.getLeftOperand().accept(this); b.addExpressions(expressions.pop()); node.getRightOperand().accept(this); b.addExpressions(expressions.pop()); for (Object e : node.extendedOperands()) { ((org.eclipse.jdt.core.dom.Expression) e).accept(this); b.addExpressions(expressions.pop()); }// ww w . j a v a 2 s . c o m expressions.push(b.build()); return false; }
From source file:ca.mcgill.cs.swevo.ppa.inference.BinaryInferenceStrategy.java
License:Open Source License
private void processOperators(ASTNode node, TypeFact newFact) { InfixExpression infix = (InfixExpression) node; InfixExpression.Operator operator = infix.getOperator(); // if (node.toString().equals("falseTb == ShortBinding")) { // System.out.println(); // }/*from w ww . ja v a 2s .c o m*/ Expression left = infix.getLeftOperand(); Expression right = infix.getRightOperand(); boolean isSecondaryIndex = newFact != null && isSecondary(node, newFact); boolean isPrimaryIndex = newFact != null && !isSecondaryIndex; boolean leftSafe = !PPABindingsUtil.isUnknownType(left.resolveTypeBinding()) && (indexer.isSafe(left) || (isSecondaryIndex && isLeftIndex(node, newFact))); boolean rightSafe = !PPABindingsUtil.isUnknownType(right.resolveTypeBinding()) && (indexer.isSafe(right) || (isSecondaryIndex && !isLeftIndex(node, newFact))); boolean leftBoolean = isBoolean(left, leftSafe); boolean rightBoolean = isBoolean(right, rightSafe); ITypeBinding newType = null; ITypeBinding factType = newFact != null ? newFact.getNewType() : null; boolean isNewType = true; // && and || if (operator == InfixExpression.Operator.CONDITIONAL_AND || operator == InfixExpression.Operator.CONDITIONAL_OR) { if (!leftSafe) { ITypeBinding newBinding = ppaEngine.getRegistry().getPrimitiveBinding("boolean", left); ITypeBinding oldBinding = left.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(left), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); } if (!rightSafe) { ITypeBinding newBinding = ppaEngine.getRegistry().getPrimitiveBinding("boolean", right); ITypeBinding oldBinding = right.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(right), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); } } // & and | else if (operator == InfixExpression.Operator.AND || operator == InfixExpression.Operator.CONDITIONAL_OR || operator == InfixExpression.Operator.XOR) { if (leftBoolean && !rightSafe) { ITypeBinding newBinding = ppaEngine.getRegistry().getPrimitiveBinding("boolean", right); ITypeBinding oldBinding = right.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(right), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); newType = newBinding; } else if (rightBoolean && !leftSafe) { ITypeBinding newBinding = ppaEngine.getRegistry().getPrimitiveBinding("boolean", left); ITypeBinding oldBinding = left.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(left), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); newType = newBinding; } else if (leftSafe && !rightSafe) { ITypeBinding newBinding = left.resolveTypeBinding(); ITypeBinding oldBinding = right.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(right), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); newType = newBinding; } else if (rightSafe && !leftSafe) { ITypeBinding newBinding = right.resolveTypeBinding(); ITypeBinding oldBinding = left.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(left), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); newType = newBinding; } else if (!rightSafe && !leftSafe && isPrimaryIndex) { ITypeBinding newBinding = factType; ITypeBinding oldBinding = left.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(left), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); newBinding = factType; oldBinding = right.resolveTypeBinding(); typeFact = new TypeFact(indexer.getMainIndex(right), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); newType = newBinding; } } // << >> >>> else if (operator == InfixExpression.Operator.LEFT_SHIFT || operator == InfixExpression.Operator.RIGHT_SHIFT_SIGNED || operator == InfixExpression.Operator.RIGHT_SHIFT_UNSIGNED) { if (!leftSafe) { ITypeBinding newBinding = ppaEngine.getRegistry().getPrimitiveBinding("int", left); ITypeBinding oldBinding = left.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(left), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); } if (!rightSafe) { ITypeBinding newBinding = ppaEngine.getRegistry().getPrimitiveBinding("int", right); ITypeBinding oldBinding = right.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(right), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); newType = newBinding; } } // - / * % < <= > >= else if (operator == InfixExpression.Operator.MINUS || operator == InfixExpression.Operator.DIVIDE || operator == InfixExpression.Operator.REMAINDER || operator == InfixExpression.Operator.TIMES || operator == InfixExpression.Operator.LESS || operator == InfixExpression.Operator.LESS_EQUALS || operator == InfixExpression.Operator.GREATER || operator == InfixExpression.Operator.GREATER_EQUALS) { if (leftSafe && !rightSafe) { ITypeBinding newBinding = left.resolveTypeBinding(); ITypeBinding oldBinding = right.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(right), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); newType = newBinding; } else if (rightSafe && !leftSafe) { ITypeBinding newBinding = right.resolveTypeBinding(); ITypeBinding oldBinding = left.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(left), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); newType = newBinding; } else if (!rightSafe && !leftSafe && !isPrimaryIndex) { ITypeBinding newBinding = ppaEngine.getRegistry().getPrimitiveBinding("int", left); ITypeBinding oldBinding = left.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(left), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); newBinding = ppaEngine.getRegistry().getPrimitiveBinding("int", right); oldBinding = right.resolveTypeBinding(); typeFact = new TypeFact(indexer.getMainIndex(right), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); newType = newBinding; } else if (!rightSafe && !leftSafe && isPrimaryIndex) { ITypeBinding newBinding = factType; ITypeBinding oldBinding = left.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(left), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); newBinding = factType; oldBinding = right.resolveTypeBinding(); typeFact = new TypeFact(indexer.getMainIndex(right), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); newType = newBinding; } } // == != else if (operator == InfixExpression.Operator.EQUALS || operator == InfixExpression.Operator.NOT_EQUALS) { if (leftSafe && !rightSafe) { ITypeBinding newBinding = left.resolveTypeBinding(); ITypeBinding oldBinding = right.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(right), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); } else if (rightSafe && !leftSafe) { ITypeBinding newBinding = right.resolveTypeBinding(); ITypeBinding oldBinding = left.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(left), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); } } // + else if (operator == InfixExpression.Operator.PLUS) { if (isPrimaryIndex && !factType.isPrimitive()) { ITypeBinding newBinding = factType; if (!leftSafe) { ITypeBinding oldBinding = left.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(left), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); } if (!rightSafe) { newBinding = factType; ITypeBinding oldBinding = right.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(right), oldBinding, TypeFact.UNKNOWN, newBinding, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); isNewType = isNewType && ppaEngine.reportTypeFact(typeFact); } newType = newBinding; } } if (newType != null && !isPrimaryIndex && isNewType) { ITypeBinding oldBinding = infix.resolveTypeBinding(); TypeFact typeFact = new TypeFact(indexer.getMainIndex(node), oldBinding, TypeFact.UNKNOWN, newType, TypeFact.SUBTYPE, TypeFact.BINARY_STRATEGY); ppaEngine.reportTypeFact(typeFact); // report new type for this expression. // fix this expression. } else if (isPrimaryIndex) { if (newType != null && isNewType) { ppaEngine.getRegistry().fixBinary(node, newType); } else if (factType != null) { ppaEngine.getRegistry().fixBinary(node, factType); } } }
From source file:ch.acanda.eclipse.pmd.java.resolution.design.UseCollectionIsEmptyQuickFix.java
License:Open Source License
/** * {@code c.size() != 0} and {@code c.size() >= 0} should be converted into {@code !c.isEmpty()}. *//*from w w w. j av a2s . c o m*/ private boolean isNotEmpty(final InfixExpression node) { return Operator.NOT_EQUALS.equals(node.getOperator()) || Operator.GREATER.equals(node.getOperator()); }
From source file:coloredide.utils.CopiedNaiveASTFlattener.java
License:Open Source License
public boolean visit(InfixExpression node) { node.getLeftOperand().accept(this); this.buffer.append(' '); // for cases like x= i - -1; or x= i++ + // ++i;//w ww.ja v a 2 s .c o m this.buffer.append(node.getOperator().toString()); this.buffer.append(' '); node.getRightOperand().accept(this); final List extendedOperands = node.extendedOperands(); if (extendedOperands.size() != 0) { this.buffer.append(' '); for (Iterator it = extendedOperands.iterator(); it.hasNext();) { this.buffer.append(node.getOperator().toString()).append(' '); Expression e = (Expression) it.next(); e.accept(this); } } return false; }
From source file:com.bsiag.eclipse.jdt.java.formatter.linewrap.WrapPreparator.java
License:Open Source License
@Override public boolean visit(InfixExpression node) { Integer operatorPrecedence = OPERATOR_PRECEDENCE.get(node.getOperator()); if (operatorPrecedence == null) return true; ASTNode parent = node.getParent();//from w ww. j a v a2s.c o m if ((parent instanceof InfixExpression) && samePrecedence(node, (InfixExpression) parent)) return true; // this node has been handled higher in the AST findTokensToWrap(node, 0); this.wrapParentIndex = this.wrapIndexes.remove(0); this.wrapGroupEnd = this.tm.lastIndexIn(node, -1); if ((this.options.alignment_for_binary_expression & Alignment.M_INDENT_ON_COLUMN) != 0 && this.wrapParentIndex > 0) this.wrapParentIndex--; for (int i = this.wrapParentIndex; i >= 0; i--) { if (!this.tm.get(i).isComment()) { this.wrapParentIndex = i; break; } } handleWrap(this.options.alignment_for_binary_expression, node); return true; }
From source file:com.bsiag.eclipse.jdt.java.formatter.linewrap.WrapPreparator.java
License:Open Source License
private void findTokensToWrap(InfixExpression node, int depth) { Expression left = node.getLeftOperand(); if (left instanceof InfixExpression && samePrecedence(node, (InfixExpression) left)) { findTokensToWrap((InfixExpression) left, depth + 1); } else if (this.wrapIndexes.isEmpty() // always add first operand, it will be taken as wrap parent || !this.options.wrap_before_binary_operator) { this.wrapIndexes.add(this.tm.firstIndexIn(left, -1)); }// w w w .j a va 2 s. co m Expression right = node.getRightOperand(); List<Expression> extended = node.extendedOperands(); for (int i = -1; i < extended.size(); i++) { Expression operand = (i == -1) ? right : extended.get(i); if (operand instanceof InfixExpression && samePrecedence(node, (InfixExpression) operand)) { findTokensToWrap((InfixExpression) operand, depth + 1); } int indexBefore = this.tm.firstIndexBefore(operand, -1); while (this.tm.get(indexBefore).isComment()) indexBefore--; assert node.getOperator().toString().equals(this.tm.toString(indexBefore)); int indexAfter = this.tm.firstIndexIn(operand, -1); this.wrapIndexes.add(this.options.wrap_before_binary_operator ? indexBefore : indexAfter); if (!this.options.join_wrapped_lines) { // TODO there should be an option for never joining wraps on opposite side of the operator if (this.options.wrap_before_binary_operator) { if (this.tm.countLineBreaksBetween(this.tm.get(indexAfter - 1), this.tm.get(indexAfter)) > 0) this.wrapIndexes.add(indexAfter); } else { if (this.tm.countLineBreaksBetween(this.tm.get(indexBefore), this.tm.get(indexBefore - 1)) > 0) this.wrapIndexes.add(indexBefore); } } } }
From source file:com.bsiag.eclipse.jdt.java.formatter.linewrap.WrapPreparator.java
License:Open Source License
private boolean samePrecedence(InfixExpression expression1, InfixExpression expression2) { Integer precedence1 = OPERATOR_PRECEDENCE.get(expression1.getOperator()); Integer precedence2 = OPERATOR_PRECEDENCE.get(expression2.getOperator()); if (precedence1 == null || precedence2 == null) return false; return precedence1.equals(precedence2); }
From source file:com.bsiag.eclipse.jdt.java.formatter.SpacePreparator.java
License:Open Source License
@Override public boolean visit(InfixExpression node) { String operator = node.getOperator().toString(); handleOperator(operator, node.getRightOperand(), this.options.insert_space_before_binary_operator, this.options.insert_space_after_binary_operator); List<Expression> extendedOperands = node.extendedOperands(); for (Expression operand : extendedOperands) { handleOperator(operator, operand, this.options.insert_space_before_binary_operator, this.options.insert_space_after_binary_operator); }//from www .j ava 2s . co m return true; }
From source file:com.google.dart.java2dart.SyntaxTranslator.java
License:Open Source License
@Override public boolean visit(org.eclipse.jdt.core.dom.InfixExpression node) { Expression left = translate(node.getLeftOperand()); Expression right = translate(node.getRightOperand()); // operator// ww w . j ava2 s. c om TokenType tokenType = null; org.eclipse.jdt.core.dom.InfixExpression.Operator javaOperator = node.getOperator(); if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.PLUS) { tokenType = TokenType.PLUS; } if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.MINUS) { tokenType = TokenType.MINUS; } if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.TIMES) { tokenType = TokenType.STAR; } if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.DIVIDE) { if (isIntegerType(node.getLeftOperand()) && isIntegerType(node.getRightOperand())) { tokenType = TokenType.TILDE_SLASH; } else { tokenType = TokenType.SLASH; } } if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.REMAINDER) { tokenType = TokenType.PERCENT; } if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.LEFT_SHIFT) { tokenType = TokenType.LT_LT; } if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.RIGHT_SHIFT_SIGNED || javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.RIGHT_SHIFT_UNSIGNED) { tokenType = TokenType.GT_GT; } if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.CONDITIONAL_OR) { tokenType = TokenType.BAR_BAR; } if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.CONDITIONAL_AND) { tokenType = TokenType.AMPERSAND_AMPERSAND; } if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.XOR) { tokenType = TokenType.CARET; } if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.OR) { tokenType = TokenType.BAR; } if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.AND) { tokenType = TokenType.AMPERSAND; } if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.LESS) { tokenType = TokenType.LT; } if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.GREATER) { tokenType = TokenType.GT; } if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.LESS_EQUALS) { tokenType = TokenType.LT_EQ; } if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.GREATER_EQUALS) { tokenType = TokenType.GT_EQ; } if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.EQUALS) { if (isNumberOrNull(left) || isNumberOrNull(right)) { tokenType = TokenType.EQ_EQ; } else { return done(methodInvocation("identical", left, right)); } } if (javaOperator == org.eclipse.jdt.core.dom.InfixExpression.Operator.NOT_EQUALS) { tokenType = TokenType.BANG_EQ; } Assert.isNotNull(tokenType, "No token for: " + javaOperator); // create BinaryExpression BinaryExpression binary = binaryExpression(left, tokenType, right); for (Object javaOperand : node.extendedOperands()) { Expression operand = translate((org.eclipse.jdt.core.dom.ASTNode) javaOperand); binary = binaryExpression(binary, tokenType, operand); } return done(binary); }