[Pharo-project] I get an error when I exclude a method from a trait
using 10185 package Browser Then removing a method coming from a trait in a class (for example StakcTest) -> errror methodClass From: stephane.ducasse@inria.fr To: squeak-dev@lists.squeakfoundation.org Subject: [BUG]UndefinedObject(Object)>>doesNotUnderstand: #methodClass here insert explanation of what you were doing, suspect changes you've made and so forth. 9 December 2008 12:35:05 pm VM: Mac OS - a SmalltalkImage Image: Pharo0.1 [Latest update: #10185] SecurityManager state: Restricted: false FileAccess: true SocketAccess: true Working Dir /Users/ducasse/Workspace/FirstCircle/ActiveResearch/Pharo/ Pharo Trusted Dir /foobar/tooBar/forSqueak/bogus Untrusted Dir /Users/ducasse/Library/Preferences/Squeak/Internet/My Squeak UndefinedObject(Object)>>doesNotUnderstand: #methodClass Receiver: nil Arguments and temporary variables: aMessage: methodClass Receiver's instance variables: nil TestCase class>>methodChanged: Receiver: TestCase Arguments and temporary variables: anEvent: Recategorized Event for item: nil of kind: #method cls: nil sel: nil Receiver's instance variables: superclass: Object methodDict: a MethodDictionary(#addDependentToHierachy:->a CompiledMethod (1649...etc... format: 132 instanceVariables: #('testSelector') organization: ('accessing' assert: assert:description: assert:description:resum...etc... subclasses: {BalloonFontTest. Base64MimeConverterTest. BecomeTest. BitBltClipBu...etc... name: #TestCase classPool: nil sharedPools: nil environment: Smalltalk category: #'SUnit-Kernel' traitComposition: nil localSelectors: nil WeakMessageSend>>valueWithArguments: Receiver: WeakMessageSend(#methodChanged: -> TestCase) Arguments and temporary variables: anArray: an Array(Recategorized Event for item: nil of kind: #method) Receiver's instance variables: selector: #methodChanged: shouldBeNil: #() arguments: #() [] in WeakActionSequenceTrappingErrors>>valueWithArguments:startingFrom: {[answer := each valueWithArguments: anArray]} Arguments and temporary variables: anArray: an Array(Recategorized Event for item: nil of kind: #method) startIndex: 1 each: WeakMessageSend(#methodChanged: -> TestCase) answer: TheWorldMainDockingBar index: 6 exc: MessageNotUnderstood: UndefinedObject>>methodClass indexLimiT: 12 --- The full stack --- UndefinedObject(Object)>>doesNotUnderstand: #methodClass TestCase class>>methodChanged: WeakMessageSend>>valueWithArguments: [] in WeakActionSequenceTrappingErrors>>valueWithArguments:startingFrom: {[answer := each valueWithArguments: anArray]} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - BlockContext>>on:do: WeakActionSequenceTrappingErrors>>valueWithArguments:startingFrom: WeakActionSequenceTrappingErrors>>valueWithArguments: SystemEventManager(Object)>>triggerEvent:withArguments: SystemEventManager(Object)>>triggerEvent:with: RecategorizedEvent(AbstractEvent)>>trigger: SystemChangeNotifier>>trigger: SystemChangeNotifier>>selector:recategorizedFrom:to:inClass: StackTest class(ClassDescription)>>notifyOfRecategorizedSelector:from:to: ClassOrganizer>>notifyOfChangedSelector:from:to: ClassOrganizer>>removeElement: [] in StackTest class (ClassDescription )>>updateOrganizationSelector:oldCategory:newCategory: {[:each | sel := each selector. (self includesLocalSelector: sel) ifFalse...]} OrderedCollection>>do: StackTest class (ClassDescription)>>updateOrganizationSelector:oldCategory:newCategory: StackTest class(ClassDescription)>>noteRecategorizedSelector:from:to: [] in StackTest class(ClassDescription)>>noteRecategorizedSelectors:oldComposition: {[:each | oldCategory := self organization categoryOfElement: each. newCate...]} IdentitySet(Set)>>do: StackTest class(ClassDescription)>>noteRecategorizedSelectors:oldComposition: StackTest class(ClassDescription)>>applyChangesOfNewTraitCompositionReplacing: StackTest class(Class)>>applyChangesOfNewTraitCompositionReplacing: StackTest class(Behavior)>>setTraitComposition: OBMethodNode>>doExcludeSelector OBMethodNode>>excludeSelector OBCmdExcludeMethod>>execute [] in OBNodeCommandScan(OBCommandScan)>>processKeystroke:withNode:for: {[:cmd | (cmd isActive and: [cmd isEnabled]) ifTrue: [cmd execute]]} OrderedCollection>>do: OBNodeCommandScan(OBCommandScan)>>processKeystroke:withNode:for: OBEnhancementColumn(OBColumn)>>keystroke:from: OBPluggableListMorph(PluggableListMorph)>>modifierKeyPressed: OBPluggableListMorph(PluggableListMorph)>>keyStroke: OBPluggableListMorph(Morph)>>handleKeystroke: KeyboardEvent>>sentTo: OBPluggableListMorph(Morph)>>handleEvent: MorphicEventDispatcher>>dispatchDefault:with: MorphicEventDispatcher>>dispatchEvent:with: OBPluggableListMorph(Morph)>>processEvent:using: ...etc...
selector: selector recategorizedFrom: oldCategory to: newCategory inClass: aClass self trigger: (RecategorizedEvent method: (aClass compiledMethodAt: selector ifAbsent: [nil]) protocol: newCategory class: aClass oldProtocol: oldCategory) aClass = StackTest selector = #testCopyNonEmpty This is strange because when I do StackTest compiledMethodAt: #testCopyNonEmpty -> a compiledMethod. before actually removing the method using the browser Now it seems to me that the event is wrong because I do not recategorize a method, I'm removing it. When I exclude a selector the following method is invoked and I have the impression that the notification is too large. applyChangesOfNewTraitCompositionReplacing: oldComposition | changedSelectors | changedSelectors := super applyChangesOfNewTraitCompositionReplacing: oldComposition. self noteRecategorizedSelectors: changedSelectors oldComposition: oldComposition. ^ changedSelectors. I tried to fix it with that notifyOfRecategorizedSelector: element from: oldCategory to: newCategory newCategory isNil ifTrue: [ SystemChangeNotifier uniqueInstance methodRemoved: (self compiledMethodAt: element) ^^^ but here the method has been already removed and this is probably not the right place to fix it. would be better to emit an exclusion or method removal selector: element inProtocol: oldCategory class: self ] ifFalse: [ SystemChangeNotifier uniqueInstance selector: element recategorizedFrom: oldCategory to: newCategory inClass: self] But the problem is that the removeElement: method does not keep a reference to the removed moethod removeElement: element | oldCat | oldCat := self categoryOfElement: element. SystemChangeNotifier uniqueInstance doSilently: [ super removeElement: element]. self notifyOfChangedSelector: element from: oldCat to: (self categoryOfElement: element). I imagine that adrian you will not look at that before next tuesday :) Stef
participants (2)
-
Adrian Lienhard -
Stéphane Ducasse