Community
Participate
Working Groups
When adding an if statement before a local variable declaration without any braces yet, content assist is broken on the RHS: public static void fillAttributes(Object object) throws Exception { for (Field field : object.getClass().getFields()) { if (field.getType() == |) // no content assist Object value = field.get(object); System.out.println(value); } } Tested in Version: 2021-09 (4.21) Build id: I20210712-0340 This worked in 4.19
Still in I20210723-1800
Problem is: local variable "Object value" creates a syntax at this position (illegal then-statement). Previously (4.19-), we would never see "Object value", but abort parsing at the cursor. Now we need to help the parser collecting bits off stacks also in this case. I have a patch, but still need to sort through effects on other tests.
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/183569
(In reply to Eclipse Genie from comment #3) > New Gerrit change created: > https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/183569 Main idea here: detect cases where the assist node was not attached even while the current method has actual statements. In this case use the mechanism of RecoveredElement.add() and .updateParseTree(). The tricky part was detecting the assist node *anywhere* within the already constructed AST (to avoid duplicate insertion). Two parts to solving this sub-issue: * a new AST visitor (based on a new general purpose GenericAstVisitor (like we have in DOM) * correctly splice CompletionOnBranchStatementLabel into the ASTNode hierarchy to allow it being traversed by the visitor (abstract class BranchStatement is not covered).
Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/183569 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=bb441d25c94b5c0cef092b72a93035296af4aff9
(In reply to Eclipse Genie from comment #5) > Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/183569 was > merged to [master]. > Commit: > http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/ > ?id=bb441d25c94b5c0cef092b72a93035296af4aff9 Released for 4.21 M3
Verified in I20210804-1800. The behavior is now as before in 4.19, which was broken too, see bug 575258.