Bug 363337 - Code completion should prefer methods with the correct return type
Summary: Code completion should prefer methods with the correct return type
Status: CLOSED DUPLICATE of bug 384443
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Recommenders (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Marcel Bruch CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2011-11-09 10:54 EST by Lars Vogel CLA
Modified: 2019-07-24 14:36 EDT (History)
3 users (show)

See Also:


Attachments
Current behavior (209.93 KB, image/png)
2011-11-09 10:55 EST, 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 2011-11-09 10:54:48 EST
A nice improvement in JDT would be if the methods would be sorted by fitting return type. 

For example

String s=txt.CTRL+Space -> all methods which return String first, like getText()

Ideally the type hierachy would also be considered, e.g. if something is a supertype of the return type it should have priority to not fitting types. 

Improvement to Code Rec. would be if you could sort the methods by return type, e.g. String s=txt.CTRL+Space -> String first
Comment 1 Lars Vogel CLA 2011-11-09 10:55:12 EST
Created attachment 206707 [details]
Current behavior
Comment 2 Lars Vogel CLA 2011-11-09 13:42:09 EST
I think the current JDT does actually sort already by exact matches.... So maybe an extension would be to use hierachy or chains (the return type of a method does not fit but a sub-method)
Comment 3 Marcel Bruch CLA 2011-11-09 15:23:32 EST
We currently rely in the the scoring system of JDT, i.e., for ranking proposals we use "JDT's proposal relevance + our probability". While perfect matches are already covered by JDT (and thus implicitly by in Code Recommenders too), it seems reasonable to perform an "is assignable" check to further improve the probability/score of a proposal.

We are currently redesigning some internal APIs for extensions of Queens University and McGill University. Afterwards, we'll evaluate how costly supertype checking is and decide how/whether to implement this.

We also welcome contributions for this feature.
Comment 4 Marcel Bruch CLA 2012-08-19 07:28:08 EDT
(In reply to comment #3)
> Afterwards, we'll evaluate how costly
> supertype checking is and decide how/whether to implement this.

*very* costly. This feature cannot be implemented using JDT means.

marking this one as duplicate of Bug 384443 as they basically request the same feature. let's track this in one bug report.

*** This bug has been marked as a duplicate of bug 384443 ***