ClassDescription.st
changeset 3596 d19a2f605da3
parent 3583 5b0111ca8692
child 3603 ba736c503cb9
--- a/ClassDescription.st	Wed Jun 17 09:32:17 1998 +0200
+++ b/ClassDescription.st	Wed Jun 17 11:42:17 1998 +0200
@@ -14,6 +14,7 @@
 	instanceVariableNames:'instvars'
 	classVariableNames:'UpdatingChanges LockChangesFile FileOutErrorSignal
 		CatchMethodRedefinitions MethodRedefinitionSignal
+		CatchClassRedefinitions ClassRedefinitionSignal
 		UpdateChangeFileQuerySignal TryLocalSourceFirst
 		ChangeFileAccessLock NameSpaceQuerySignal PackageQuerySignal
 		UsedNameSpaceQuerySignal CreateNameSpaceQuerySignal
@@ -133,6 +134,11 @@
         MethodRedefinitionSignal notifierString:'attempt to redefine method from different package'.
         MethodRedefinitionSignal defaultAnswer:#keep.
 
+        ClassRedefinitionSignal := QuerySignal new.
+        ClassRedefinitionSignal nameClass:self message:#classRedefinitionSignal.
+        ClassRedefinitionSignal notifierString:'attempt to redefine class from different package'.
+        ClassRedefinitionSignal defaultAnswer:#keep.
+
         UpdateChangeFileQuerySignal := QuerySignal new.
         UpdateChangeFileQuerySignal nameClass:self message:#updateChangeFileQuerySignal.
         UpdateChangeFileQuerySignal notifierString:'asking if changeFile update is wanted'.
@@ -183,7 +189,7 @@
     "
 
     "Created: / 2.4.1997 / 17:27:40 / stefan"
-    "Modified: / 15.6.1998 / 21:38:44 / cg"
+    "Modified: / 17.6.1998 / 10:12:31 / cg"
 ! !
 
 !ClassDescription class methodsFor:'Signal constants'!
@@ -203,6 +209,18 @@
     "Created: / 15.6.1998 / 18:29:57 / cg"
 !
 
+classRedefinitionSignal
+    "return the signal raised when a class is about to be redefined
+     differently from an existing class and the packages are not
+     equal. This helps when filing in alien code, to prevent existing
+     classes from being redefined by incompatible classes
+     (classVars, classInstVars or inheritance)."
+
+    ^ ClassRedefinitionSignal
+
+    "Created: / 17.6.1998 / 10:13:44 / cg"
+!
+
 createNameSpaceQuerySignal
     "return the signal used as an upQuery if a new nameSpace should be
      silently created without user confirmation.
@@ -313,20 +331,52 @@
 
 !ClassDescription class methodsFor:'accessing - flags'!
 
+catchClassRedefinitions
+    "return the class-redefinition catching flag."
+
+    ^ CatchClassRedefinitions
+
+    "Created: / 17.6.1998 / 10:30:01 / cg"
+!
+
+catchClassRedefinitions:aBoolean
+    "turn on/off class redefinition catching. 
+     If on, redefining classes from another package will show a
+     warning dialog. Useful, when filing in alien code to avoid defefinition
+     of system methods.
+     Return the prior value of the flag."
+
+    |prev|
+
+    prev := CatchClassRedefinitions.
+    CatchClassRedefinitions := aBoolean.
+    ^ prev
+
+    "Created: / 17.6.1998 / 10:31:19 / cg"
+!
+
 catchMethodRedefinitions
-    "return the redefinition catching flag."
+    "return the method-redefinition catching flag."
 
     ^ CatchMethodRedefinitions
+
+    "Modified: / 17.6.1998 / 10:30:10 / cg"
 !
 
 catchMethodRedefinitions:aBoolean
-    "turn on/off redefinition catching. Return the prior value of the flag."
+    "turn on/off method redefinition catching. 
+     If on, redefining methods from another package will show a
+     warning dialog. Useful, when filing in alien code to avoid defefinition
+     of system methods.
+     Return the prior value of the flag."
 
     |prev|
 
     prev := CatchMethodRedefinitions.
     CatchMethodRedefinitions := aBoolean.
     ^ prev
+
+    "Modified: / 17.6.1998 / 10:31:02 / cg"
 !
 
 lockChangesFile
@@ -662,9 +712,9 @@
                  to false.
                  (also found in the Launchers 'settings-compilation' menu)
                 "
-                (MethodRedefinitionSignal
+                (Class methodRedefinitionSignal
                     raiseRequestWith:(oldMethod -> newMethod)
-                    errorString:('redefinition of systemCode: ' , self name , '>>' , newSelector) 
+                    errorString:('redefinition of method: ' , self name , '>>' , newSelector) 
                 ) == #keep ifTrue:[
                     newMethod package:oldMethod package
                 ].
@@ -700,7 +750,7 @@
 
     "Modified: / 9.9.1996 / 22:39:32 / stefan"
     "Created: / 4.6.1997 / 14:47:10 / cg"
-    "Modified: / 29.10.1997 / 15:48:25 / cg"
+    "Modified: / 17.6.1998 / 10:41:34 / cg"
 !
 
 basicAddSelector:newSelector withMethod:newMethod
@@ -2946,6 +2996,6 @@
 !ClassDescription class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ClassDescription.st,v 1.69 1998-06-15 19:39:03 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ClassDescription.st,v 1.70 1998-06-17 09:42:17 cg Exp $'
 ! !
 ClassDescription initialize!