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

Bug 332790

Summary: [search] search doesn't find tsuper method calls
Product: [Tools] Objectteams Reporter: Stephan Herrmann <stephan.herrmann>
Component: OTDTAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 0.8   
Target Milestone: 0.8 M7   
Hardware: Other   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
test & proposed fix
none
additional tests & fix none

Description Stephan Herrmann CLA 2010-12-16 15:12:17 EST
public team class SuperTeam {
	protected class R {
		void bar(int j) {}
	}	
}

public team class SubTeam extends SuperTeam {
	@Override
	protected class R {
		void bar(int j) {
			tsuper.bar(3);
		}
	}
}

Searching for references to SuperTeam.R.bar does not find the tsuper call
in SubTeam.R.bar, nor does the call-hierarchy show this call.

(FUP of bug 331831).
Comment 1 Stephan Herrmann CLA 2011-04-16 18:36:06 EDT
Created attachment 193427 [details]
test & proposed fix

The indexer did not record any tsuper method calls.
Fixed by adding overrides to SourceElementParser that record method references
for tsuper and base in analogy to super.

Also contained: receiver type comparison was wrong for tsuper-calls, which 
mimic this-calls (for codegen) but semantically are more like super-calls.
Without this fix test031 was now reporting too many occurrences.
Comment 2 Stephan Herrmann CLA 2011-04-16 18:39:18 EDT
Committed as r1438,9.
Comment 3 Stephan Herrmann CLA 2011-04-16 18:44:51 EDT
.
Comment 4 Stephan Herrmann CLA 2011-04-28 16:01:11 EDT
While verifying I found that tsuper calls are now even found when searching
for the tsub method. So in the given example searching for references to
  SubTeam.R.bar(int)
would actually find the tsuper call within this very method, which is wrong.
Comment 5 Stephan Herrmann CLA 2011-04-28 16:35:18 EDT
Created attachment 194316 [details]
additional tests & fix

Additional tests witnessing the issue from comment 4.
Note that tests need to create their pattern from java elements because the issue
was caused by our work in http://trac.objectteams.org/ot/ticket/48
where we intentionally blank out the pattern's declaringQualification.

Fixed by retrieving that lost qualification when resolving a non-virtual reference.
Comment 6 Stephan Herrmann CLA 2011-04-28 16:36:36 EDT
Additional test & fix committed as r1464
Comment 7 Stephan Herrmann CLA 2011-04-29 15:18:24 EDT
The additional fix has passed all tests.
Comment 8 Stephan Herrmann CLA 2011-04-29 15:19:12 EDT
Verified for 0.8M7 using build 201104281905