recent RecentMessages issues

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

recent RecentMessages issues

Bob Arning-2
I got fully up-to-date this am, started making some changes, went to look at recent submissions and was told there were none.

Seems like

    RecentMessages startUp

would have been a useful inclusion somewhere in the update process. So, I did that, made some more changes and asked for recent submissions again. This time walkback in

RecentMessages>>mostRecent
    [methodReferences notEmpty and: [methodReferences last isValid not]]
    whileTrue: [methodReferences removeLast].
    ^ methodReferences last.

the reason being that none of the
methodReferences were valid, all got removed and #last failed.

Why weren't they valid?

RecentMessages>>event: anEvent
    "Hook for SystemChangeNotifier"

    (anEvent isCommented and: [anEvent itemKind = SystemChangeNotifier classKind])
        ifTrue: [self recordSelector: #Comment forClass: anEvent item inEnvironment: anEvent environment].
    ((anEvent isAdded or: [anEvent isModified]) and: [anEvent itemKind = SystemChangeNotifier methodKind])
        ifTrue: [
            anEvent itemRequestor
                ifNotNil: [self recordSelector: anEvent itemSelector forClass: anEvent itemClass inEnvironment: anEvent environment].
            InMidstOfFileinNotification signal
                ifFalse: [Utilities changed: #recentMethodSubmissions]].

the change is being gathered with an environment copied from the event, but an event's notion of environment is something rather different from what MethodReference is expecting:

MethodReference>>actualClass
    ^self environment at: classSymbol ifPresent: [ :actualClass |
        classIsMeta
            ifTrue: [ actualClass classSide ]
            ifFalse: [ actualClass ] ]

so, this just returns nil and the *invalid* MR is removed.

Cheers,
Bob


Reply | Threaded
Open this post in threaded view
|

Re: recent RecentMessages issues

Frank Shearar-3
On 26 September 2013 12:28, Bob Arning <[hidden email]> wrote:
> I got fully up-to-date this am, started making some changes, went to look at
> recent submissions and was told there were none.
>
> Seems like
>
>     RecentMessages startUp
>
> would have been a useful inclusion somewhere in the update process.

My understanding of #startUp is it's automatic magic. But perhaps it's
automatic magic only when starting up an image?

> So, I
> did that, made some more changes and asked for recent submissions again.
> This time walkback in
>
> RecentMessages>>mostRecent
>     [methodReferences notEmpty and: [methodReferences last isValid not]]
>     whileTrue: [methodReferences removeLast].
>     ^ methodReferences last.
>
> the reason being that none of the methodReferences were valid, all got
> removed and #last failed.
>
> Why weren't they valid?
>
> RecentMessages>>event: anEvent
>     "Hook for SystemChangeNotifier"
>
>     (anEvent isCommented and: [anEvent itemKind = SystemChangeNotifier
> classKind])
>         ifTrue: [self recordSelector: #Comment forClass: anEvent item
> inEnvironment: anEvent environment].
>     ((anEvent isAdded or: [anEvent isModified]) and: [anEvent itemKind =
> SystemChangeNotifier methodKind])
>         ifTrue: [
>             anEvent itemRequestor
>                 ifNotNil: [self recordSelector: anEvent itemSelector
> forClass: anEvent itemClass inEnvironment: anEvent environment].
>             InMidstOfFileinNotification signal
>                 ifFalse: [Utilities changed: #recentMethodSubmissions]].
>
> the change is being gathered with an environment copied from the event, but
> an event's notion of environment is something rather different from what
> MethodReference is expecting:

Yes, the Event's idea of an environment is wrong:

AbstractEvent >> item: anItem kind: anItemKind
    item := anItem.
    itemKind := anItemKind.
    environment := Dictionary new

That's wrong. (It might have been right in 2003, but it's not right today.)

Oh, man. I'm thinking that it all just worked in my image because of
an accidental accumulation of incidental state.

Thanks for the debugging, Bob, and apologies.

frank