Summary: | [1.5][compiler] Eclipse/javac discrepancy with nested type parameters and raw types in method calls | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Joe Kearney <joe.kearney> |
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> |
Status: | VERIFIED INVALID | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | jeffrey.sinclair, joe.kearney, kent_johnson, Olivier_Thomann |
Version: | 3.4 | ||
Target Milestone: | 3.5 M1 | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Joe Kearney
2008-06-11 14:45:46 EDT
My analysis, based on JLS 15.12.2.7, yields that 'T' is inferred to be 'Y<Z>', as we currently obtain with ECJ. ------------------------------------------------- 15.12.2.7 invoking: #method(X<T>,T) with { X<Y<Z>>, Y } i.e. Arg1 << Formal1, Arg2 << Formal2 (1) X<<Y<Z>> << X<T> (2) Y << T ------------------------------------------------- (1) X<<Y<Z>> << X<T> Using p.453: ❖ If F has the form G<..., Yk-1, U, Yk+1, ...>, where U is a type expression that involves Tj, then if A has a supertype of the form G<..., Xk-1, V, Xk+1, ...> where V is a type expression, this algorithm is applied recursively to the constraint V = U. [where U is T, V is Y<Z>] (1a) Y<Z> = T Using p.456: ❖ If F = Tj, then the constraint Tj = A is implied. (1b) T = Y<Z> ------------------------------------------------- (2) Y << T Using p.453: ❖ Otherwise, if F = Tj, then the constraint Tj :> A is implied. (2a) T :> Y ------------------------------------------------- p.463 resolving constraints: { T = Y<Z>, T :> Y } Using: "For each implied equality constraint Tj = U or U = Tj: • If U is not one of the type parameters of the method, then U is the type inferred for Tj. Then all remaining constraints involving Tj are rewritten such that Tj is replaced with U. There are necessarily no further equality constraints involving Tj, and processing continues with the next type parameter, if any." { T = Y<Z>, Y<Z> :> Y } Using: "Then, for each remaining type variable Tj, ..." There is none, hence the ':>' constraint is not considered; and T = Y<Z>. Applicability check does pass, with unchecked warning on second argument (raw Y). I got confirmation from spec master that this is the intended behavior by the language spec. Please report the bug to javac. marking as Invalid Added GenericTypeTest#test1349 javac bug should soon be avail at http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6718364 Verified for 3.5M1 using I20080805-1307 |