| Summary: | [compiler][otre] support for role-binding to interfaces | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] Objectteams | Reporter: | Stephan Herrmann <stephan.herrmann> | ||||||||
| Component: | OTJ | Assignee: | Stephan Herrmann <stephan.herrmann> | ||||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||||
| Severity: | enhancement | ||||||||||
| Priority: | P3 | Keywords: | noteworthy | ||||||||
| Version: | 0.7 | ||||||||||
| Target Milestone: | 0.7.1 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Linux | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
Created attachment 175657 [details]
First experiments
This patch contains some quick but already successful experiments:
* make 'playedBy interface' a warning instead of an error
* in CallinRoleBaseBindings attribute mark interface with a leading '^'
OTRE part:
* store isInterface flag from above '^' in BoundClass record
* add superInterface IBoundBase also for base interfaces
* add base-class infrastructure methods to sub-bases iff the bound base parent is an interface
With these changes some tests already pass: test213_boundToInterface_1 -
test213_boundToInterface_3, the latter already including a callout to the
bound interface type. At this point it is still necessary to provide
specific bindings for classes implementing the base interface.
Created attachment 176584 [details]
additional fixes
The OTRE generally assumed that a base class with a bound super base
does not require adding callin infrastructure. However, if the bound
super base is an interface this assumption is wrong.
Witnessed by test213_boundToInterface_4() and fixed by the attached patch.
Created attachment 177657 [details]
new diagnostic
This patch adds an error for callin bindings in a role bound to a
base interface, and updates the wording of the primary warning.
For callin bindings to an interface I see no short-term solution but for the rest this feature is now ready for (careful) use. Verified using I201009211735 This feature is heavily in use by team OTTypeHierarchies already. |
We have been planing to support binding a role to a base interface for a long time. I can see different levels of difficulty: (1) role binds to an interface but has no method bindings (2) role has only callout bindings (note that decapsulation is not an issue since interfaces have no privates) (3) role has callin bindings Rather than waiting for the complete solution I'm starting to implement this for situations that don't require big changes in the OTRE: (1) is actually easy, (2) looks be straight-forward, too. Another question is, how bindings will be propagated into classes implementing the base interface. Easy solution: require explicit sub-roles explicitly bound to those base classes. Compiler messages should inform the user, whether a particular role and its bindings are safe.