Bug 87956 - compiling error on jdk1.5 collection generics
Summary: compiling error on jdk1.5 collection generics
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 3.1 M6   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-03-14 13:00 EST by Yi-Xiong Zhou CLA
Modified: 2005-03-30 19:06 EST (History)
0 users

See Also:


Attachments
Test case (667 bytes, text/plain)
2005-03-14 13:37 EST, Olivier Thomann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yi-Xiong Zhou CLA 2005-03-14 13:00:54 EST
The following method overloading will produce a "Duplicate method" error with 
jdk1.5:

    public static String[] convertList(Collection<String> list){
        String[] ret = new String[list.size()];
        Iterator<String> it = list.iterator();
        for( int i=0; it.hasNext(); i++ ){
            ret[i] = it.next();
        }
        return ret;
    }

    public static int[] convertList(Collection<Integer> list){
        int[] ret = new int[list.size()];
        Iterator<Integer> it = list.iterator();
        for( int i=0; it.hasNext(); i++ ){
            ret[i] = (it.next()).intValue();
        }
        return ret;
    }
Comment 1 Olivier Thomann CLA 2005-03-14 13:37:22 EST
Created attachment 18772 [details]
Test case
Comment 2 Kent Johnson CLA 2005-03-14 17:45:57 EST
Added GenericType test561
Comment 3 Olivier Thomann CLA 2005-03-30 19:06:48 EST
Verified in 20050330-0500