when manually loading an autoloaded class,
authorClaus Gittinger <cg@exept.de>
Mon, 20 Sep 1999 13:53:25 +0200
changeset 4774 963f2e5d1f24
parent 4773 88b293276380
child 4775 4c96f1d40626
when manually loading an autoloaded class, let the autoloadStub become the new class.
Metaclass.st
--- a/Metaclass.st	Mon Sep 20 09:57:36 1999 +0200
+++ b/Metaclass.st	Mon Sep 20 13:53:25 1999 +0200
@@ -551,7 +551,8 @@
      pkg oldPkg idx spec nClassInstVars 
      realNewName thisIsPrivate oldCIVNames newCIVNames nsName namespace
      oldSuperClass newSuperClass oldCategory
-     recompileGlobalAccessTo stringOfClassInstVarNames answer|
+     recompileGlobalAccessTo stringOfClassInstVarNames answer
+     oldClassToBecomeNew|
 
     "NOTICE:
      this method is too complex and should be splitted into managable pieces ...
@@ -664,6 +665,10 @@
         ]
     ].
 
+    (oldClass isBehavior and:[oldClass isLoaded not]) ifTrue:[
+        oldClassToBecomeNew := oldClass
+    ].
+
     (oldClass isBehavior and:[oldClass isLoaded]) ifFalse:[
         oldClass := nil.
 
@@ -976,6 +981,14 @@
             Behavior flushSubclassInfo.
         ].
 
+        oldClassToBecomeNew notNil ifTrue:[
+            "/ old was an autoloaded class - make it the new one
+            "/ and flush ...
+            oldClassToBecomeNew class becomeSameAs:newClass class.
+            oldClassToBecomeNew becomeSameAs:newClass.
+            ObjectMemory flushCaches.
+        ].
+
         namespace notNil ifTrue:[
             thisIsPrivate ifTrue:[
                 namespace changed.
@@ -2044,6 +2057,6 @@
 !Metaclass class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Metaclass.st,v 1.154 1999-09-17 13:27:40 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Metaclass.st,v 1.155 1999-09-20 11:53:25 cg Exp $'
 ! !
 Metaclass initialize!