Bug 100009 - [assist] Content assist uses generic parameter name arg0 instead of real name
Summary: [assist] Content assist uses generic parameter name arg0 instead of real name
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 RC4   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-14 12:40 EDT by Markus Keller CLA
Modified: 2005-06-24 07:44 EDT (History)
4 users (show)

See Also:


Attachments
Proposed patch (10.22 KB, text/plain)
2005-06-21 07:05 EDT, David Audel CLA
no flags Details
Proposed patch (8.88 KB, text/plain)
2005-06-21 11:39 EDT, David Audel CLA
no flags Details
Proposed patch (14.68 KB, text/plain)
2005-06-21 14:26 EDT, David Audel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2005-06-14 12:40:03 EDT
I20050610-1757 (3.1RC2)

class MyArrayList extends ArrayList<Integer> {
	void m() {
		adda //<-- (1) content assist proposes
		     // addAll(Collection<? extends Integer> arg0)
	}
	// <-- (2) content assist proposes add(int arg0, Integer arg1) 
}

- normal code completion like in (1) shows arg0 in the proposal label and also
inserts it into the code when parameter guessing is enabled

- content assist for method overriding like in (2) shows arg0 in the proposal
label, but inserts correct method stubs (with 'index' and 'element', etc.).
Comment 1 Dani Megert CLA 2005-06-14 18:02:01 EDT
Tom, please investigate.
Comment 2 Tom Hofmann CLA 2005-06-15 02:40:08 EDT
We call CompletionProposal.getParameterNames() which fails to retrieve the names.

Debugging it reveals that a JME is thrown at
InternalCompletionProposal.findMethodParameterNames (R1.5: line 193) because the
constructed method does not exist.

Moving to core
Comment 3 David Audel CLA 2005-06-15 07:39:18 EDT
InternalCompletionProposal.findMethodParameterNames() try to find parameter
names inside the Java Model. But findMethodParameterNames() create this method
handle 'addAll(Collection)' instead of 'addAll(Collection<? extends E>)'.
Comment 4 David Audel CLA 2005-06-21 07:05:10 EDT
Created attachment 23604 [details]
Proposed patch

This fix should be correct but has not been tested
Comment 5 Jerome Lanneluc CLA 2005-06-21 07:08:15 EDT
*** Bug 100982 has been marked as a duplicate of this bug. ***
Comment 6 David Audel CLA 2005-06-21 09:10:30 EDT
bug 100982 is not a duplicate
Comment 7 Philipe Mulet CLA 2005-06-21 09:33:48 EDT
Providing testing is successful, we may want to candidate it for RC4 since not
having it means basically argument names are always arg0...argN when dealing
with generics.
Comment 8 Philipe Mulet CLA 2005-06-21 11:16:48 EDT
Dirk/Dani - pls cast your vote
Comment 9 Philipe Mulet CLA 2005-06-21 11:17:14 EDT
Jerome - pls review the change
Comment 10 David Audel CLA 2005-06-21 11:39:16 EDT
Created attachment 23635 [details]
Proposed patch

Better patch
Comment 11 Jerome Lanneluc CLA 2005-06-21 11:47:24 EDT
(In reply to comment #10)
> Created an attachment (id=23635) [edit]
> Proposed patch
> 
> Better patch

Reviewed patch. It looks good.
Comment 12 Dani Megert CLA 2005-06-21 12:02:06 EDT
+1 for 3.1 RC4.
Comment 13 Dirk Baeumer CLA 2005-06-21 13:12:53 EDT
+1 for RC4.
Comment 14 David Audel CLA 2005-06-21 14:26:33 EDT
Created attachment 23653 [details]
Proposed patch

More secure patch

Add propection for invalid signature
Keep the old way to compute the fully qualified declaration type name (tName)
Comment 15 Jerome Lanneluc CLA 2005-06-22 09:02:23 EDT
Yes, this patch is safer.
Just a little typo: createDefaultParamterNames(int) should be
createDefaultParameterNames(int)
Comment 16 David Audel CLA 2005-06-22 09:21:02 EDT
Patch released and test added
  CompletionTests_1_5#test0244()

Typo corrected
Comment 17 Maxime Daniel CLA 2005-06-24 07:14:05 EDT
Verified for Build id: I20050624-0010.
Comment 18 Olivier Thomann CLA 2005-06-24 07:44:11 EDT
Verified.