| Summary: | [10][compiler] eclipse rejects code that is accepted by javac involving wildcards, generic methods and var declarations | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Sasikanth Bharadwaj <sasikanth.bharadwaj> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | jarthana, manoj.palat, stephan.herrmann |
| Version: | 4.8 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 10 | ||
| Whiteboard: | stalebug | ||
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. |
The code below compiles with javac but is rejected by eclipse Not yet sure what causes this, but initial analysis reveals that this has to do with the nested generic method invocation. Somewhere along the line, U is instantiated to be Integer instead of ? super Integer resulting in the error. public class Test { <T> A<? super T> getA(T t) { return null; } <U> A<U> getAU(A<U> u) { return null; } void foo() { A<? super Integer> a = getA(100); var var = getAU(getA(100)); var = a; // error here - cannot convert from A<capture of ? super Integer> to A <Integer> } } class A<Q> { A(Q e) { } A(A<Q> ae) { } }