Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359524 - EGL Search: Delegate should not be returned by Stereotype search
Summary: EGL Search: Delegate should not be returned by Stereotype search
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Zhi Zhu CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-30 03:35 EDT by Thomas Wu CLA
Modified: 2017-02-23 14:18 EST (History)
2 users (show)

See Also:


Attachments
PI (367.14 KB, application/x-zip-compressed)
2011-09-30 03:36 EDT, Thomas Wu CLA
no flags Details
screenshot (84.33 KB, image/pjpeg)
2011-09-30 03:38 EDT, Thomas Wu CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wu CLA 2011-09-30 03:35:03 EDT
Build Identifier: 20110929

There is no Stereotype search in RBD.
Do a kind of Stereotype search, some delegate data will be returned as results. But I searched help, stereotype does not include delegate types.

Reproducible: Always

Steps to Reproduce:
1. Import PI from attatchment.
2. Select MainProject first. Go to EGL search wizard, set Search string as "*", Search for as "Stereotype", Limit To as "References", Scope as "Selected resources", then click search button.

Actual results: There are some delegate types found in search results. But from the help doc, they should not be strereotype.
Comment 1 Thomas Wu CLA 2011-09-30 03:36:08 EDT
Created attachment 204346 [details]
PI
Comment 2 Thomas Wu CLA 2011-09-30 03:38:49 EDT
Created attachment 204347 [details]
screenshot
Comment 3 Zhi Zhu CLA 2011-10-20 03:36:17 EDT
Seems Delegate is also a kind of Stereotype; Paul, can you explain this? thanks
Comment 4 Paul Harmon CLA 2011-10-20 11:55:34 EDT
While search and indexing are not really my strong points, I did spend a little while trying to understand what is going on here. I created this small testcase to demonstrate what looks like 1 problem:


delegate del1() end

externaltype prhObject type javascriptobject
    delegate1 del1?{@Property{getMethod = "getDelegate1", setMethod = "setDelegate1"}};
end

library lib1
	
	prh prhobject;
	
	function f1()
		prh.delegate1();
		lib1.f2();
	end
	
	function f2()
	end
	
end 


When i search for stereotypes, it flags the reference to prh.delegate1() as a possible match. This is because, in MatchVisitor.endVisit(FunctionInvocation), when a delegate is invoked, the code falls through to 471 (if invoking a function, this visit method returns on line 467). Because of this, it is asking the pattern (in this case a PartReferencePattern) to getMatchingLevel(). The PartReferencePattern simply checks to see if the node is a Name, and if so, it checks that name against the search string (in this case *). So the pattern believes that this is a reference to a part.

Interestingly enough, the same search result is returned if I search for ANY part type (Program, Handler, Interface, etc). These searches all return the delegate reference as a result. This is because these searches all use the same PartReferencePattern.

I think error lies in the MatchVisitor.endVisit(FunctionInvocation) method  (perhaps this should stop processing if the invocation is a delegate, since the delegate will always be a variable, and should really not be found by any search...as we do not have a variable search).
Comment 5 Zhi Zhu CLA 2011-10-20 20:40:40 EDT
Paul, thanks a lot for your comment, I will research it based on your comment
Comment 6 Zhi Zhu CLA 2011-10-25 21:59:46 EDT
fix it
Comment 7 Thomas Wu CLA 2011-10-28 02:44:37 EDT
Verified in build of 20111027