There seem to be some serious bugs when performing a sequence of renames. I added (a modified version) of your test and fixed the problem in:
Name: Refactoring-Core-lr.115 Author: lr Time: 19 March 2010, 1:36:35 pm UUID: 89f629b7-df37-4545-b795-87c5b78e1127 Ancestors: Refactoring-Core-lr.114, Refactoring-Core-lr.113 - fixed some bugs and added some tests when renaming a class multiple times Name: Refactoring-Tests-Core-lr.35 Author: lr Time: 19 March 2010, 1:36 pm UUID: a2c9c388-a1b1-4f7a-a749-f3d658c42779 Ancestors: Refactoring-Tests-Core-lr.33 - fixed some bugs and added some tests when renaming a class multiple times Lukas 2010/3/19 Fernando olivero <olive...@lu.unisi.ch>: > Lukas, i have the following problem: > model := RBNamespace new. > Then executing successive RenameRefactoring's using the same model yields an > Error. > 1. ClassA -> ClassA2 OK > 2. ClassA2 -> ClassA3 OK > 3. ClassA3 -> ClassA4 ERROR! > > I've tracked it down to this: > 1. > RenameRefactoring>>execute > self primitiveExecute. > RefactoringManager instance addRefactoring: self > 2. > RefactoringManager>>addRefactoring: aRefactoring > RefactoryChangeManager instance performChange: aRefactoring changes. > refactorings add: aRefactoring class name > 3. > Refactoring>>changes > ^self model changes > which answers all the changes! > { ClassA rename: #ClassA2! > ClassA2 rename: #ClassA3! > ClassA3 rename: #ClassA4! } > Why does a particular refactoring answers all the models changes? And not > just the ones it introduced? > The problem is in #performChange: will apply over and over all the changes, > and not just the last one. > > Lukas, do you think i'm incorrectly using the namespace and refactoring's? > Are namespace supposed to be used once and later ditched? > My goal is to have a GauchoSystem which nows all the changes (with undos!) > that have happened, that's why i'm using always the same namespace. > > Thanks, > Fernando > > pd: a test that reproduces the problem. > >>>testSucessiveRefactoringsError > | namespace | > namespace := RBNamespace new. > [ > | refactoring| > Object subclass: 'ClassA' asSymbol > instanceVariableNames: '' > classVariableNames: '' > poolDictionaries: '' > category: 'TestingNamespaces1234'. > refactoring := RenameClassRefactoring > model: namespace > rename: (Smalltalk classNamed: 'ClassA' asSymbol ) > to: 'ClassA2' asSymbol . > refactoring execute. > refactoring := RenameClassRefactoring > model: namespace > rename: (Smalltalk classNamed:'ClassA2' asSymbol ) > to: 'ClassA3' asSymbol. > refactoring execute. > refactoring := RenameClassRefactoring > model: namespace > rename: (Smalltalk classNamed: 'ClassA3' asSymbol ) > to: 'ClassA4' asSymbol. > self shouldnt:[refactoring execute] raise: Error description: 'Valid > refactoring should not raise error'. > ] ensure:[ SystemOrganization removeSystemCategory: 'TestingNamespaces1234' > ] > > _______________________________________________ > Pharo-project mailing list > Pharo-project@lists.gforge.inria.fr > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project