Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331831 - [compiler] better reporting for unresolvable tsuper call
Summary: [compiler] better reporting for unresolvable tsuper call
Status: VERIFIED FIXED
Alias: None
Product: Objectteams
Classification: Tools
Component: OTJ (show other bugs)
Version: 0.8   Edit
Hardware: Other Linux
: P3 normal (vote)
Target Milestone: 0.8 M4   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-04 07:01 EST by Stephan Herrmann CLA
Modified: 2010-12-16 15:14 EST (History)
0 users

See Also:


Attachments
fix by changed strategy (38.85 KB, patch)
2010-12-04 17:26 EST, Stephan Herrmann CLA
no flags Details | Diff
follow-up changes (3.21 KB, patch)
2010-12-05 08:34 EST, Stephan Herrmann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2010-12-04 07:01:58 EST
Currently, an unresolved tsuper call is reported as

  The method m(String) in the type T.R is not applicable for the arguments ()

This reveals that tsuper calls are internally translated into this-calls
with augmented signature, which doesn't help the user.

Additionally, if the enclosing method is a callin method an NPE may occur.
Comment 1 Stephan Herrmann CLA 2010-12-04 17:26:27 EST
Created attachment 184544 [details]
fix by changed strategy

It turned out that the old strategy of adding the tsuper marker arg 
already in the AST complicates issues like error reporting.
Therefor I changed the strategy as to add the marker arg only during
code gen. This obviously entailed several follow-up changes in areas
like ASTConverter and code selection.

Some details of this change:
- directly search method in the designated tsuper role
  (requires new hook in MessageSend.resolveType(..))
- also canBeSeenBy operates directly on the target method binding
  and needs to respect the privilege of tsuper calls (if combined
  with explicit super access)
- store the real target method in TSuperMessageSend.binding
- find the copied method only for codeGen and directly add the
  marker arg (casted null) to the codeStream.
This simplifies ProblemReporter.invalidMethod(..) because no
synthetic arg needs to be hidden any more.

This also includes some fixes regarding tsuper precedence
(see test TeamNesting.test1110_fullInheritanceStructure5[a]).

Indludes one new disabled test
AcquisitionAnd....test139_tsuperCallWithTypeParameter1()
which requires ParameterizedMethodBinding of a copyInheritanceSrc.
Comment 2 Stephan Herrmann CLA 2010-12-04 17:29:05 EST
Patch has been committed as r1122 f.
Comment 3 Stephan Herrmann CLA 2010-12-04 17:30:29 EST
(In reply to comment #0)
> Additionally, if the enclosing method is a callin method an NPE may occur.

Forgot to mention: this NPE happened because the ProblemReporter was
tweaking the details of a ProblemMethodBinding, which is no longer needed.
Comment 4 Stephan Herrmann CLA 2010-12-05 08:34:37 EST
Created attachment 184552 [details]
follow-up changes

This patch contains follow-up changes:
- revert an OT-patch in MethodLocator, methodBinding is alread the tsuper
  method now, don't navigate copyInheritanceSrc.
  (was regression in otdt...RenameVirtualMethodInClassTests)
- consistently hide the codegenBinding from clients like dom.
Comment 5 Stephan Herrmann CLA 2010-12-16 15:14:19 EST
Verified for M4 using build 201012150343

However, a FUP has been filed as bug 332790.