Bug 95829

Summary: [assist] toArray proposed twice
Product: [Eclipse Project] JDT Reporter: Tom Hofmann <eclipse>
Component: CoreAssignee: David Audel <david_audel>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: kent_johnson, markus.kell.r, philippe_mulet
Version: 3.1   
Target Milestone: 3.2 RC2   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Proposed fix
none
Better fix none

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.