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

Bug 142615

Summary: [quick fix] guess type parameter from usage
Product: [Eclipse Project] JDT Reporter: Larry Edelstein <ribs>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: eclipse
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Larry Edelstein CLA 2006-05-18 16:05:40 EDT
If you type an invocation like "listeners.add(listener)" and you don't have a "listeners" variable, content assist is smart enough to guess that "listeners" should be a collection, and will create a Set for you, which is nice.  However, it seems to use the (top-most) enclosing class type as the type argument for the Set, but it should use the type of the parameter in the invocation.  For example, if you typed this:

class Foo {
   public void addListener(FooListener listener) {
      listeners.add(listener);
   }
}

...the compiler would flag "listeners" as an error, and content assist would offer to create 

Set<Foo> listeners;

instead of 

Set<FooListener> listeners;

That's all.
Comment 1 Olivier Thomann CLA 2006-05-18 16:12:52 EDT
Move to JDT/UI
Comment 2 Tom Hofmann CLA 2006-05-19 10:46:30 EDT
The feature that provides the error resolution is not content assist, but quick fix. Moving back to jdt-ui.
Comment 3 Eclipse Genie CLA 2020-01-16 17:44:23 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. As such, we're closing this bug.

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