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:

Content Assist comes up short:

Also when providing more characters:

Comment out the System.out part and Content Assist once again 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.
Solution. Go to Window -> Preferences -> Editor -> Content Assist -> Advanced and enable Parsing-based Proposals. Click Apply. Content assist should start working immediately.
To enable the Content Assist window to open automatically, go to the Content Assist Preferences page, accessed from Window | Preferences | PHP | Editor | Content Assist and mark the 'Enable auto-activation' checkbox.
Always enable major upgradesEnable the Latest Eclipse release https://download.eclipse.org/releases/latest repository by ticking the checkbox. Apply and Close. Check for updates.
Unfortunately, that is indeed an issue of Eclipse 2021-06 (4.20) that has already been fixed in Eclipse 2021-09 (4.21) (released on September 15, 2021):
Eclipse bug 574338 - [content assist] [regression] no content assist for variables in conditional blocks
Please note, there is a similar bug that has not yet been fixed. As workaround you can add a ; after the location where to use the content assist.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With