NewTools
NewTools copied to clipboard
Raw inspectiond does not play well with proxies
Working with Glorp, the new Spec based inspector does not handle proxy objects the same way as the old inspector did.
Method StRawInspection>>#step
should not use #=
for Array which leads to #=
on Proxy level and thus instantiation.
Instead:
step
| rootNodes allAreEqual |
rootNodes := self model allInspectorNodes.
mementoNodes ifNil: [
mementoNodes := rootNodes collect: #mementoValue.
^ self ].
allAreEqual := true.
rootNodes size = mementoNodes size ifTrue: [
(rootNodes collect: #value) with: mementoNodes do: [ :rn :mn |
((self isUninstantiatedProxy: rn) and: [self isUninstantiatedProxy: mn])
ifFalse: [allAreEqual := allAreEqual & (rn = mn)].
].
].
allAreEqual ifTrue: [^self].
mementoNodes := rootNodes collect: #mementoValue.
attributeTable updateRootsKeepingSelection: rootNodes
Testing utility in StRawInspection
:
isUninstantiatedProxy: anObject
(anObject class inheritsFrom: AbstractProxy)
ifFalse: [^false].
^anObject isInstantiated not
(here, AbstractProxy
is a Glorp class, Pharo unfortunatelly does not have a standard message to detect proxy (and it should have one!)
StObjectPrinter class>>#asTruncatedTextFrom: anObject
should call #stDisplayString instead of #displayString