public static Stella_Object applyCoercionMethod(Stella_Object expression, Surrogate sourcetype, Surrogate targettype, Stella_Object coercionmethod, Object [] MV_returnarray) {
    if (coercionmethod == null) {
      coercionmethod = Surrogate.lookupCoersionMethod(sourcetype, targettype, expression);
    }
    if (coercionmethod == null) {
      { Stella_Object _return_temp = expression;

        MV_returnarray[0] = sourcetype;
        return (_return_temp);
      }
    }
    if (coercionmethod == Stella.SYM_STELLA_IDENTITY) {
      { Stella_Object _return_temp = expression;

        MV_returnarray[0] = targettype;
        return (_return_temp);
      }
    }
    { Surrogate testValue000 = Stella_Object.safePrimaryType(coercionmethod);

      if (Surrogate.subtypeOfSymbolP(testValue000)) {
        { Symbol coercionmethod000 = ((Symbol)(coercionmethod));

          return (Stella_Object.walkExpressionTree(Cons.cons(coercionmethod000, Cons.cons(expression, Stella.NIL)), targettype, coercionmethod000, false, MV_returnarray));
        }
      }
      else if (testValue000 == Stella.SGT_STELLA_CONS) {
        { Cons coercionmethod000 = ((Cons)(coercionmethod));

          return (Stella_Object.walkExpressionTree(Stella_Object.copyConsTree(Stella_Object.substituteConsTree(((Cons)(Stella_Object.copyConsTree(coercionmethod000))), expression, Stella.SYM_STELLA_lXg)), targettype, ((Symbol)(coercionmethod000.value)), false, MV_returnarray));
        }
      }
      else {
        { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

          stream000.nativeStream.print("`" + testValue000 + "' is not a valid case option");
          throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
        }
      }
    }
  }