Community
Participate
Working Groups
I am attaching the workspace to reproduce the problem (I have been unable to reproduce this with a fresh workspace.) Steps: 1. Use the attached workspace 2. Ctrl+H, search for 'Worker.run()', Declarations, and all 4 Search In options selected, Scope=workspace 3. A number of 'run()' methods are returned which are not in 'Worker' type (I will attach a screenshot)
Created attachment 177865 [details] workspace
Created attachment 177866 [details] search results
Satyam, please follow up.
Created attachment 177870 [details] proposed partial fix The problem seems to be in org.eclipse.jdt.internal.core.search.matching.MethodLocator.resolveLevelAsSubtype(...). In org.eclipse.jdt.internal.core.search.matching.PatternLocator.resolveLevelForType(char[], TypeBinding) there is a check for invalid type binding, and I think the same check should be made in resolveLevelAsSubtype as well. If the type binding in not valid (for me it was MissingTypeBinding) then the following check in line 685 is invalid : || !type.isAbstract()) && !type.isInterface()) (Also I do not know why the type binding was invalid) The patch does not fix the problem completely, there were still some incorrect results with this patch. I tried to fix it but I did not understand the use of *_FLAVOR constants here...
argh.. forgot the build ID I20100824-1210
Created attachment 177939 [details] Patch to test Deepak, I couldn't get any bad results with your workspace, but I understand the problem. Though I got one junit testcase, I want you to try out the attached patch. This patch doesn't include the changes you have proposed but does include the fix similar to the one you have proposed in our discussion - don't include the match flavors while comparing the match levels. Please try out this attached patch and let me know how it goes.
(In reply to comment #6) > Created an attachment (id=177939) [details] [diff] > Patch to test +1 With this patch all the results where type binding is missing are correctly marked as potential matches.
Simple test case ######## public class Test extends MissingType{ public void foo() { } } ####### Search for method declarations of Worker.foo() reports Test.foo() as Exact Match. This should have been a potential match.
Created attachment 178026 [details] Patch on Head Patch with minor correction
(In reply to comment #8) > Simple test case > ######## > public class Test extends MissingType{ > public void foo() { > } > } > ####### > Search for method declarations of Worker.foo() reports Test.foo() as Exact > Match. This should have been a potential match. Ah yes, this is a much simpler way to reproduce the problem :) But I wonder why the type bindings were missing in my workspace - There were no errors and I had tried clean build as well. Satyam, could the type bindings be missing only for search ?
(In reply to comment #4) > > The patch does not fix the problem completely, there were still some incorrect > results with this patch. I tried to fix it but I did not understand the use of > *_FLAVOR constants here... The OVERRIDDEN_METHOD_FLAVOR was set to store the fact that if a match was found during sub-types resolution it was in an overridden method. There's currently no API to exhibit this peculiar piece of information but I let it there in case someone made a request for it in the future...
Released in HEAD
(In reply to comment #10) > Ah yes, this is a much simpler way to reproduce the problem :) But I wonder why > the type bindings were missing in my workspace - There were no errors and I had > tried clean build as well. Satyam, could the type bindings be missing only for > search ? The references you were getting should be for those jar whose dependents may not be present. Hence, there is a possibility of running into this problem.
(In reply to comment #13) > The references you were getting should be for those jar whose dependents may > not be present. Hence, there is a possibility of running into this problem. Hmm ok.I will keep an eye out for this. Thanks for the fix!
Verified for 3.7M2 using build I20100909-1700.
This special cases looks fixed but the general bug of reporting too many matches is still open, see bug 324189.