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

Bug 353339

Summary: [1.7][content assist] constructor proposal if type not yet imported should appear before type proposals
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, eclipse, jjohnstn, mauromol
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Markus Keller CLA 2011-07-28 11:35:57 EDT
BETA_JAVA7

Content assist for constructor invocation should also allow to use diamond if the type is not yet imported.

Example:

package p;

import java.util.List;
import java.util.Map;

public class Customer {
	public static void main(String[] args) {
		Map<String, List<Customer>> map= new Hash
	}
}

Content assist after "new Hash" completes to "new HashMap<String, List<Customer>>". This is the same as in 3.7. But with Java 7, it would better complete to "new HashMap<>".

In both cases, the result is still not really satisfying, since there are no more proposals after the type has been completed and the import added.

Better solutions:
a) make constructor completion also work for not imported types
b) in this case, just add the import and insert "HashMap" without any type arguments, so that the user can just press Ctrl+Space again
Comment 1 Dani Megert CLA 2011-08-02 06:29:14 EDT
>a) make constructor completion also work for not imported types

This works, but the proposal's relevance is too low so that the types are coming before the constructor proposal.
Comment 2 Mauro Molinari CLA 2014-10-10 04:26:47 EDT
What I find really annoying when working with Java7 code is that the constructor completion is always made with the type arguments (independently whether these types and the generic type are already imported or not), so that the result is immediately marked with a warning of "Redundant specification of type arguments".

Should this deserve a new enhancement request (or does any already exist?).
Comment 3 Eclipse Genie CLA 2019-12-23 16:23:33 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.

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 4 Mauro Molinari CLA 2020-02-26 03:14:32 EST
This still applies to Eclipse 2019-12 - and it's quite annoying ;-)
Comment 5 Holger Voormann CLA 2020-03-08 20:13:46 EDT
(In reply to Mauro Molinari from comment #4)
> This still applies to Eclipse 2019-12 - and it's quite annoying ;-)

But it no longer applies to Eclipse 2020-03 RC1:
https://www.eclipse.org/downloads/packages/release/2020-03/rc1
Comment 6 Mauro Molinari CLA 2020-03-09 12:41:28 EDT
You're right, I just tried 2020-03 RC-1 and it seems like it's fixed! A small but yet very appreciated enhancement! :-)
Comment 7 Eclipse Genie CLA 2022-02-28 09:38:19 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.

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 8 Jeff Johnston CLA 2022-02-28 14:48:25 EST
Working as of 2020-03 RC1