[Pharo-dev] Error adding a Class instVar

Camille Teruel camille.teruel at gmail.com
Sun Apr 27 06:44:21 EDT 2014


Hello Esteban,

Sorry for the delay. 
All the layout of all these classes is wrong, due to some ancient bug. 
The bug fix has been integrated but all the classes that have been modified in-between may have this problem.
To fix that you have to force the rebuild of these classes (by adding then removing a dummy inst var for ex).
Here is a script that do that:

ivName := 'anIVNameImPrettySureNobodyUses'.
all := Smalltalk allClasses flatCollect: [ :e | { e . e class } ].
candidates := all reject: [ :e | e superclass isNil or: [e layout slotScope isKindOf: LayoutEmptyScope ] ].
toRebuild := candidates reject: [ :e | e superclass layout slotScope == e layout slotScope parentScope ].
toRebuild do: [ :e | e addInstVarNamed: ivName ].
toRebuild do: [ :e | 
    (e isClassSide
        ifTrue: [ (Smalltalk at: e instanceSide name) classSide ]
        ifFalse: [ Smalltalk at: e name ]) removeInstVarNamed: ivName ]


On 25 avr. 2014, at 16:53, Esteban A. Maringolo <emaringolo at gmail.com> wrote:

> Camille, all the classes in my hiearchy are in the toRebuild collection.
> 
> But these others are also included:
> 
> AdabasLikePlatform class
> AsyncFileReadStream class
> CannotAutomaticallyDetermineJoin class
> CannotFindSession class
> DialogWindowModel class
> DolphinDatabaseAccessor class
> DuplicatePrimaryKeyException class
> ExternalOSProcess class
> GlorpDatabaseReadError class
> GlorpDatabaseWriteError class
> GlorpIllegalCommand class
> GlorpInvalidExpressionError class
> GlorpInvalidTypeError class
> GlorpLinkTableAnywhereDescriptorSystem class
> GlorpTransactionFailure class
> GlorpWriteFailure class
> JQueryClass class
> JQueryInstance class
> MAMemoryFileModel class
> MBAbstractInfoList class
> MBLabelInfo class
> MBSpecInfo class
> MCClassDefinition
> MCClassDefinition class
> MCClassTraitDefinition
> MCClassTraitDefinition class
> MCFileTreeFileSystemUtils class
> MCMethodDefinition
> MCMethodDefinition class
> MCMockDefinition
> MCMockDefinition class
> MCOrganizationDefinition
> MCOrganizationDefinition class
> MCScriptDefinition
> MCScriptDefinition class
> MacOSProcessAccessor class
> MacProcess class
> MySQLPlatform class
> OS2OSProcessAccessor class
> OS2Process class
> ObjectStudioDatabaseAccessor class
> OcelotPlatform class
> OraclePlatform class
> PGAbstractStringResponse class
> PGAsciiRow class
> PGAuthentication class
> PGBackendKeyData class
> PGCancelRequest class
> PGColumnDescription class
> PGCopyInResponse class
> PGCopyOutResponse class
> PGFunctionCall class
> PGFunctionResultResponse class
> PGNotificationResponse class
> PGPasswordPacket class
> PGQuery class
> PGReadyForQuery class
> PGRowDescription class
> PGStartupPacket class
> PGTerminate class
> PostgreSQLPlatform class
> ProfStef class
> RBSLDAPAuthenticationProvider class
> RBSPostgresAuthenticationProvider class
> RBSSuperUserSession class
> RBSVoyageAuthenticationProvider class
> RiscOSProcess class
> RiscOSProcessAccessor class
> SQLServerPlatform class
> SQLite3Platform class
> SpecDebugActionButton class
> SqueakDatabaseAccessor class
> TextInputFieldModel class
> UIThemeVistary class
> UIThemeWatery class
> UnixProcess class
> VADatabaseAccessor class
> VWDatabaseAccessor class
> ValidationError class
> WAAncestryAttributeEditor class
> WABufferedResponse class
> WACacheAttributeEditor class
> WAComboResponse class
> WAConfigAttributeEditor class
> WAFileAttributeEditor class
> WAFileLibrary class
> WAFileMetadataLibrary class
> WAFilterAttributeEditor class
> WAStreamedResponse class
> WindowsOSProcessAccessor class
> WindowsProcess class
> WorldModel class
> 
> Regards!
> 
> 
> Esteban A. Maringolo
> 
> 
> 2014-04-25 4:42 GMT-03:00 Camille Teruel <camille.teruel at gmail.com>:
>> 
>> On 25 avr. 2014, at 09:13, Marcus Denker <marcus.denker at inria.fr> wrote:
>> 
>>> 
>>> On 25 Apr 2014, at 04:33, Esteban A. Maringolo <emaringolo at gmail.com> wrote:
>>> 
>>>> I was adding a Class instance variable when I got this, admittedly, funny error.
>>>> 
>>>> Any clues of why?
>>>> 
>>>> The class has a Trait (which I plan to remove). Maybe that is causing this?
>>> 
>>> This is this problem:
>>> 
>>> https://pharo.fogbugz.com/f/cases/13028/Adding-ClassVariables-corrupts-class-hierarchy
>> 
>> No I don't think so, 13028 is the subclass cache problem whereas Esteban's problem seems to be related to wrong slot scope problem.
>> Esteban, is it the latest image?
>> Can run this script in your image and tell us the content of toRebuild?
>> 
>> all := Smalltalk allClasses flatCollect: [ :e | { e . e class } ].
>> candidates := all reject: [ :e | e superclass isNil or: [e layout slotScope isKindOf: LayoutEmptyScope ] ].
>> toRebuild := candidates reject: [ :e | e superclass layout slotScope == e layout slotScope parentScope ].
>> 
>> Does toRebuild contains your class or one class of its hierarchy?
>> 
>>> 
>>> 
>> 
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20140427/68da3617/attachment-0002.html>


More information about the Pharo-dev mailing list