Object leftObject = ((CtLiteral<?>) left).getValue(); Object rightObject = ((CtLiteral<?>) right).getValue(); CtLiteral<Object> res = operator.getFactory().Core().createLiteral(); switch (operator.getKind()) { case AND: CtLiteral<Object> res = operator.getFactory().Core().createLiteral(); switch (operator.getKind()) { case AND:
operator.setPosition(operator.getFactory().Core().createSourcePosition( oldPos.getCompilationUnit(), oldPos.getSourceStart(), childEnd, return; } else if (jdtTreeBuilder.getContextBuilder().stack.peek().node instanceof StringLiteralConcatenation) { CtBinaryOperator<?> op = operator.getFactory().Core().createBinaryOperator(); op.setKind(BinaryOperatorKind.PLUS); op.setLeftHandOperand(operator.getRightHandOperand()); SourcePosition leftPosition = op.getLeftHandOperand().getPosition(); SourcePosition rightPosition = op.getRightHandOperand().getPosition(); op.setPosition(op.getFactory().createSourcePosition(leftPosition.getCompilationUnit(), leftPosition.getSourceStart(), rightPosition.getSourceEnd(), lineSeparatorPositions)); return;
public <T> void visitCtBinaryOperator(final spoon.reflect.code.CtBinaryOperator<T> operator) { spoon.reflect.code.CtBinaryOperator<T> aCtBinaryOperator = operator.getFactory().Core().createBinaryOperator(); this.builder.copy(operator, aCtBinaryOperator); aCtBinaryOperator.setAnnotations(this.cloneHelper.clone(operator.getAnnotations())); aCtBinaryOperator.setType(this.cloneHelper.clone(operator.getType())); aCtBinaryOperator.setTypeCasts(this.cloneHelper.clone(operator.getTypeCasts())); aCtBinaryOperator.setLeftHandOperand(this.cloneHelper.clone(operator.getLeftHandOperand())); aCtBinaryOperator.setRightHandOperand(this.cloneHelper.clone(operator.getRightHandOperand())); aCtBinaryOperator.setComments(this.cloneHelper.clone(operator.getComments())); this.cloneHelper.tailor(operator, aCtBinaryOperator); this.other = aCtBinaryOperator; }
static CtLiteral<?> concatString(CtBinaryOperator<?> binaryOperator) { return binaryOperator.getFactory().createLiteral( ((String) ((CtLiteral) binaryOperator.getLeftHandOperand()).getValue()) + ((String) ((CtLiteral) binaryOperator.getRightHandOperand()).getValue()) ); } }
Object leftObject = ((CtLiteral<?>) left).getValue(); Object rightObject = ((CtLiteral<?>) right).getValue(); CtLiteral<Object> res = operator.getFactory().Core().createLiteral(); switch (operator.getKind()) { case AND: return; } else if (operator.getKind() == BinaryOperatorKind.INSTANCEOF) { CtLiteral<Boolean> res = operator.getFactory().Core().createLiteral(); CtTypeReference<?> leftType = ((CtTypedElement<?>) left).getType().box(); CtTypeReference<?> rightType = ((CtLiteral<CtTypeReference<?>>) right).getValue(); CtLiteral<Object> res = operator.getFactory().Core().createLiteral(); switch (operator.getKind()) { case AND: CtBinaryOperator<T> op = operator.getFactory().Core().createBinaryOperator(); op.setKind(operator.getKind()); op.setLeftHandOperand(left);