Bug 559259 - JavaContentAssistInvocationContext must pass a timeout monitor to cu.codeComplete()
Summary: JavaContentAssistInvocationContext must pass a timeout monitor to cu.codeComp...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.15   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 4.15 M3   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-16 09:55 EST by Stephan Herrmann CLA
Modified: 2020-01-16 14:44 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2020-01-16 09:55:45 EST
Observed while debugging the freeze demonstrated by attachment 281503 [details] from bug 559197: Content assist fails to show the timeout dialog, because we are invoking cu.codeComplete() without a monitor. This is severe, because problems during proposal computation will cause data loss: user has to force-kill Eclipse.

The culprit is in org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext.computeKeywordsAndContext(), there may be more.

We should probably extract the monitor from org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposalComputer.createTimeoutProgressMonitor(long) and use it in more situations.
Comment 1 Stephan Herrmann CLA 2020-01-16 10:03:05 EST
FWIW, the call chain here was TemplateCompletionProposalComputer -> JavaContentAssistInvocationContext.getCoreContext() -> computeKeywordsAndContext()
Comment 2 Stephan Herrmann CLA 2020-01-16 10:17:57 EST
I'll post a change, soon, but the following locations will not be covered for now:

o.e.j.core.CorrectionEngine.correct(char[])
o.e.pde...TypePackageCompletionProcessor.generateProposals - 2 overloads
o.e.j.internal.corext.template.java.JavaContextCore.getCompletion()

These locations are outside o.e.j.ui.
Comment 3 Eclipse Genie CLA 2020-01-16 10:34:49 EST
New Gerrit change created: https://git.eclipse.org/r/156013
Comment 4 Stephan Herrmann CLA 2020-01-16 10:37:59 EST
I branched off bug 559262 in JDT/Core.
Comment 5 Stephan Herrmann CLA 2020-01-16 10:45:10 EST
When comparing the situations with freeze vs. timeout dialog from bug 559197 I suspect the list / order / enablement of completion processors is the decisive factor. Interestingly, the problematic case included "Java Proposals (Task-Focused)". Unfortunately, I couldn't get those to show up in my dev environment, despite having lot's of mylyn plugins in my target platform.
Comment 7 Stephan Herrmann CLA 2020-01-16 14:44:15 EST
(In reply to Eclipse Genie from comment #6)
> Gerrit change https://git.eclipse.org/r/156013 was merged to [master].
> Commit:
> http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/
> ?id=7caac19e21a5febaf9eb1afd6a2077c7ab48a975

Released to master for 4.15 M3