Bug 276890 - [content assist] proposes nothing for generic type with non-trivial constructor
Summary: [content assist] proposes nothing for generic type with non-trivial constructor
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 RC2   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-19 09:41 EDT by Markus Keller CLA
Modified: 2009-05-21 04:54 EDT (History)
2 users (show)

See Also:
Olivier_Thomann: review+
kent_johnson: review+


Attachments
Proposed patch (10.94 KB, patch)
2009-05-20 09:18 EDT, David Audel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2009-05-19 09:41:15 EDT
I20090518-2000

Constructor completion does not work for constructor with parameter in generic type from another package

To reproduce, invoke content assist after 'new Stu'. I only get a proposal for the no-arg constructor. Same problem if class Stuff is abstract.

Works fine if a.Stuff is already imported or is in the same package.


//---------

package p;

public class C {
	public static void main(String[] args) {
		new Stu
	}
}

//---------

package a;

import java.util.List;

public class Stuff<E> {
	public Stuff(E e) {}
//	public Stuff(Object o) {}
//	public Stuff(List<E> ees) {}
//	public Stuff() {} // only this one works
}
Comment 1 Dani Megert CLA 2009-05-19 09:46:43 EDT
Nothing coming back from completion engine.
Comment 2 David Audel CLA 2009-05-20 09:18:56 EDT
Created attachment 136486 [details]
Proposed patch

When the constructor has parameters, CompletionEngine#getResolvedSignature() computes the binding of the declaring type from the type name.
If the type is generic then a RawTypeBinding is computed and getResolvedSignature() assumed that this binding was a SourceTypeBinding.
The erasure of the computed binding must be used instead.
Comment 3 David Audel CLA 2009-05-20 09:51:17 EDT
Olivier, could review the patch ?
Comment 4 David Audel CLA 2009-05-20 09:54:59 EDT
Kent, could you review the patch ?
Comment 5 Olivier Thomann CLA 2009-05-20 10:24:38 EDT
+1. Patch looks good.
Comment 6 David Audel CLA 2009-05-20 10:43:31 EDT
Released for 3.5RC2.

Tests added
  CompletionTests2#testBug276890_01() -> testBug276890_03()
Comment 7 Dani Megert CLA 2009-05-21 04:54:57 EDT
Verified in I20090520-2000.