| Summary: | [otjld] [compiler] Support the "Internal Role" pattern | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 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: |
|
||||||||||
|
Description
Stephan Herrmann
While working on this and turning test212_boundToRelatedClass3() into a positive test I noticed that callout transformation failed, because of a compile order problem: - establishMethodMappingsResolved(RoleModel role) requires that the baseclass has STATE_MAPPINGS_TRANSFORMED - if baseclass is an enclosing, it is not ready for mapping transformation because it is currently busy resolving those mappings. This appears to be a special instance of the compiler order issue from bug 318084. Created attachment 173878 [details]
proposed implementation
* new diagnostics:
- make errors baseclassCircularity/playedByEnclosing configurable (core only)
- token = "baseclasscycle", def=warn
- tag roles as _playedByEnclosing as precond for next two errors:
- new errors: BaseAllocationDespiteBaseclassCycle, CalloutToEnclosing
* improve detection of baseclass circularity:
- also consider supers of enclosings (see test212_boundToRelatedClass5)
* avoid compile order problem by skipping
ensureBindingState(baseclass, STATE_MAPPINGS_TRANSFORMED)
when _playedByEnclosing was detected
* more and changed tests (not part of the patch)
- new errors (test212_boundToRelatedClass3, test214_boundToRelatedTeam1)
- new positive case (test212_boundToRelatedClass4)
- bound to super of enclosing team (test212_boundToRelatedClass5)
- indirect baseclass circularity (test212_boundToRelatedClass6)
- simulate original inf.recursion with direct outer-call instead of callout
(test214_boundToRelatedTeam2)
- challenge configuring "baseclasscycle" (ERROR, suppress - several tests)
Patch has been committed as r570, r571. Since callout in affected roles is now an error anyway, the dependency to bug 318084 no longer exists. Created attachment 173901 [details]
additional patch
This patch fixes an NPE in the initial implementation.
Created attachment 173918 [details]
ui-part
Implementation of UI-configurability for new warning token "baseclasscycle".
Verified using I201009211735 |