Bug 519038 - [content assist] Inconsistent ordering of argument proposals
Summary: [content assist] Inconsistent ordering of argument proposals
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.7   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-30 09:43 EDT by Johannes Dorn CLA
Modified: 2022-08-11 14:50 EDT (History)
3 users (show)

See Also:


Attachments
Screenshot (111.54 KB, image/png)
2017-06-30 09:59 EDT, Noopur Gupta CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Dorn CLA 2017-06-30 09:43:41 EDT
Minimal scenario

public class Test {

    public void m1(Set<String> a) {
        Set<String> b = // trigger content assist here
    }
    
    public void m2(Collection<String> a) {
        Collection<String> b = // trigger content assist here
    }
}

Trigger content assist at the specified locations.

In the first location, the first proposal is for the argument "a", which is what I expect.
In the second location the first proposal is for Collection<java.lang.String> which is not useful. "a" is the second proposal here.

A couple of notes:
1. Commenting out one of the methods doesn't change the content assist proposal for the other, so it's not a confusion due to a second compile error.

2. Code Recommenders is disabled and thus not involved.

3. This came from Stackoverflow initially: https://stackoverflow.com/questions/44093019/eclipse-content-assist-with-custom-types#comment76670521_44093019

4. I can reproduce this in Oxygen and Neon.3
Comment 1 Noopur Gupta CLA 2017-06-30 09:59:24 EDT
Created attachment 269147 [details]
Screenshot

I cannot reproduce it with the plain Eclipse 4.7 release build with default preferences in a new workspace. See attached screenshot. Please provide steps to reproduce it with the 4.7 build downloaded from:
http://download.eclipse.org/eclipse/downloads/drops4/R-4.7-201706120950/
Comment 2 Johannes Dorn CLA 2017-06-30 10:06:40 EDT
(In reply to Noopur Gupta from comment #1)
> Created attachment 269147 [details]
> Screenshot
> 
> I cannot reproduce it with the plain Eclipse 4.7 release build with default
> preferences in a new workspace. See attached screenshot. Please provide
> steps to reproduce it with the 4.7 build downloaded from:
> http://download.eclipse.org/eclipse/downloads/drops4/R-4.7-201706120950/

I can't reproduce this in a fresh workspace. Could the presence of other classes/projects affect this behaviour?
Comment 3 Casper Færgemand CLA 2017-07-11 23:57:35 EDT
I did a clean install of Oxygen and I cannot reproduce it there for variables of custom types:

class T {}
void test(T a) {
	T b = // a is suggested.
}

As for Johannes' example, I get the same buggy behavior is both cases, in a clean project after a clean install.

I did some tinkering, trying the different proposal kinds, and it turned out Java Proposals (Code Recommenders) (with Templates disabled) can be made to work: Under Code Recommenders > Completions, I disabled all the options. With none active I get the variable at the top, with the class much further down. If I enable Base-Relevance Processor, the class immediately takes priority, except if the class is defined in the same project, then I get still get the variable at the top.

While testing, and before disabling all the completions, a few times I did get the variable suggested at the top. Writing a little more code made it revert to the class. Deleting the new code did not bring back the variable.
Comment 4 Casper Færgemand CLA 2017-07-12 00:36:10 EDT
It would appear I was too hasty. Restarting Eclipse reset the Session Processors to all be active, and even when deactivated, the ordering of suggestions was messed up, with the variable not on top. The workaround did not work.
Comment 5 Eclipse Genie CLA 2020-06-26 10:05:30 EDT
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.

If you have further information on the current state of the bug, please add it. 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.
Comment 6 Eclipse Genie CLA 2022-08-11 14:50:24 EDT
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.

If you have further information on the current state of the bug, please add it. 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.