The reported bug happened when an import relationship to a package appeared in a model before the declaration of that package. The graph traversal utility traverses the model graph by following the owned relationships of elements, so, in this case, the package referenced in the import had not yet been processed when the import relationship was processed, and neither had the owning elements of the package. Unfortunately, for historical reasons, the traversal algorithm was only considering elements to have identifiers after they had been processed, which means no IDs were yet available to set the owner (and other owning...) properties of the package, causing the bug.
This pull request updates JsonElementProcessingFacade::getIdentified so that it uses the elementId of an Element, rather than looking up its identifier in the traversal. This means that the ID can be obtained before the Element is processed in the traversal, resolving the bug.
The reported bug happened when an import relationship to a package appeared in a model before the declaration of that package. The graph traversal utility traverses the model graph by following the owned relationships of elements, so, in this case, the package referenced in the import had not yet been processed when the import relationship was processed, and neither had the owning elements of the package. Unfortunately, for historical reasons, the traversal algorithm was only considering elements to have identifiers after they had been processed, which means no IDs were yet available to set the
owner
(and otherowning...
) properties of the package, causing the bug.This pull request updates
JsonElementProcessingFacade::getIdentified
so that it uses theelementId
of an Element, rather than looking up its identifier in thetraversal
. This means that the ID can be obtained before the Element is processed in thetraversal
, resolving the bug.