Community
Participate
Working Groups
Given this snippet: public team class Canonicalization { protected class Cache<K,V> { } Cache<Integer,String> stringCache = new Cache<Integer, String>(); } The compiler fails to see compatibility of the field initializer: Type mismatch: cannot convert from Cache<@tthis[Canonicalization],Object,Object> to Cache<@tthis[Canonicalization],Integer,String> The same applies when initializing the field in a constructor. Apparently the allocation expression looses type information.
Created attachment 187704 [details] test & fix Indeed, role creation dropped type arguments. Also, LookupEnvironment.createParameterizedType(..) created too many type bindings, because a wrong (already parameterized) key was used for lookup into uniqueParameterizedTypeBindings. Both issues are fixed in the patch.
Patch has been committed as r1253, r1254
Verified for 0.8M5 using build 201101290806.