| Summary: | [compiler][generics] instantiating a generic role cannot be type-checked | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] Objectteams | Reporter: | Stephan Herrmann <stephan.herrmann> | ||||
| Component: | OTJ | Assignee: | Stephan Herrmann <stephan.herrmann> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | ||||||
| Version: | 0.8 | ||||||
| Target Milestone: | 0.8 M5 | ||||||
| Hardware: | Other | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
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. |
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.