in java/fury-core/src/main/java/org/apache/fury/codegen/Expression.java [1698:1735]
public If(Expression predicate, Expression trueExpr, Expression falseExpr) {
super(new Expression[] {predicate, trueExpr, falseExpr});
this.predicate = predicate;
this.trueExpr = trueExpr;
this.falseExpr = falseExpr;
if (ExpressionUtils.isReturn(trueExpr) && ExpressionUtils.isReturn(falseExpr)) {
type = PRIMITIVE_VOID_TYPE;
}
if (trueExpr.type() == falseExpr.type()) {
if (trueExpr.type() != null && !PRIMITIVE_VOID_TYPE.equals(trueExpr.type())) {
type = trueExpr.type();
} else {
type = PRIMITIVE_VOID_TYPE;
}
} else {
if (trueExpr.type() != null && falseExpr.type() != null) {
if (TypeUtils.isBoxed(getRawType(trueExpr.type()))
&& trueExpr.type().equals(falseExpr.type().wrap())) {
type = trueExpr.type();
} else if (TypeUtils.isBoxed(getRawType(falseExpr.type()))
&& falseExpr.type().equals(trueExpr.type().wrap())) {
type = falseExpr.type();
} else if (trueExpr.type().isSupertypeOf(falseExpr.type())) {
type = trueExpr.type();
} else if (falseExpr.type().isSupertypeOf(trueExpr.type())) {
type = falseExpr.type();
} else if (PRIMITIVE_VOID_TYPE.equals(trueExpr.type())
|| PRIMITIVE_VOID_TYPE.equals(falseExpr.type())) {
type = PRIMITIVE_VOID_TYPE;
} else {
type = OBJECT_TYPE;
}
} else {
type = PRIMITIVE_VOID_TYPE;
}
}
nullable = !PRIMITIVE_VOID_TYPE.equals(type) && !type.isPrimitive();
}