<div dir="ltr"><div>I'm moving this to trunk now because I've just noticed a painful side-effect of this bug [1]. After renaming a class, the ClassBindings in the methods of the renamed class will be corrupted. Know that if you try to save the package with the renamed class, Monticello will \silently exclude/ methods of the renamed class (because MC will only save methods with #isLocalSelector).</div><div><br></div><div>I didn't realize that until I found myself in my newly-built image with several methods missing from my MC package. Thankfully I still had the old image to develop and run this script [2] to identify and replace the incorrect ClassBindings in the CM's of the Class which was renamed.</div><div><br></div><div>If anyone else has used rename on the class menu, I hope this script will help you fix your image. If you had already saved a package after a class rename, be sure to select "check all packages for changes" from the MC working copy menu after running the script.</div><div><br></div><div> - Chris</div><div><br></div><div>[1] -- We have two bugs. "this bug" refers to the one fixed here in #renameClass:from:to:. The other one is the invalid super pointer and still unfixed. That problem is easy to reproduce by that script in my original email ("invalid super pointer"), and we really could use a CM-structure / Bytecode expert to take a look, as it is also a pretty nasty bug. Thanks!</div><div><br></div><div>[2]</div><div><br></div><div><div> | notAtHome |</div><div> notAtHome := Array streamContents:</div><div> [ : stream |</div><div> Smalltalk allClasses do:</div><div> [ : eachClass |</div><div> eachClass methodDictionary valuesDo:</div><div> [ : eachCm | eachCm methodHome = eachClass ifFalse: [ stream nextPut: eachCm -> eachClass ]]] ].</div><div> notAtHome ifNotEmpty: [ Warning signal: 'The following methods were found to have a methodHome that was not their containing Class. They will be rehomed.</div><div><br></div><div> ', (notAtHome) ].</div><div> notAtHome do:</div><div> [ : eachCmAndCorrectHome |</div><div> eachCmAndCorrectHome key </div><div> literalAt: eachCmAndCorrectHome key numLiterals </div><div> put: (Smalltalk environment bindingOf: eachCmAndCorrectHome value name) ]</div></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jan 18, 2015 at 5:44 PM, <span dir="ltr"><<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Chris Muller uploaded a new version of Environments to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/Environments-cmm.53.mcz" target="_blank">http://source.squeak.org/trunk/Environments-cmm.53.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Environments-cmm.53<br>
Author: cmm<br>
Time: 16 January 2015, 2:54:24.767 pm<br>
UUID: 69b32fc7-98f1-4c19-9976-a38106a9ee63<br>
Ancestors: Environments-cmm.52<br>
<br>
- Only change key when it is NOT in the 'bindings' Dictionary, otherwise it would be in a state inconsistent with its new hash.<br>
<br>
=============== Diff against Environments-cmm.51 ===============<br>
<br>
Item was changed:<br>
----- Method: Environment>>renameClass:from:to: (in category 'classes and traits') -----<br>
renameClass: aClass from: oldName to: newName<br>
"Rename the class, aClass, to have the title newName."<br>
<br>
| binding category |<br>
category := self organization categoryOfElement: oldName.<br>
self organization classify: newName under: category suppressIfDefault: true.<br>
self organization removeElement: oldName.<br>
<br>
+ binding := self associationAt: oldName.<br>
- binding := self declarationOf: oldName.<br>
declarations removeKey: oldName.<br>
+ bindings removeKey: oldName.<br>
+ " self binding: binding removedFrom: self."<br>
- self binding: binding removedFrom: self.<br>
<br>
+ binding key: newName.<br>
+ declarations add: binding.<br>
+ bindings add: binding.<br>
+ " self binding: binding addedTo: self."<br>
- binding := newName => aClass.<br>
- declarations add: binding.<br>
- self binding: binding addedTo: self.<br>
<br>
Smalltalk renamedClass: aClass from: oldName to: newName.<br>
SystemChangeNotifier uniqueInstance<br>
classRenamed: aClass<br>
from: oldName<br>
to: newName<br>
inCategory: category!<br>
<br>
<br>
</blockquote></div><br></div>