Mantis - Squeak
Viewing Issue Advanced Details
5910 Traits minor always 02-02-07 11:31 04-03-10 19:06
MAD  
dvf  
normal  
assigned 3.10  
open  
none    
none  
0005910: Traits-Tests leaves referenced Obsolete Classes in the image
I was playing with the test runner and one of the Traits-Tests has
left many Obsolete classes hanging around that I'm unable to remove by
normal means; 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. They don't get garbage-collected in the normal course of events.

Todd Blanchard pointed out that the cause is probably due to compiled code:
"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."

Bert Freudenberg noted that the classes could be forced out by doing:
ProtoObject subclassesDo: [ :sc | sc isObsolete ifTrue: [ProtoObject removeSubclass: sc]].

This does remove the classes, but then RB hangs on AnObsoleteT1 (a Trait)...



3.10alpha.7068

Notes
(0009389)
user356   
02-02-07 11:41   
Note that the issue that causes the RB to attempt to access the Obsolete classes can be fixed by the changeset I've added as bug 5911