Trouble removing an AnObsoleteC3 Class

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

Trouble removing an AnObsoleteC3 Class

Michael Davies-2
Hi all,

I posted this to the beginners list, and got some help understanding
the problem, but I didn't get to a solution - can anyone help?

I was playing with the test runner and one of the tests seems to have
left many Obsolete classes hanging around that I'm unable to remove;
this means that I'm having problems using the Refactoring Browser. In
order to track the classes down I followed the hints on
http://wiki.squeak.org/squeak/2631 ; when I got to bringing up the
Pointer Finder it said:

#ProtoObject -> ProtoObject class
subclasses: Array
9: AnObsoleteC3 class

I inspected protoObject and the subclasses array has 105 members, many
of them repeated:

{Object . ObjectOut . ImageSegmentRootStub . MessageCatcher .
DynamicBindingsInfo . MaMinimalObject . MAConditionBuilder .
MAProxyObject . AnObsoleteC3 . AnObsoleteC4 . AnObsoleteC6 .
AnObsoleteC3 . AnObsoleteC4 . AnObsoleteC6 . AnObsoleteC3 .
AnObsoleteC4 . AnObsoleteC6 . AnObsoleteC3 . AnObsoleteC4 .
AnObsoleteC6 . AnObsoleteC3 . AnObsoleteC4 . AnObsoleteC6 .
...etc... }

This didn't look good, so I then did a search through references to
ProtoObject, and found that TraitsResource (in Traits-Tests) looks
like the guilty party - it has three methods
setUpTrivialRequiresFixture, setUpTwoLevelRequiresFixture,
setUpTranslatingRequiresFixture - these include lines like (for C3,
C4, C6):

        self c3: (self
                                createClassNamed: #C3
                                superclass: ProtoObject
                                uses: { }).
        self c3 superclass: nil.

Another run of the Traits-Tests suite left me with yet more of these
obsolete classes. I have absolutely no idea how to get rid of these
classes. Can anybody help me take this any further?

Reply | Threaded
Open this post in threaded view
|

Re: Trouble removing an AnObsoleteC3 Class

Bert Freudenberg
On Feb 1, 2007, at 18:33 , Michael Davies wrote:

> Hi all,
>
> I posted this to the beginners list, and got some help understanding
> the problem, but I didn't get to a solution - can anyone help?
>
> I was playing with the test runner and one of the tests seems to have
> left many Obsolete classes hanging around that I'm unable to remove;
> this means that I'm having problems using the Refactoring Browser. In
> order to track the classes down I followed the hints on
> http://wiki.squeak.org/squeak/2631 ; when I got to bringing up the
> Pointer Finder it said:
>
> #ProtoObject -> ProtoObject class
> subclasses: Array
> 9: AnObsoleteC3 class
>
> I inspected protoObject and the subclasses array has 105 members, many
> of them repeated:
>
> {Object . ObjectOut . ImageSegmentRootStub . MessageCatcher .
> DynamicBindingsInfo . MaMinimalObject . MAConditionBuilder .
> MAProxyObject . AnObsoleteC3 . AnObsoleteC4 . AnObsoleteC6 .
> AnObsoleteC3 . AnObsoleteC4 . AnObsoleteC6 . AnObsoleteC3 .
> AnObsoleteC4 . AnObsoleteC6 . AnObsoleteC3 . AnObsoleteC4 .
> AnObsoleteC6 . AnObsoleteC3 . AnObsoleteC4 . AnObsoleteC6 .
> ...etc... }
>
> This didn't look good, so I then did a search through references to
> ProtoObject, and found that TraitsResource (in Traits-Tests) looks
> like the guilty party - it has three methods
> setUpTrivialRequiresFixture, setUpTwoLevelRequiresFixture,
> setUpTranslatingRequiresFixture - these include lines like (for C3,
> C4, C6):
>
>        self c3: (self
>                                createClassNamed: #C3
>                                superclass: ProtoObject
>                                uses: { }).
>        self c3 superclass: nil.
>
> Another run of the Traits-Tests suite left me with yet more of these
> obsolete classes. I have absolutely no idea how to get rid of these
> classes. Can anybody help me take this any further?

Hey, your report can serve as a role model to many postings here,  
very thorough :)

If you just want to clean up your image, something like this should  
do it:

        (ProtoObject subclasses select: [:each | each isObsolete])
                do: [:each | ProtoObject removeSubclass: each]

Can't help with the cause of the problem, but you should file a bug  
report.

- Bert -



Reply | Threaded
Open this post in threaded view
|

Re: Trouble removing an AnObsoleteC3 Class

tblanchard
In reply to this post by Michael Davies-2
I've run across something similar recently.

One thing that seems counter-intuitive is that you could have a  
method somewhere like:

makeC3

        ^C3 new

This method has been compiled and the reference to class C3 has been  
resolved in the compiled code.  If the C3 class has gone away - the  
class is renamed to AnObsoleteC3.  So the code appears to reference  
C3, but it really references the obsolete one.  You need to recompile  
this method - just trivially alter it by adding a space and accept  
it.  The method will be recompiled.  You might want to do a source  
code search for C3, then ensure that all those methods get recompiled.

-Todd Blanchard