Summary: | [1.5][compiler] Compiler accepts call to parameterized method with invalid arguments | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> | ||||||
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> | ||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||
Severity: | minor | ||||||||
Priority: | P3 | ||||||||
Version: | 3.2 | ||||||||
Target Milestone: | 3.3 M1 | ||||||||
Hardware: | PC | ||||||||
OS: | Windows XP | ||||||||
Whiteboard: | |||||||||
Attachments: |
|
Description
Markus Keller
2005-09-29 12:14:08 EDT
From spec 15.12.2.7, the inference performs like this: ❖ A << F A is X<E>, F is List<? extends Comparable<? super T>> ❖ If F has the form G<..., Yk-1, ? extends U, Yk+1, ...>, where U involves Tj, then if A has a supertype that is one of: U is Comparable<? super T> ✣ G<..., Xk-1, V, Xk+1, ...>, where V is a type expression. Then this algorithm is applied recursively to the constraint V << U. X<E> << List<? extends Comparable<? super T>> Matching supertype for A is List<E> Recursing into: E << Comparable<? super T> ❖ A << F A is E, F is Comparable<? super T> ✣ If F has the form G<..., Yk-1, ? super U, Yk+1, ...>, where U involves Tj, then if A has a supertype that is one of: U is T ✣ Otherwise, no constraint is implied on Tj ???? Our implementation is handling raw types (for A) at this point, but slightly differently than javac as it seems. I am not aware of any spec'ed behavior describing the handling of inference against raw types (ie. inject erasure of arguments? etc...). Tuned semantics to refuse inferring from raw types at depth > 0. Added GenericTypeTest#test1017 Created attachment 45226 [details]
Proposed patch
Patch contains a little more than just this fix.
Created attachment 45270 [details]
Better patch
Released fix for 3.3M1 (HEAD) The fix is quite extensive, this is why not released to 3.2.1, as it got categorized minor to start with. Verified for 3.3 M1 using build I20060807-2000. |