Community
Participate
Working Groups
/* * 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.
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
It feels our bug. We seem to consider that: List<Collection> <: List<? extends Collection<?>>
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.
FYI, there is no IBM javac. Just plain javac bundled with an IBM vm.
Added GenericTypeTest#test910-911. Tuned TypeBinding#isTypeArgumentContainedBy(...)
Fixed
Created attachment 34902 [details] patch for TypeBinding
Excellant, many thanks indeed.
You're welcome. BTW, it will not be in M5, but shortly after it (next integration in M6).
Actually, the fix is quite more complex to properly deal with 'super' wildcards and array bounds. Added extra GenericTypeTest#test912-914.
*** Bug 129129 has been marked as a duplicate of this bug. ***
(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.
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.
Verified for 3.2 M6 using build I20060328-0010