| Summary: | [infer type arguments] passing List to Object | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Dirk Baeumer <dirk_baeumer> |
| Component: | UI | Assignee: | Markus Keller <markus.kell.r> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 3.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | stalebug | ||
Moving Milestone. The problem is that we don't follow the flow of l's element variable through the
Object o. The cast to List is dangerous anyway, and the cast to List<A> will
still be flagged with a Type Safety warning.
Deferring to 3.2.
Here's a more general example:
public class Try {
public static void main(String[] args) {
Sub<String, Integer> sub= new Sub<String, Integer>();
Top<String> top= sub;
// would have to leave sub raw, since element type B of sub is lost here
Object object= sub;
}
}
class Top<A> {
A a;
}
class Sub<A, B> extends Top<A> {
B b;
}
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
M3 test candidate public class A { void foo() { List l= new ArrayList(); l.add("Eclipse"); l.add(new Integer(10)); bar(l); } void bar(Object o) { ((List)o).add(new A()); } } Shouldn't we leave l as raw since we don't know what happens inside bar and we don't analyze it.