public static void undefineOldClass(Stella_Class oldclass, Stella_Class newclass) {
    { Cons newsubs = Cons.copyConsList(newclass.classDirectSubs.theConsList);

      Stella_Class.unfinalizeClassAndSubclasses(oldclass);
      Stella_Class.forgetUnfinalizedClass(oldclass);
      { Surrogate oldsub = null;
        Cons iter000 = oldclass.classDirectSubs.theConsList;
        Cons collect000 = null;

        for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
          oldsub = ((Surrogate)(iter000.value));
          if (collect000 == null) {
            {
              collect000 = Cons.cons(oldsub, Stella.NIL);
              if (newsubs == Stella.NIL) {
                newsubs = collect000;
              }
              else {
                Cons.addConsToEndOfConsList(newsubs, collect000);
              }
            }
          }
          else {
            {
              collect000.rest = Cons.cons(oldsub, Stella.NIL);
              collect000 = collect000.rest;
            }
          }
        }
      }
      newclass.classDirectSubs.clear();
      newclass.classDirectSubs.theConsList = newsubs.removeDuplicates();
      oldclass.classDirectSubs.clear();
    }
    { TaxonomyNode taxonomynode = oldclass.classTaxonomyNode;

      { Surrogate renamed_Super = null;
        Cons iter001 = oldclass.classDirectSupers.theConsList;

        for (;!(iter001 == Stella.NIL); iter001 = iter001.rest) {
          renamed_Super = ((Surrogate)(iter001.value));
          if ((((Stella_Class)(renamed_Super.surrogateValue)) != null) &&
              (!newclass.classDirectSupers.memberP(renamed_Super))) {
            TaxonomyGraph.unlinkTaxonomyNodes(Stella.$CLASS_TAXONOMY_GRAPH$, ((Stella_Class)(renamed_Super.surrogateValue)).classTaxonomyNode, taxonomynode);
          }
        }
      }
      newclass.classTaxonomyNode = taxonomynode;
      oldclass.classTaxonomyNode = null;
    }
    { Slot oldslot = null;
      Cons iter002 = oldclass.classLocalSlots.theConsList;

      for (;!(iter002 == Stella.NIL); iter002 = iter002.rest) {
        oldslot = ((Slot)(iter002.value));
        if (oldslot.slotExternalP) {
          Slot.transferExternalSlotToNewClass(oldslot, newclass);
        }
      }
    }
    newclass.classConstructorCode = oldclass.classConstructorCode;
    Stella_Class.transferDemonsFromOldclass(oldclass, newclass);
    HookList.runHooks(Stella.$REDEFINE_RELATION_HOOKS$, List.list(Cons.cons(oldclass, Cons.cons(newclass, Stella.NIL))));
    oldclass.free();
  }