Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 528981

Summary: Completion of a module declaration causes an AssertionFailedException
Product: z_Archived Reporter: Andreas Sewe <sewe>
Component: RecommendersAssignee: Andreas Sewe <sewe>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=528901
Whiteboard:
Bug Depends on: 528954, 528967    
Bug Blocks:    

Description Andreas Sewe CLA 2017-12-20 03:33:07 EST
After the fix for Bug 528901, there is one situation where triggering completion in a module-info.java causes an exception:

  module name<ctrl+space> {

  }

org.eclipse.core.runtime.AssertionFailedException: assertion failed: 
	at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110)
	at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96)
	at org.eclipse.jdt.ui.text.java.CompletionProposalCollector.getDeclaringType(CompletionProposalCollector.java:609)
	at org.eclipse.jdt.ui.text.java.CompletionProposalCollector.isFiltered(CompletionProposalCollector.java:547)
	at org.eclipse.jdt.ui.text.java.CompletionProposalCollector.accept(CompletionProposalCollector.java:244)
	at org.eclipse.recommenders.completion.rcp.processable.ProposalCollectingCompletionRequestor.createJdtProposals(ProposalCollectingCompletionRequestor.java:290)
	at org.eclipse.recommenders.completion.rcp.processable.ProposalCollectingCompletionRequestor.accept(ProposalCollectingCompletionRequestor.java:264)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.findModuleName(CompletionEngine.java:10696)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:2052)
	at org.eclipse.jdt.internal.core.Openable.codeComplete(Openable.java:131)
	at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:358)
	at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:346)
	at org.eclipse.recommenders.internal.subwords.rcp.SubwordsSessionProcessor.computeProposals(SubwordsSessionProcessor.java:342)
	at org.eclipse.recommenders.internal.subwords.rcp.SubwordsSessionProcessor.getNewProposals(SubwordsSessionProcessor.java:229)
	at org.eclipse.recommenders.internal.subwords.rcp.SubwordsSessionProcessor.initializeContext(SubwordsSessionProcessor.java:169)
	at org.eclipse.recommenders.completion.rcp.processable.IntelligentCompletionProposalComputer.fireInitializeContext(IntelligentCompletionProposalComputer.java:293)
	at org.eclipse.recommenders.completion.rcp.processable.IntelligentCompletionProposalComputer.computeCompletionProposals(IntelligentCompletionProposalComputer.java:170)
	at org.eclipse.jdt.internal.ui.text.java.CompletionProposalComputerDescriptor.computeCompletionProposals(CompletionProposalComputerDescriptor.java:333)
	at org.eclipse.jdt.internal.ui.text.java.CompletionProposalCategory.computeCompletionProposals(CompletionProposalCategory.java:337)
	at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.collectProposals(ContentAssistProcessor.java:331)
	at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.computeCompletionProposals(ContentAssistProcessor.java:288)
	at org.eclipse.jface.text.contentassist.ContentAssistant$3.lambda$0(ContentAssistant.java:2016)

This exception is caused by JDT Bug 528954.

Previously, content assist in that position simply would have shown no proposals, so in a way the fix for Bug 528901, which enables completion in module-info.java doesn't make things fundamentally different.

As Oxygen.2 already shipped with Bug 528901 (i.e., no completion in module-info.java) and Oxygen.3 will ship with Bug 528954 and hence this bug fixed, I think it is OK not to implement a temporary work-around like disabling completion of MODULE_DECLARATIONs or resorting to ugly reflection-based hackery.

If you disagree with this assessment, please say so in this bug.
Comment 1 Andreas Sewe CLA 2018-01-04 05:44:01 EST
(In reply to Andreas Sewe from comment #0)
> As Oxygen.2 already shipped with Bug 528901 (i.e., no completion in
> module-info.java) and Oxygen.3 will ship with Bug 528954 and hence this bug
> fixed, I think it is OK not to implement a temporary work-around like
> disabling completion of MODULE_DECLARATIONs or resorting to ugly
> reflection-based hackery.

Closing as fixed as upstream fixes are in.