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

Bug 372709

Summary: [search] Find References in Workspace is unreliable
Product: [Eclipse Project] JDT Reporter: Thomas Nagel <thomas.nagel>
Component: CoreAssignee: Manoj N Palat <manoj.palat>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, bugs.eclipse.org, jarthana, manoj.palat
Version: 3.8   
Target Milestone: 4.6 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Thomas Nagel CLA 2012-02-28 04:03:43 EST
Build Identifier: Eclipse IDE for Java Developers  Version: Indigo Release Build id: 20110615-0604

The result of "find references -> in workspace" is unreliable. 
It could be depending on wether the last build was successful or was aborted.
Does the search use the compiler output? It does not tell so but leaves space for guessing. 

Reproducible: Sometimes

Steps to Reproduce:
1. create a workspace with several projects with usage between them
2. show a class that is referenced from outside the containing project
3. select an externally referenced method
4. select "Search" -> "References" -> "Workspace" and see wether they are complete
Comment 1 Ayushman Jain CLA 2012-02-28 04:27:36 EST
(In reply to comment #0)
Hi Thomas,

Can you please provide a reproducible test case? Or if possible, your workspace where you can see the problem?
It may be a bug in some case, but find references is not reliable otherwise. :)
Comment 2 Ayushman Jain CLA 2012-02-28 04:30:39 EST
(In reply to comment #1)
> It may be a bug in some case, but find references is not reliable otherwise. :)

I meant find references is not *unreliable*, ofcourse!  :D
Comment 3 Thomas Nagel CLA 2012-02-28 04:37:42 EST
my current workarea has about 1,4 GB and ~27.500 files in 2140 folders, i doubt very much it would really help to upload it somewhere.

and i didn't say search reference was unreliable generall, but it seems unpredictable when searching in a workspace with many projects.
Comment 4 Ayushman Jain CLA 2012-02-29 01:12:31 EST
(In reply to comment #3)
> my current workarea has about 1,4 GB and ~27.500 files in 2140 folders, i doubt
> very much it would really help to upload it somewhere.
In that case we do need some place to start investigating. So perhaps you can look at a particular code pattern thats causing the bug and try in a small snippet. Or, if there's anything else peculiar, such as any compiler errors, please let us know
Comment 5 Satyam Kandula CLA 2012-03-05 01:00:17 EST
Thomas, 
As Ayushman had mentioned, we need more details to understand the problem. 

The search does use the 'compiler parser' for parsing the file. It also looks at the 'build state' to find out the projects to be searched. Apart from these it shouldn't be using any compiler output. If you could give some instances of the places where you cannot see the references, that may help. 

To rule out any problems because of the usage of 'build state' you could try the search after turning off 'Build Automatically'. If there are more search results with this, there could be a problem with the way we are using the 'build state'.
Comment 6 Steffen Heil CLA 2015-10-08 03:28:12 EDT
I think I ran into the same or at least an related issue.
If I search for "References / Project", I get 4 invokations, however, if I search for "References / Workspace", I get NONE.

The problem is, it is really hard to create a test case, because out of 400.000 lines, I only know one method where this problem persists reliable.

Completely recreating the workspace on another computer did not solve that, neither did a clean / rebuild or anything else we tried.

Sadly the method is in the middle of several interaction classes and it is not easy to strip it down to a testcase.

But maybe the information that there is a difference between Workspace / Project searches helps.

However, as this ticket is rather old, I have a very different system configuration:
- Windows 10 64bit
- Java 1.8.0.31 64bit
- Eclipse 4.5.0.I20150603-2000 (64bit)
- Eclipse Java Development Tools 3.11.0.v20150603-2000

I am still trying to create a testcase, but I am not sure, I can provide one.
Comment 7 Steffen Heil CLA 2015-10-08 04:01:08 EDT
Reducing the source to a test case is even more complicated:

I narrowed it down to 2 projects A and B.

A depends on B.

The method I cannot find invocations for is in B.
If I search for References/Workspace for the method in B is find nothing.
However if I close A, then I find invocations in B.

So I opened A again and deleted anything seemingly unrelated. The problem stayed: I cound not find anything searching References/Workspace on the method in B. Then I closed A and of course I got hits in B. But when I opened A again, these matches stayed...? (With the reduced A.)

So I cannot really reduce the code and reliably (after closing and opening the project A) keep the bug.

I don't know what else I can do to to create a testcase.
I cannot supply the source of both projects. Reducing it removes the problem (at least after closing and opening the project again).

I could provide VNC access to my system. But that probably won't help?
Comment 8 Manoj N Palat CLA 2015-10-08 04:24:56 EDT
(In reply to Steffen Heil from comment #7)
> Reducing the source to a test case is even more complicated:
> 
Thanks for the info Steffen. I am suspecting that one issue could be the issue raised in bug 469320, the fix of which has gone in the versions of 4.5.1 and 4.6 M1. Could you please try out one of these builds and let us know. Thanks.
Comment 9 Steffen Heil CLA 2015-10-08 06:04:02 EDT
Great! This issue is gone for me with 4.5.1.
Usually I fully update before reporting a bug, but in this case I missed the release of 4.5.1.

Sorry.
Comment 10 Manoj N Palat CLA 2015-10-08 06:16:42 EDT
(In reply to Steffen Heil from comment #9)
> Great! This issue is gone for me with 4.5.1.

Good to hear that and thanks Steffen for the immediate confirmation. 
Will close this as duplicate of bug 469320

*** This bug has been marked as a duplicate of bug 469320 ***
Comment 11 Jay Arthanareeswaran CLA 2015-10-27 12:43:09 EDT
Verified for 4.6 M3 with build I20151026-2000.