| Summary: | [DOM] Equal but not identical method bindings with inferred type arguments | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | frederic_fusier, kent_johnson, philippe_mulet |
| Version: | 3.4 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | stalebug | ||
The compiler creates two different instances of ParameterizedMethodBinding in this case. Since this class doesn't define an equals method, the first IMethodBinding is not returned from the hash map that contains the compiler<->dom binding mapping when the second IMethodBinding is requested. Kent, Philippe, is is doable to reuse the same binding on the compiler side? If not, we either don't support identity for method bindings or I change the way to mapping is done for parameterized method binding. In this example, the first method is inferred to be: Collections.<String>emptyList() where the second invocation ends up inferring Collections.<Object>emptyList() (from checking the hover/codeselect). This would explain different bindings. Actually, my previous comment is rather a bug in the hover/select support. When debugging the compiler, I can see that the compiler is doing proper inference that T==String, but indeed it constructs a different method binding than in the first situation. The problem with codeSelect is bug 209639. This bug is about binding identity. 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. If you have further information on the current state of the bug, please add it. 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. |
HEAD import java.util.Collections; import java.util.List; public class Try { List<String> get(boolean b) { if (b) return Collections.<String>emptyList(); else return Collections.emptyList(); } } The two IMethodBindings for emptyList() are isEqualTo(..) each other and their keys are the same, but the bindings are not identical.