Skip to content

Commit b1c0e61

Browse files
committed
Fix #210 but this is manual to check the component trait definition
1 parent 8717f13 commit b1c0e61

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Molecule/MolComponentFactory.class.st

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -917,9 +917,12 @@ MolComponentFactory >> rebuildComponent: aComponentClass traitsAdding: aTraitsLi
917917
"Cannot add the traits if already present in superclasses"
918918
classes do: [ :c | toBeAddedTrait ifNotNil:[ (c allTraits includes: trait) ifTrue:[toBeAddedTrait := nil] ]].
919919
toBeAddedTrait ifNotNil:[
920-
aComponentClass traitComposition isEmpty
921-
ifTrue:[aComponentClass setTraitComposition: toBeAddedTrait]
922-
ifFalse:[ aComponentClass addToComposition: toBeAddedTrait].
920+
921+
[ "see issue #210"
922+
aComponentClass traitComposition isEmpty
923+
ifTrue:[aComponentClass setTraitComposition: toBeAddedTrait]
924+
ifFalse:[ aComponentClass addToComposition: toBeAddedTrait]
925+
] on: KeyNotFound do:[ :ex | MolUtils log: ex printString ].
923926
].
924927
].
925928
].
@@ -936,16 +939,15 @@ MolComponentFactory >> rebuildComponent: aComponentClass traitsRemoving: aTraits
936939
( aComponentClass isComposedBy: trait ) ifTrue:[
937940
[ aComponentClass removeFromComposition: trait ] on: KeyNotFound do:[ :e |
938941
"When an originaly method injected by a Trait is remove, there is a KeyNotFound exception - catch it because finally we need to remove"
939-
"Need to do another try in a fork with a delay to considere system installation"
942+
"Need to do another try in a fork with a delay to considere system installation - see issue #210"
940943
self flag:'laborde: write a Pharo issue? Usecase: remove an overridden method of a Traits then remove the trait from composition'.
941944
MolUtils log: e printString.
942945
[
943946
10 milliSeconds wait.
944947
[ (aComponentClass isComposedBy: trait) ifTrue:[ aComponentClass removeFromComposition: trait ] ]
945948
on: KeyNotFound
946-
do:[ :ex | "do nothing - fork terminated" ex return: nil ].
949+
do:[ :ex | MolUtils log: ex printString ].
947950
] fork.
948-
e return: nil.
949951
].
950952
].
951953
].

0 commit comments

Comments
 (0)