pharo
pharo copied to clipboard
[P12][P13] MetaLinkInstaller raises `NodeNotFound` when installing an object-centric permalink for a variable slot defined in a superclass
Bug description
When installing an object-centric permalink on a variable slot, the method registerAndInstallPermaLink:forTarget:
takes all nodes that access this slot and it installs the metalink on the equivalent nodes in the anonymous subclass of the object:
registerAndInstallPermaLink: aPermaLink forTarget: aSlotOrVar
| nodes |
(linksRegistry canReinstallPermaLink: aPermaLink)
ifFalse: [ ^ self ].
linksRegistry registerPermaLink: aPermaLink.
nodes := (aSlotOrVar accessingNodesFor: aPermaLink persistenceType) asIdentitySet.
aPermaLink targetObjectOrClass link: aPermaLink link toNodes: nodes
However, if the target variable slot has been defined by one of the superclasses of the object, it does not exclude the accessing nodes that are not in the object's class hierarchy (so: the nodes from methods that are in brother/cousin classes). As a result, it will try to find equivalent nodes in the anonymous subclass but these nodes do not exist so an exception NodeNotFound
is raised.
To Reproduce
- open a playground,
- run
obj := SindarinDebuggerTest new
, - Inspect the object
obj
, - Click on the object-centric icon in the inspector toolbar (at the top, icon with colored circles),
- Click on "Break on state access",
- The exception is raised.
Expected behavior
No exception should be raised, the method registerAndInstallPermaLink:forTarget:
should reject all nodes from methods that are not in the object's class hierarchy
Version information:
- Pharo Version 12, but I wouldn't be surprised if the problem has been there since the beginning
Expected development cost Easy fix, the analysis above was the hardest to do