Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 350566 - [5.0][search] search for references to parameterized type ignores type parameter
Summary: [5.0][search] search for references to parameterized type ignores type parameter
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-28 08:39 EDT by Stephan Herrmann CLA
Modified: 2020-02-25 03:54 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2011-06-28 08:39:33 EDT
Given a class X<T> the Java search dialog lets me search for references 
to type "X<String>", but the search result includes all references to X 
regardless their actual type parameters.

Is this a feature, a UI bug, a Core bug?
Comment 1 Deepak Azad CLA 2011-06-28 08:47:31 EDT
> Is this a feature, a UI bug, a Core bug?
I think this is a Core bug/feature :) Satyam ?
Comment 2 Satyam Kandula CLA 2011-06-28 12:22:38 EDT
JDT/Core search returns all matches but sets the rule flag. The rule flag is set to Exact when there is an exact match and set to Erasure when the type parameter doesn't match.
JDT/UI should probably provide a way to filter the Erasure types.
Comment 3 Deepak Azad CLA 2011-10-19 00:10:30 EDT
Yeah, it does not make much sense to show all matches while searching for X<String>. But we should probably show all matches while searching for X<T>, where T is the type parameter used in the type declaration. Not sure if doing the two things is possible.
Comment 4 Steven Willis CLA 2016-09-29 12:02:48 EDT
So I just ran into this problem. I wanted to search for all methods returning a "List<MyClass>". So I selected the "Method" search type, and used the search pattern: "* List<MyClass>". But the results were for methods that returned any type of List.

I also tried the "Type" search type, and under "Match locations" selected "Method return types", and used the pattern: "List<MyClass>". I got the same result, all methods that returned any type of List, not just those that were specifically "MyClass".

This seems like a large bug. The "Java Search Tab" help even specifically gives the example of "List<String>" for a type pattern.

I don't think you'd need or want to have "X<T>" show all generic matches, the match patterns already have wildcards, and you could just do "X" by itself if you wanted all matches.

I opened this stackoverflow before realizing that this was already a bug:

http://stackoverflow.com/questions/39754974/how-to-search-for-methods-that-return-a-list-of-a-specific-class-in-eclipse
Comment 5 Eclipse Genie CLA 2020-02-25 03:54:31 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.