Skip to content

Commit

Permalink
Merge pull request #821 from ApptiveGrid/820-SoilObjectProxy-should-f…
Browse files Browse the repository at this point in the history
…orward-class

820-SoilObjectProxy-should-forward-class
  • Loading branch information
noha authored Sep 26, 2024
2 parents 2d222c9 + df1633c commit 623ec54
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/Soil-Core-Tests/SoilTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,32 @@ SoilTest >> testMigrationVersionsHalf [

]

{ #category : #tests }
SoilTest >> testRootSendingClass [
"We have a root in a Dictionary and that object overrides #= that checks using #class.
This tests that the proxy forwards #class correctly"

| tx collection objectUsingClassinQueals |
tx := soil newTransaction.
collection := OrderedCollection new.
tx root: collection.
objectUsingClassinQueals := RBComment with:
(RBCommentToken
value: 'Some sample text'
start: 5
stop: 21).
tx makeRoot: objectUsingClassinQueals.
collection add: objectUsingClassinQueals.
tx markDirty: objectUsingClassinQueals.
tx markDirty: collection.
tx commit.

"now lets try to remove the object in a new transaction, note that the #remove uses #= which sends #class"
tx := soil newTransaction.
tx root remove: objectUsingClassinQueals.
tx commit
]

{ #category : #tests }
SoilTest >> testSerializingClassDescription [
| obj bytes obj2 stream transaction |
Expand Down
6 changes: 6 additions & 0 deletions src/Soil-Core/SoilObjectProxy.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ SoilObjectProxy >> asUnresolvedProxy [
objectId: objectId
]

{ #category : #'class membership' }
SoilObjectProxy >> class [
"we override it here as else the superclass version would be uses, returning SoilObjectProxy"
^ self soilRealObject class
]

{ #category : #'reflective operations' }
SoilObjectProxy >> doesNotUnderstand: aMessage [
^ aMessage sendTo: self soilRealObject
Expand Down

0 comments on commit 623ec54

Please sign in to comment.