diff -r 11d015697e44 -r 28ecd3e2d8c9 Collection.st --- a/Collection.st Thu Feb 23 12:50:27 2012 +0100 +++ b/Collection.st Mon Feb 27 20:44:04 2012 +0100 @@ -2945,6 +2945,32 @@ "Modified: / 30.10.1997 / 15:52:18 / cg" ! +noModificationError + "a store is attempted into an immutable collection (typically: a literal). + For our convenience, find the method that contains me, for a nicer error message" + + |creator msg context| + + creator := Method allSubInstances detect:[:aMethod | (aMethod referencesGlobal:self)] ifNone:nil. + creator notNil ifTrue:[ + msg := ' (' , creator whoString , ')' + ]. + context := thisContext sender. + " + this error is reported on an attempt to store into an immutable collection (typically: a literal). + The literal was created in creator. + If you press continue in the debugger, the store will be performed. + If you don't want this, press abort and check your code. + Storing into literals is VERY VERY bad coding style. + " + NoModificationError + raiseRequestWith:self + errorString:msg + in:context. + + "Created: / 03-08-1998 / 14:47:45 / cg" +! + notEnoughElementsError "report an error that the operation is not allowed, since not enough elements are in the collection" @@ -4182,11 +4208,11 @@ !Collection class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.270 2011-12-21 14:59:45 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.271 2012-02-27 19:44:04 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.270 2011-12-21 14:59:45 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.271 2012-02-27 19:44:04 cg Exp $' ! ! Collection initialize!