### Question:
ExpressionEvaluationErrorHandler implements IExpressionEvaluatorErrorCallback { public Expression fixNegativeOperand(Expression originalExpression, ExpressionEvaluator.ComputedValues values) throws Exception { Expression newExpression; if (values.values.size() > 1) { Expression negatedOriginalExpression = new Expression(ASTUnaryOperation.Operator.OP_MINUS, originalExpression); Expression conditionExpression = new Expression(originalExpression, OP_LT, new Expression(ValueContainer.getSmallIntegerValue(originalExpression.getType(), 0))); newExpression = new Expression(conditionExpression, negatedOriginalExpression, originalExpression); } else { IntegerValue value = (IntegerValue)values.values.get(0); if (((ASTElementaryTypeName)value.getType()).isSigned() && value.isEqualTo(value.getMinValue()).getValue()) { newExpression = new Expression(originalExpression, OP_PLUS, new Expression(new IntegerValue(value.getType(), 1))); } else { newExpression = originalExpression; } newExpression = new Expression(ASTUnaryOperation.Operator.OP_MINUS, newExpression); } return newExpression; } ExpressionEvaluationErrorHandler(RandomNumbers prng); Expression fixZeroDivision(ExpressionEvaluator expressionEvaluator,
                                      VariableEnvironment environment,
                                      Expression originalExpression,
                                      ExpressionEvaluator.ComputedValues values); Expression fixNegativeOperand(Expression originalExpression,
                                        ExpressionEvaluator.ComputedValues values);  }### Answer:
@Test public void testFixNegativeOperand() throws Exception { VariableEnvironment environment = new VariableEnvironment(null, true); e_environment = environment; ASTNode v1Type = TypeContainer.getIntegerType(true, 32); Variable varV1 = createVariable(v1Type, "v1"); VariableValues varV1Values = new VariableValues(varV1, 0); varV1Values.addValue(new IntegerValue(v1Type, -3)); environment.addVariableValues(varV1, varV1Values); environment.finishAddingValues(); RandomNumbers prng = new RandomNumbers(1); ExpressionEvaluator expressionEvaluator = new ExpressionEvaluator(new ExpressionEvaluationErrorHandler(prng)); e_expressionEvaluator = expressionEvaluator; Expression faultyExpression = new Expression( new Expression(ValueContainer.getSmallIntegerValue(v1Type, 1)), ASTBinaryOperation.Operator.OP_BSHL, new Expression(ASTUnaryOperation.Operator.OP_INC_PRE, new Expression(varV1))); String originalExpressionCode = faultyExpression.toASTNode().toSolidityCode(); String result = e(faultyExpression); System.out.println("got " + originalExpressionCode + " fixed to " + faultyExpression.toASTNode().toSolidityCode() + " = " + result); Assert.assertTrue(result.equals("int32(4)") || result.equals("4")); }