Calypso icon indicating copy to clipboard operation
Calypso copied to clipboard

Adding a method in a class from _UnpackagedPackage breaks

Open jecisc opened this issue 6 years ago • 4 comments

Today I tried to add a class and methods in _UnpackagedPackage but I got exceptions. I have the impression it happens only in this package.

UndefinedObject(Object)>>doesNotUnderstand: #name ReflectiveMethod>>run:with:in: SycMoveMethodsToClassPackageCommand(SycMethodRepackagingCommand)>>moveMethod:toPackage: [ :each | classPackage := each origin package. self moveMethod: each toPackage: classPackage. each tagWith: targetTagName ] in SycMoveMethodsToClassPackageCommand>>execute in Block: [ :each | ... Array(SequenceableCollection)>>do: SycMoveMethodsToClassPackageCommand>>execute [ (extendingPackage notNil and: [ aMethod package ~~ extendingPackage ]) ifTrue: [ ^ (SycMoveMethodsToPackageCommand for: {aMethod} to: extendingPackage) execute ].

(extendingPackage isNil and: [ aMethod isExtension ]) ifTrue: [ (SycMoveMethodsToClassPackageCommand for: {aMethod}) execute ] ] in ClyMethodCreationToolMorph(ClyMethodEditorToolMorph)>>packageEditingMethod: in Block: [ (extendingPackage notNil... BlockClosure>>ensure: ClyMethodCreationToolMorph(ClyTextEditorToolMorph)>>applyChangesBy: ClyMethodCreationToolMorph(ClyMethodEditorToolMorph)>>packageEditingMethod: ClyMethodCreationToolMorph(ClyMethodEditorToolMorph)>>tagAndPackageEditingMethod: ClyMethodCreationToolMorph>>applyChanges [ self changesAreAboutApply. applied := self applyChanges ] in [ textMorph hasUnacceptedEdits: true. [ self changesAreAboutApply. applied := self applyChanges ] on: Error do: [ :err | textModel text: self editingText. textMorph hasUnacceptedEdits: true. err pass ]. applied ifTrue: [ textMorph hasUnacceptedEdits: false. self textUpdated. browser focusActiveTab ] ifFalse: [ textModel text: self editingText. textMorph hasUnacceptedEdits: true ] ] in ClyMethodCreationToolMorph(ClyTextEditorToolMorph)>>changesAccepted in Block: [ self changesAreAboutApply.... BlockClosure>>on:do: [ textMorph hasUnacceptedEdits: true. [ self changesAreAboutApply. applied := self applyChanges ] on: Error do: [ :err | textModel text: self editingText. textMorph hasUnacceptedEdits: true. err pass ]. applied ifTrue: [ textMorph hasUnacceptedEdits: false. self textUpdated. browser focusActiveTab ] ifFalse: [ textModel text: self editingText. textMorph hasUnacceptedEdits: true ] ] in ClyMethodCreationToolMorph(ClyTextEditorToolMorph)>>changesAccepted in Block: [ textMorph hasUnacceptedEdits: true.... BlockClosure>>ensure: ClyMethodCreationToolMorph(ClyTextEditorToolMorph)>>applyChangesBy: ClyMethodCreationToolMorph(ClyTextEditorToolMorph)>>changesAccepted MessageSend>>value MessageSend>>cull: MessageSend>>cull:cull: [ action cull: anAnnouncement cull: announcer ] in AnnouncementSubscription>>deliver: in Block: [ action cull: anAnnouncement cull: announcer ] BlockClosure>>on:do: BlockClosure>>on:fork: AnnouncementSubscription>>deliver: [ "Ensure delivery to remaining announcements" subscription deliver: anAnnouncement ] in SubscriptionRegistry>>deliver:to:startingAt: in Block: [ "Ensure delivery to remaining announcements" sub...etc... BlockClosure>>ifCurtailed: SubscriptionRegistry>>deliver:to:startingAt: SubscriptionRegistry>>deliver:to: SubscriptionRegistry>>deliver:

jecisc avatar Dec 21 '18 09:12 jecisc

It looks like some metalink is installed into executed code and it fails (error is inside ReflectiveMethod)

пт, 21 дек. 2018 г. в 09:47, CyrilFerlicot [email protected]:

Today I tried to add a class and methods in _UnpackagedPackage but I got exceptions. I have the impression it happens only in this package.

UndefinedObject(Object)>>doesNotUnderstand: #name ReflectiveMethod>>run:with:in:

SycMoveMethodsToClassPackageCommand(SycMethodRepackagingCommand)>>moveMethod:toPackage: [ :each | classPackage := each origin package. self moveMethod: each toPackage: classPackage. each tagWith: targetTagName ] in SycMoveMethodsToClassPackageCommand>>execute in Block: [ :each | ... Array(SequenceableCollection)>>do: SycMoveMethodsToClassPackageCommand>>execute [ (extendingPackage notNil and: [ aMethod package ~~ extendingPackage ]) ifTrue: [ ^ (SycMoveMethodsToPackageCommand for: {aMethod} to: extendingPackage) execute ].

(extendingPackage isNil and: [ aMethod isExtension ]) ifTrue: [ (SycMoveMethodsToClassPackageCommand for: {aMethod}) execute ] ] in ClyMethodCreationToolMorph(ClyMethodEditorToolMorph)>>packageEditingMethod: in Block: [ (extendingPackage notNil... BlockClosure>>ensure: ClyMethodCreationToolMorph(ClyTextEditorToolMorph)>>applyChangesBy: ClyMethodCreationToolMorph(ClyMethodEditorToolMorph)>>packageEditingMethod:

ClyMethodCreationToolMorph(ClyMethodEditorToolMorph)>>tagAndPackageEditingMethod: ClyMethodCreationToolMorph>>applyChanges [ self changesAreAboutApply. applied := self applyChanges ] in [ textMorph hasUnacceptedEdits: true. [ self changesAreAboutApply. applied := self applyChanges ] on: Error do: [ :err | textModel text: self editingText. textMorph hasUnacceptedEdits: true. err pass ]. applied ifTrue: [ textMorph hasUnacceptedEdits: false. self textUpdated. browser focusActiveTab ] ifFalse: [ textModel text: self editingText. textMorph hasUnacceptedEdits: true ] ] in ClyMethodCreationToolMorph(ClyTextEditorToolMorph)>>changesAccepted in Block: [ self changesAreAboutApply.... BlockClosure>>on:do: [ textMorph hasUnacceptedEdits: true. [ self changesAreAboutApply. applied := self applyChanges ] on: Error do: [ :err | textModel text: self editingText. textMorph hasUnacceptedEdits: true. err pass ]. applied ifTrue: [ textMorph hasUnacceptedEdits: false. self textUpdated. browser focusActiveTab ] ifFalse: [ textModel text: self editingText. textMorph hasUnacceptedEdits: true ] ] in ClyMethodCreationToolMorph(ClyTextEditorToolMorph)>>changesAccepted in Block: [ textMorph hasUnacceptedEdits: true.... BlockClosure>>ensure: ClyMethodCreationToolMorph(ClyTextEditorToolMorph)>>applyChangesBy: ClyMethodCreationToolMorph(ClyTextEditorToolMorph)>>changesAccepted MessageSend>>value MessageSend>>cull: MessageSend>>cull:cull: [ action cull: anAnnouncement cull: announcer ] in AnnouncementSubscription>>deliver: in Block: [ action cull: anAnnouncement cull: announcer ] BlockClosure>>on:do: BlockClosure>>on:fork: AnnouncementSubscription>>deliver: [ "Ensure delivery to remaining announcements" subscription deliver: anAnnouncement ] in SubscriptionRegistry>>deliver:to:startingAt: in Block: [ "Ensure delivery to remaining announcements" sub...etc... BlockClosure>>ifCurtailed: SubscriptionRegistry>>deliver:to:startingAt: SubscriptionRegistry>>deliver:to: SubscriptionRegistry>>deliver:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pharo-ide/Calypso/issues/395, or mute the thread https://github.com/notifications/unsubscribe-auth/AHxaoFF3meMlI-YGxMiX3dwB5XCslmbPks5u7K5JgaJpZM4ZdsKg .

dionisiydk avatar Dec 21 '18 10:12 dionisiydk

yes, it always fail. For other packages method after compilation always has package but it is not true in this case

dionisiydk avatar Dec 21 '18 17:12 dionisiydk

I would fix on Pharo side. _UnpackagedPackage should behave like a normal package

dionisiydk avatar Dec 21 '18 17:12 dionisiydk

Following code works wrong in that case:

"Create AClass2 in _UnpackagedPackage"
selector := AClass2 compile: 'someMethod999'.
method := AClass2 >> selector.
method package ==> nil

dionisiydk avatar Dec 21 '18 17:12 dionisiydk