| Summary: | [content assist] NodeFinder.perform returns incorrect node when overriding default methods from interfaces | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Clovis Seragiotto <clovis.seragiotto> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | noopur_gupta |
| Version: | 4.8 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | stalebug | ||
The problem is in
org.eclipse.jdt.core.dom.NodeFinder.perform(ASTNode root, int start, int length) API which is invoked from OverrideCompletionProposal#updateReplacementString in jdt.ui.
When content assist is invoked without typing any character, the offset in the example is 160 and when it is invoked after pressing a char 'g', the offset is 161. In the first case, the API correctly returns the AnonymousClassDeclaration node for {}, whereas in the second case it wrongly returns the VDF node for "b". This results in incorrect computation of the replacement string.
Moving to JDT Core.
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. The bug can still be reproduced. |
1) Create the class class Foo { interface Bar { default int getInt() { return 0; } } Bar b = new Bar() { // }; } 2) Right before // press <Ctrl+Space> <g> <e> <t> <i> <n> <t> <Enter> The inserted code is: public default int getInt() {}; "default" is not allowed and ";" is unnecessary. Expected is: @Override public int getInt() { // TODO Auto-generated method stub return Bar.super.getInt(); } which is what you get if you press <Ctrl+Space>, select the method getInt from the list of suggestions, and then press <Enter>.