RFR: 8278039: Code completion not woking after some statements such as "if" or "while"

Jan Lahoda jlahoda at openjdk.java.net
Tue Feb 1 15:52:38 UTC 2022


Consider these snippets with completion:

String s = "";
if (s.c<tab>


The completion here proposes:

char   com.


which is clearly wrong. The reason is that when the completion searches for the deepest `Tree` at the cursor's position, it finds a tree for the synthetic/error recovery ';' for the then section of the command, rather than a tree in the condition.

The proposed patch is to tweak the search for the deepest `Tree`, so that the tree from the if's condition is found.

-------------

Commit messages:
 - 8278039: Code completion not woking after some statements such as "if" or "while"

Changes: https://git.openjdk.java.net/jdk/pull/7308/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=7308&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8278039
  Stats: 17 lines in 2 files changed: 11 ins; 2 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/7308.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/7308/head:pull/7308

PR: https://git.openjdk.java.net/jdk/pull/7308


More information about the kulla-dev mailing list