2 references to class with the same name
Brad Fuller
brad at bradfuller.com
Mon Feb 26 21:46:07 UTC 2007
Bert Freudenberg wrote:
>
> On Feb 26, 2007, at 20:46 , Brad Fuller wrote:
>
>> I searched for the answer to this, but mostly found how to deal with
>> instances and obsolete classes. Somehow, I ended up with 2 two classes
>> with the same name, and the class is not obsolete.
>>
>> If I look at the hierarchy of it's (their) superclass
>> (PRStructuresWidget) there are two classes shown:
>>
>> PRSearchWidget #('searchText' 'items')
>> PRSearchWidget #('searchText')
>>
>> PRSearchWidget #('searchText' 'items') is the current "real" class.
>> Somehow PRSearchWidget #('searchText') got in there, which I don't
>> want. I don't know how to get rid of it. Anyone point me to the right
>> documentation on this? Maybe if I file out the current one, then
>> remove the class?
>
> Funny you should mention this. I saw the same thing in about three
> images lately. I have no idea where it comes from. My hunch is
> Monticello, but I have no evidence to back this up.
>
> In all cases I found that one or even two older version of a class were
> still in the subclasses list of its superclass. That is, in the browser
> you could see several subclasses with the same name. Only one of these
> is the "real" one which is also registered in Smalltalk.
>
> I do not hava a bad image now, but to find these, the following should
> work:
>
> bad := OrderedCollection new.
> Smalltalk allClassesDo: [:ea | bad addAll: (ea subclasses reject: [:cls
> | cls isMeta or: [cls == (Smalltalk at: cls name)]])].
> bad
>
> To remove them, try this:
>
> bad do: [:cls | cls superclass removeSubclass: cls]
Thanks Bert, that did the trick.
Much obliged,
brad
--
brad fuller
www.bradfuller.com
+1 (408) 799-6124
More information about the Squeak-dev
mailing list
|