Bug 564847 - Code Mining triggered search results in wrong search results
Summary: Code Mining triggered search results in wrong search results
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.14   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2020-07-01 12:25 EDT by Lars Vogel CLA
Modified: 2020-08-06 03:58 EDT (History)
3 users (show)

See Also:


Attachments
Result (166.38 KB, image/png)
2020-07-01 12:25 EDT, Lars Vogel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2020-07-01 12:25:36 EDT
Created attachment 283474 [details]
Result

Code Mining triggered search results in wrong search results

To test:

1.) Open JavaManipulationPlugin
2.) Activate code mining
3.) Select 	public static void log(IStatus status) { method
4.) Trigger search -> Two results:

org.apache.tools.ant.taskdefs.optional.ssh.ScpFromMessageBySftp.class -> Wrong
Comment 1 Roland Grunberg CLA 2020-07-02 10:36:59 EDT
I've see similar behaviour. It does indicate it's a "potential match" though. What happens if you go into General -> Search and enable "Ignore potential matches". Are there any other clearly incorrect results ?

Looking through JavaReferenceCodeMining it looks like it will include potential mathes if that is what the preferences have configured. I think this was mainly to align with things like a call hierarchy search.
Comment 2 Roland Grunberg CLA 2020-07-21 11:59:09 EDT
@Lars. Any additional info here, or can it be closed ? Code minings does respect the setting on that "ignore potential matches" checkbox.
Comment 3 Roland Grunberg CLA 2020-07-27 15:19:54 EDT
Marking as CLOSED (WORKSFORME) for now. If I've misunderstood the issue, or another such reference comes up that is clearly wrong and not marked as "potential match", then feel free to re-open.
Comment 4 Lars Vogel CLA 2020-07-27 16:22:02 EDT
Thanks Roland, indeed the search results seem identical and if I remove this setting things behave more to my expectations.
Comment 5 Lars Vogel CLA 2020-08-05 08:06:30 EDT
The Open Call Hierarchy results in a different result if "Ignore potential matches" is not flagged.

Code minings shows x matches
Select  method and call "Open Call Hierarchy" -> results in no hits for unused method

Is that correct?

If I set the "Ignore potential matches" flag both are correct, e.g. zero.

Is this a bug in "Open Call Hierarchy"?
Comment 6 Roland Grunberg CLA 2020-08-05 13:29:41 EDT
I think https://bugs.eclipse.org/bugs/show_bug.cgi?id=543289#c4 still applies here, in that call hierarchy results might be a bit different. The closest thing to code mining references on a symbol, would be performing a workspace search for references of the same symbol (CTRL + SHIFT + G). So if those 2 are the same then we should be fine.

For example, call hierarchy certainly wouldn't catch javadoc references but code mining and workspace references do.
Comment 7 Lars Vogel CLA 2020-08-06 03:58:03 EDT
Thanks Roland for the explanation. Makes sense.