static JavaExpression boxExpression (TypeExpr boxType, JavaExpression e) throws CodeGenerationException {
if (boxType == null || e == null) {
throw new CodeGenerationException ("Attempt to box null type. ");
}
TypeConsApp typeConsApp = boxType.rootTypeConsApp();
if (typeConsApp != null) {
if (typeConsApp.isNonParametricType(CAL_Prelude.TypeConstructors.Boolean)) {
return boxExpression (JavaTypeName.BOOLEAN, e);
}
if (typeConsApp.getForeignTypeInfo() != null) {
return boxExpression (JavaTypeName.make(SCJavaDefn.getForeignType(typeConsApp.getForeignTypeInfo())), e);
}
if (LECCMachineConfiguration.TREAT_ENUMS_AS_INTS) {
if (SCJavaDefn.isEnumDataType (typeConsApp)) {
return boxExpression (JavaTypeName.INT, e);