@Override public ConstantValue visitConditional(Conditional expr, Void arg) { final ConstantValue conditionValue = expr.getCondition().accept(this, null); final ConstantType resultConstantType = typeFactory.newConstantType(expr.getType().get()); final ConstantValue resultValue; if (conditionValue.logicalValue()) { resultValue = expr.getOnTrueExp().isPresent() ? expr.getOnTrueExp().get().accept(this, null) : conditionValue; } else { resultValue = expr.getOnFalseExp().accept(this, null); } return resultValue.castTo(resultConstantType); }