Bug 95829 - [assist] toArray proposed twice
Summary: [assist] toArray proposed twice
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.2 RC2   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-18 15:07 EDT by Tom Hofmann CLA
Modified: 2006-04-27 22:44 EDT (History)
3 users (show)

See Also:


Attachments
Proposed fix (3.11 KB, patch)
2006-04-19 11:29 EDT, David Audel CLA
no flags Details | Diff
Better fix (4.83 KB, patch)
2006-04-21 11:47 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 Tom Hofmann CLA 2005-05-18 15:07:52 EDT
from bug 95785:

N20050518-0010 (also with HEAD of JDT/UI and JDT/Core)

- in the method below (in a 5.0 project), execute contant assist after toArray
and choose "toArray(Object[] a)":
    public void test(java.util.List<Object> aList){
        aList.toArray
    }

- get these proposals:
  - toArray(T[]) T[] - Collection
  - toArray(T[]) T[] - List

=> Expected: only the one from List is proposed;
Comment 1 Philipe Mulet CLA 2006-03-30 08:06:20 EST
Reproduced in latest.
Comment 2 David Audel CLA 2006-04-19 11:29:33 EDT
Created attachment 38932 [details]
Proposed fix
Comment 3 David Audel CLA 2006-04-19 11:34:18 EDT
Philippe - Do you want this fix for 3.2RC2 ?

The problem is that the parameters binding of the methods 'toArray(T[]) are not the same.
So to check if a method is already proposed my fix use 'lookupEnvironment.methodVerifier().doesMethodOverride(otherMethod, method)' instead of 'method.areParametersEqual(otherMethod)'.
Comment 4 Philipe Mulet CLA 2006-04-19 12:07:24 EDT
Looks ok to me. I assume no perf degradation ?

Kent - do you have an opinion ?

+1 for 3.2RC2
Comment 5 David Audel CLA 2006-04-20 07:36:35 EDT
perf degradation is smaller than 1% (to small to be really mesureable).
Comment 6 Kent Johnson CLA 2006-04-21 09:02:52 EDT
with 1.5, areParametersEqual is not very useful.

So yes it looks fine
Comment 7 David Audel CLA 2006-04-21 11:45:40 EDT
There is exactly the same problem with method declaration completion.

class X extends List<Object> {
  toArray
}
Comment 8 David Audel CLA 2006-04-21 11:47:31 EDT
Created attachment 39173 [details]
Better fix
Comment 9 David Audel CLA 2006-04-21 12:00:14 EDT
Fix released and tests added.
  CompletionTest_1_5#test0286() -> test0287()
Comment 10 Olivier Thomann CLA 2006-04-27 22:44:49 EDT
Verified with I20060427-1600 for RC2.