Bug 127583 - [1.5][compiler] Call to constructor with mismatched type parameter and arguement not detected
Summary: [1.5][compiler] Call to constructor with mismatched type parameter and arguem...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 129129 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-02-13 17:37 EST by Matthew Sackman CLA
Modified: 2006-03-28 05:43 EST (History)
1 user (show)

See Also:


Attachments
patch for TypeBinding (2.25 KB, patch)
2006-02-17 06:11 EST, Philipe Mulet CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Sackman CLA 2006-02-13 17:37:06 EST
/*
 * This compiles fine in Eclipse 3.2M4 (BuildID: I20051215-1506)
 * It does not compile using Sun's Javac 1.5.0_06
 */

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class Test {
    
    private final List<Collection> aList = new ArrayList<Collection>();
    
    public void foo() {
        final List<Collection<?>> listCopy = new ArrayList<Collection<?>>(aList);
    }
    
}

My apologies: I have not been through the JLS to actually work out which behaviour is incorrect. Testing suggests this is only an issue with raw types.
Comment 1 Matthew Sackman CLA 2006-02-13 17:39:24 EST
Forgot the javac error message (Sun javac 1.5.0_06 as before):
> javac Test.java 
Test.java:15: cannot find symbol
symbol  : constructor ArrayList(java.util.List<java.util.Collection>)
location: class java.util.ArrayList<java.util.Collection<?>>
        final List<Collection<?>> listCopy = new ArrayList<Collection<?>>(aList);
                                             ^
1 error
Comment 2 Philipe Mulet CLA 2006-02-13 18:56:59 EST
It feels our bug. We seem to consider that:
List<Collection>  <:  List<? extends Collection<?>> 
Comment 3 Matthew Sackman CLA 2006-02-13 19:13:49 EST
Yeah: just tested with the IBM javac and it gives the same error as the Sun one so I'd guess it is an Eclipse issue.
Comment 4 Philipe Mulet CLA 2006-02-16 11:17:48 EST
FYI, there is no IBM javac. Just plain javac bundled with an IBM vm.
Comment 5 Philipe Mulet CLA 2006-02-17 06:09:25 EST
Added GenericTypeTest#test910-911. Tuned TypeBinding#isTypeArgumentContainedBy(...)
Comment 6 Philipe Mulet CLA 2006-02-17 06:09:37 EST
Fixed
Comment 7 Philipe Mulet CLA 2006-02-17 06:11:07 EST
Created attachment 34902 [details]
patch for TypeBinding
Comment 8 Matthew Sackman CLA 2006-02-17 06:13:05 EST
Excellant, many thanks indeed.
Comment 9 Philipe Mulet CLA 2006-02-17 07:06:43 EST
You're welcome. BTW, it will not be in M5, but shortly after it (next integration in M6). 
Comment 10 Philipe Mulet CLA 2006-02-17 11:26:11 EST
Actually, the fix is quite more complex to properly deal with 'super' wildcards and array bounds.
Added extra GenericTypeTest#test912-914.
Comment 11 Philipe Mulet CLA 2006-02-23 05:54:05 EST
*** Bug 129129 has been marked as a duplicate of this bug. ***
Comment 12 Tobias Riemenschneider CLA 2006-03-01 11:31:06 EST
(In reply to comment #10)
> Actually, the fix is quite more complex to properly deal with 'super' wildcards
> and array bounds.
> Added extra GenericTypeTest#test912-914.

Is the reminded fix removed between IBuild from 02/21 and 3.2M5a. While IBuild from 02/21 for Linux correctly detects the incorrect code, 3.2M5a does not realize it.
Comment 13 Philipe Mulet CLA 2006-03-02 05:04:41 EST
3.2M5a did cause some confusion. It is only 3.2M5+one extra fix from the platform. 
It is not part of the M6 cycle, which this fix belongs to. 
So though 3.2M5a got issued after I20060221, it doesn't contain the fix you are looking for.
Comment 14 David Audel CLA 2006-03-28 05:43:36 EST
Verified for 3.2 M6 using build I20060328-0010