pharo
pharo copied to clipboard
RBAddMethodTransformation does not add changes to the model
Bug description
In RBAddMethodTransformation>>privateTransform a new method is compiled but the change is not recorded into the model, making performChanges later (for example sending execute to the transformation) to not find any changes.
Expected behavior
This is a possible fix
privateTransform
self model changes addChange: (
self definingClass
compile: sourceCode
classified: protocol)
In #16347
Tx hernan!
I don't think that proposed solution is in line with how other refactorings create changes. We should look into self definingClass and also #compile:classified and see why the change is not added in the model.
I don't think that proposed solution is in line with how other refactorings create changes. We should look into
self definingClassand also#compile:classifiedand see why the change is not added in the model.
Sorry I don't understand what you mean. What would be the problem?
I meant that we never call #addChange: directly in the refactoring. Doing it like that would be a hack. We should investigate and figure out why exactly the model doesn't have this change. I'm not sure what would be the problem, but I've pointed out a few starting points in the comment above.
Hey Hernan, where did you discover this bug, how can I reproduce it?
@hernanmd we debugged and the fix is:
RBMakeClassAbstractTransformation >> privateTransform
self generateChangesFor: (RBAddMethodTransformation
sourceCode: 'isAbstract
^ self == ' , targetClass asString
in: targetClass classSide
withProtocol: #testing)
previously it was using execute which immediately compiled the method vs. now the change is in the model.