ST6RI-684 (update) Implement invocation delegates for operations #555
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Certain OCL operations in the specification, related to computing the imported memberships of a
Namespace
and the inherited memberships of aType
, have particularly complicated implementations. Previously, the implementation of these operations was decomposed into a number of additional methods in theNamespaceImpl
andTypeImpl
classes (and certain subclasses of those), and some of those methods called each other (rather than just calling on the methods that directly implemented the OCL operations). Part of the update in PR #554 was to move all these operations out of theImpl
classes and into the various invocation delegates implementing the specified OCL operations.However, in the implementation as approved for PR #554, the cross-calls of methods defined in different invocation delegate classes required the dynamic creation of delegate instances using the reflective
OperationInvocationDelegateFactory
mechanism, in order to properly resolve method overrides. Unfortunately, this turned out to significantly degrade performance of parsing and validation.This PR implements an alternate approach in which the additional methods in question are moved out of the invocation delegates and into corresponding adapter classes. This has the disadvantage that it couples certain invocation delegates to the adapter implementations. Nevertheless, there is a significant benefit, since overridden methods in adapter subtypes are resolved using normal Java dynamic dispatching. As a result, the performance goes back to being essentially the same as it as it was before the implementation of PR #554.