| Summary: | [9] Need to signal when tsuper() ctor call is needed to initialize fields | ||
|---|---|---|---|
| Product: | [Tools] Objectteams | Reporter: | Stephan Herrmann <stephan.herrmann> |
| Component: | OTJ | Assignee: | Stephan Herrmann <stephan.herrmann> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 2.6 | ||
| Target Milestone: | 2.7.1 | ||
| Hardware: | All | ||
| OS: | All | ||
| See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=569756 | ||
| Whiteboard: | |||
|
Description
Stephan Herrmann
Bulk move to 2.8 While working on this I detected two additional issues: Explicit lifting constructors lacking generated role registration statements, leaving this._OT$base unassigned. The default constructor in a role with implicit super is unfortunate: if nothing is written it would be nice if tsuper() is assumed, but a regular super() is used instead. Changing this at this point would, however, be a breaking change so I will not make such change. This was implemented for via http://git.eclipse.org/c/objectteams/org.eclipse.objectteams.git/commit/?id=b8c129fe8b89a7c02820ac64e0611d79ef5804f3 http://git.eclipse.org/c/objectteams/org.eclipse.objectteams.git/commit/?id=ad95e6e0922d7db93f1919b4a95783afdff94ee8 Solution description: - new IProblem: RoleConstructorNeedingTSuperCall message is: Need to invoke a tsuper constructor because tsuper role ''{0}'' has field initializations. - new bit in OTClassFlags attribute: OT_CLASS_HAS_FIELD_INITS needed to transport info about field initializers via .class - fix Lifting.createLiftToConstructorDeclaration(): (needed for ImplicitInheritance.testFieldInitialization5_bound_NOK()) Don't replace explicit super() in lifting constructor with tsuper(). - fix Lifting.isLiftingCtor(MethodBinding Need to recognize lifting ctor also in its tsuper shape. - test adjustments: - add mandatory tsuper() - CallinMethodBinding.test4112_callinBindingMultipleBaseMethods2(): avoid conclict in sub's lifting constructor: if we'd add the mandatory tsuper() call, runtime throws: org.objectteams.IllegalRoleCreationException: Cannot instantiate a bound role using a default constructor of its tsuper class at Team4112cbmbm2_2$__OT__Role4112cbmbm2.<init>(Team4112cbmbm2_2.java:3) at Team4112cbmbm2_2$__OT__Role4112cbmbm2.<init>(Team4112cbmbm2_2.java:4) at Team4112cbmbm2_2._OT$liftTo$Role4112cbmbm2(Team4112cbmbm2_2.java:3) TODO: check how the compiler could catch this! |