eclipse-jdt / eclipse-jdt/eclipse.jdt.core
Search for references of a generic method gives poor results
- Dominant language
- Java
- Stars
- 237
- Forks
- 195
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 47
Description
Assume the following setup:
1. I have class `A` that implements `Consumer` (where X is a custom type)
2. I have a Consumer `C` that constructs A and then calls `A.accept(X)` somewhere
3. I have checked "filter potential matches"
4. I go to the class and right click on the `A#accept` method and choose references > workspace
Then I get (depending on whats in the workspace / target platform of course) hundreds of unrelated "references" because JDT assumes each call to `Consumer#accept` as a match regardless of the generic type `X` and regardless of the implementer `A`. Finding the interesting place where `C` calls `A` is almost impossible in the sea of "references" almost everywhere.
It would be great that in such case JDT would:
- if possible (e.g. source is available, can be read from the classfile, ...) consider the generic parameter, e.g. a Consumer.apply("A String") is obviously not a match (or would lead to CC exception).
- if type parameter is not known and not the concrete type `A#accept` is called, qualify it as a potential match so it can be filtered out. Of course an own Filter type would be fine (maybe "Generic Parameterize Unknown")
- rank results higher in the results if the actually call `A#accept`
Contributor guide
Assessment
This issue has not been assessed yet.