Categories
content-assist eclipse java

Eclipse content assist fails in loops after upgrade to 2021-06 (4.20.0)

A similar question was asked here, with no answer yet and less of a code sample. I found and tried the deletion solution for a similar problem, but to no avail.

After recently upgrading Eclipse to version 2021-06 (4.20.0), I noticed the content assist feature (ctrl-space) not working properly in many instances.

import java.util.HashSet;
import java.util.Set;
public class ContentAssist {
public static void main(final String[] args) {
final Set<String> storedSet = new HashSet<String>();
for (int i = 0; i < 500; i++) {
System.out.println(i);
}
}
}

If we now would like to access the storedSet, beginning by typing ‘s’ we see that the out shows up as a compile error:

compilation error

Content Assist comes up short:

Content Assist fail 1

Also when providing more characters:

Content Assist fail 2

Comment out the System.out part and Content Assist once again works:

Content Assist works

Bug in or in front of the PC?

Edit: I just tested this for a fresh install of Eclipse 2021-06 (4.20.0) Build id 20210612-2011 on Windows x86_64, using Eclipse Installer 2021-06 R. Created a new Java project with the code above and the same behaviour occurred.