Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 321440

Summary: [compiler][otre] support for role-binding to interfaces
Product: [Tools] Objectteams Reporter: Stephan Herrmann <stephan.herrmann>
Component: OTJAssignee: 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:
Description Flags
First experiments
none
additional fixes
none
new diagnostic none

Description Stephan Herrmann CLA 2010-07-31 17:45:10 EDT
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.
Comment 1 Stephan Herrmann CLA 2010-07-31 18:04:59 EDT
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.
Comment 2 Stephan Herrmann CLA 2010-08-13 16:06:38 EDT
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.
Comment 3 Stephan Herrmann CLA 2010-08-27 19:01:34 EDT
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.
Comment 4 Stephan Herrmann CLA 2010-08-27 19:03:46 EDT
For callin bindings to an interface I see no short-term solution but
for the rest this feature is now ready for (careful) use.
Comment 5 Stephan Herrmann CLA 2010-09-23 12:43:36 EDT
Verified using I201009211735

This feature is heavily in use by team OTTypeHierarchies already.