Community
Participate
Working Groups
Created attachment 79821 [details] Code to reproduce Build ID: I20070621-1340 Steps To Reproduce: 1. Create and save the attached source file. 2. Compile it (or notice the red underlining). 3. The following compiler error will appear for the line where "make" is called (line 14): "Type mismatch: cannot convert from A.Map<Class<capture#1-of ?>,A> to A.Map<Class<?>,A>"
Reproduced with Build id: I20070925-1406 *but* javac 6 reports the same.
From javac 1.6_03: A.java:14: incompatible types found : A.Map<java.lang.Class<capture#173 of ?>,A> required: A.Map<java.lang.Class<?>,A> return make( type, value ); ^ 1 error From JDK1.5.0_13: A.java:14: incompatible types found : A.Map<java.lang.Class<capture of ?>,A> required: A.Map<java.lang.Class<?>,A> return make( type, value ); ^ 1 error Eclipse (HEAD): ---------- 1. ERROR in D:\tests_sources\A.java (at line 14) return make( type, value ); ^^^^^^^^^^^^^^^^^^^ Type mismatch: cannot convert from A.Map<Class<capture#1-of ?>,A> to A.Map<Class<?>,A> ---------- it looks consistent over different implementation.
Indeed, argument containment rules are stricter. Basically, a wildcard at depth 2 is not as flexible as a wildcard at depth 1. Class<*anything*> is compatible with Class<?> but Class<Class<*anything*>> is not compatible with Class<Class<?>> Marking as INVALID, since current behavior is fine. Good testcase btw, added GenericTypeTest#test1200
Verified for 3.4 M3 using build I20071029-0010.