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

Bug 331831

Summary: [compiler] better reporting for unresolvable tsuper call
Product: [Tools] Objectteams Reporter: Stephan Herrmann <stephan.herrmann>
Component: OTJAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 0.8   
Target Milestone: 0.8 M4   
Hardware: Other   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
fix by changed strategy
none
follow-up changes none

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.