Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 340795

Summary: [content assist] Better ordering on the types being proposed
Product: [Eclipse Project] JDT Reporter: Pascal Rapicault <pascal>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, deepakazad, markus.kell.r
Version: 3.6   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
screenshot of the problem
none
screenshot none

Description Pascal Rapicault CLA 2011-03-23 14:41:40 EDT
Created attachment 191780 [details]
screenshot of the problem

In the screenshot attached, I have a field whose type is known. 
When I try to create a new instance to assign it to this variable, I think the first types being proposed for completion should be those assignable to InputStream.
Comment 1 Dani Megert CLA 2011-03-24 05:08:26 EDT
This works in general. Maybe you've set the preference on Java > Editor > Content Assist to sort alphabetically? Maybe you use Mylyn which sorts differently?

Can you provide a reproducible code snippet?
Comment 2 Dani Megert CLA 2011-04-01 03:45:56 EDT
Ping.
Comment 3 Dani Megert CLA 2011-04-08 02:10:30 EDT
.
Comment 4 Deepak Azad CLA 2011-04-11 21:22:50 EDT
Created attachment 192994 [details]
screenshot

(In reply to comment #1)
> This works in general. 
hmm.. not really, see the screenshot.

--------------------------------------------
import java.io.InputStream;

class A {
	void foo() {
		InputStream is;
		is = new Byte<ctrl+space>
	}
}
--------------------------------------------

--------------------------------------------
import java.io.InputStream;

class A {
	void foo() {
		InputStream is;
		is = new File<ctrl+space>
	}
}
--------------------------------------------

In both cases the first type proposed cannot be assigned to InputStream.
Comment 5 Deepak Azad CLA 2011-04-11 21:23:46 EDT
Reopening.
Comment 6 Dani Megert CLA 2011-04-12 05:35:04 EDT
I see now. The problem was that I tried it in a class that already had some imports in that case those types are sorted on top.

Before we had constructor completion the sorting was improved using the LRU type cache but that's currently not yet implemented for the constructor proposal (see bug 261315).

That we fix the general case without LRU cache won't happen as it would be too expensive.

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