[BUG] ClassBuilder cannot change class to variable subclass

Boris Gaertner Boris.Gaertner at gmx.net
Mon Jan 5 01:36:24 UTC 2004

From: Boris Gaertner <Boris.Gaertner at gmx.net>
To: <squeak-dev at lists.squeakfoundation.org>
Sent: Sunday, January 04, 2004 7:00 PM
Subject: [BUG] ClassBuilder cannot change class to variable subclass

> This bug report is for Squeak 3.7 alpha latest update: 5623
   <details omitted>
> Attached you find a proposal for a fix. I think that it
> will not cause problems elsewhere but your advice
> is very welcome.

That proposed fix is also wrong, attached you find something

The iteration method 'withAllSubclassesDo:' that I called a
troublemaker, does two tests:
 1. It checks the new number of named instance variables.
 2. It validates the subclasses.

The first test is needed for  oldClass and all subclasses,
the second test is needed only for the subclasses.
In the attached proposal, I do the first test for  oldClass
before I do both tests for all the subclasses.

It is helpful to compare with Squeak 3.4 #5170, where
two iterations are used to keep the tests separate:

(di 11/24/1999)
   < ... >
 oldClass withAllSubclassesDo: [:sub |
  sub instSize + deltaSize > 254 ifTrue: [
   self error: sub name,' has more than 254 instance variables'.
   ^ false]].
 newType ~~ #normal ifTrue:
  ["And check if the immediate subclasses of oldClass can keep its layout"
  oldClass subclassesDo:[:sub|
   oldType _ sub typeOfClass.
   oldType == newType ifFalse: [
    self error: sub name,' cannot be recompiled'.
    ^ false]]].
  < ... >

Later these two iterations were merged into one  and that was
wrong: The two iterations do not iterate over the same
collection of classes! The first iteration checks one class that
is not checked by the second iteration. 

> Greetings, Boris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ClassBuilderCheck-bg.3.cs
Type: application/octet-stream
Size: 1792 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040105/9036e74b/ClassBuilderCheck-bg.3.obj

More information about the Squeak-dev mailing list