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

Bug 316616

Summary: [compiler][otre] OT/J: support for callin-interception of constructor-calls
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: 1.4   
Target Milestone: 2.2 RC1   
Hardware: PC   
OS: Linux   
Whiteboard: trac

Description Stephan Herrmann CLA 2010-06-11 10:19:16 EDT
(originally from http://trac.objectteams.org/ot/ticket/184)
Just to put this on our long-term radar.

Besides basic method interception there are several cases where a constructor call needs to be intercepted by a callin directly.

(comment:1)
We need to carefully distinguish here:

  * after callins to a constructor are feasible with only some changes even in 
    the current implementation, because the additional dispatch code can be 
    inserted to the end of a constructor (about remaining differences /
    difficulties see below).
  * before and replace callins to a constructor would have to happen at the 
    call site => not further investigating since we don't do call-site-weaving.

Remaining difficulties for after:
  * We cannot use the pattern of initial-wrapper, orig-method, chaining-
    wrapper, because the original constructor cannot be renamed, and any 
    chaining of constructors would need to happen before any additional code is 
    executed. A probable solution:
    o inline the lookup of active teams (normally done in the initial wrapper) 
      into the end of the constructor.
    o generate a chaining wrapper containing only calls to after callins. 
  * It will have to be checked, whether this proposed pattern solves all issues 
    of inheritance in the same way as the normal callin implementation does. 

---
(above descriptions partly updated wrt the original trac issue).

Question: why would a chaining wrapper be needed when only calling
after bindings?
Comment 1 Stephan Herrmann CLA 2013-05-19 19:06:42 EDT
Support for callin-after to constructor has been released for 2.2 RC1 via
commit 12a20748e9e180d0cb9ed70d2f88cf8f1c309085.

A first application can already be found in the fix for bug 408460.
Comment 2 Stephan Herrmann CLA 2013-06-06 14:10:07 EDT
Verified for 2.2 using build 201306040500