TypeUtilities.isBoolean(leftResult.getType()) ^ TypeUtilities.isBoolean(rightResult.getType())) {
if (TypeUtilities.isBoolean(leftResult.getType()) &&
TypeUtilities.isArithmetic(rightResult.getType())) {
final TypeReference comparandType = MetadataHelper.getUnderlyingPrimitiveTypeOrSelf(rightResult.getType());
if (TRUE_NODE.matches(left)) {
((PrimitiveExpression) left).setValue(JavaPrimitiveCast.cast(comparandType.getSimpleType(), 1));
}
else if (FALSE_NODE.matches(left)) {
((PrimitiveExpression) left).setValue(JavaPrimitiveCast.cast(comparandType.getSimpleType(), 0));
}
else {
convertBooleanToNumeric(left);
}
}
else if (TypeUtilities.isArithmetic(leftResult.getType())) {
final TypeReference comparandType = MetadataHelper.getUnderlyingPrimitiveTypeOrSelf(leftResult.getType());
if (TRUE_NODE.matches(right)) {
((PrimitiveExpression) right).setValue(JavaPrimitiveCast.cast(comparandType.getSimpleType(), 1));
}
else if (FALSE_NODE.matches(right)) {
((PrimitiveExpression) right).setValue(JavaPrimitiveCast.cast(comparandType.getSimpleType(), 0));
}
else {
convertBooleanToNumeric(right);
}
}
}
else {
final TypeReference expectedType = TypeUtilities.getExpectedTypeByParent(_resolver, node);
if (expectedType != null && TypeUtilities.isBoolean(expectedType)) {
final ResolveResult result = _resolver.apply(node);
if (result != null &&