Bug 547959 - content assist causes error for deprecation method completion
Summary: content assist causes error for deprecation method completion
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.12   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks: 544108
  Show dependency tree
 
Reported: 2019-06-05 12:10 EDT by Garret Wilson CLA
Modified: 2023-06-14 17:11 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Garret Wilson CLA 2019-06-05 12:10:43 EDT
Eclipse EE 2019-06-M3 (Windows 10)

I'm working on an old codebase and I was adding a deprecation:

	/**
	 * Parses a content type object from a string.
	 * @param charSequence The character sequence representation of the content type.
	 * @return A new content type object parsed from the string.
	 * @throws ArgumentSyntaxException Thrown if the string is not a syntactically correct content type.
	 * @deprecated in favor of #
	 */

When I typed the `#` for the deprecation, content assist produced the following error:

eclipse.buildId=4.12.0.I20190522-1800
java.version=11
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product

org.eclipse.jdt.ui
Warning
Wed Jun 05 09:06:13 PDT 2019
The 'org.eclipse.jdt.ui.org.eclipse.jdt.ui.javaCompletionProposalComputer.chain' proposal computer from the 'org.eclipse.jdt.ui' plug-in did not complete normally. The extension has thrown a runtime exception.

java.lang.NullPointerException
	at java.base/java.lang.String.<init>(String.java:251)
	at java.base/java.lang.String.valueOf(String.java:2965)
	at org.eclipse.jdt.internal.ui.text.java.ChainCompletionProposalComputer.matchesExpectedPrefix(ChainCompletionProposalComputer.java:145)
	at org.eclipse.jdt.internal.ui.text.java.ChainCompletionProposalComputer.findEntrypoints(ChainCompletionProposalComputer.java:136)
	at org.eclipse.jdt.internal.ui.text.java.ChainCompletionProposalComputer.computeCompletionProposals(ChainCompletionProposalComputer.java:77)
	at org.eclipse.jdt.internal.ui.text.java.CompletionProposalComputerDescriptor.computeCompletionProposals(CompletionProposalComputerDescriptor.java:336)
	at org.eclipse.jdt.internal.ui.text.java.CompletionProposalCategory.computeCompletionProposals(CompletionProposalCategory.java:340)
	at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.collectProposals(ContentAssistProcessor.java:334)
	at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.computeCompletionProposals(ContentAssistProcessor.java:291)
	at org.eclipse.jface.text.contentassist.ContentAssistant$2.lambda$0(ContentAssistant.java:2014)
	at java.base/java.util.Collections$SingletonSet.forEach(Collections.java:4795)
	at org.eclipse.jface.text.contentassist.ContentAssistant$2.run(ContentAssistant.java:2013)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:2010)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:575)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.lambda$0(CompletionProposalPopup.java:505)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:72)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:500)
	at org.eclipse.jface.text.contentassist.ContentAssistant$AutoAssistListener.lambda$0(ContentAssistant.java:380)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3919)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3550)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1173)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1062)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:635)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:559)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:155)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:660)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:597)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1468)
Comment 1 Garret Wilson CLA 2019-06-05 13:05:42 EDT
Now it seems that Content Assist is pausing and then generating errors with almost everything I do:

eclipse.buildId=4.12.0.I20190522-1800
java.version=11
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product

org.eclipse.jdt.core
Error
Wed Jun 05 10:03:28 PDT 2019
Could not retrieve declared methods

java.lang.NullPointerException
	at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesFor(SourceTypeBinding.java:1880)
	at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.methods(SourceTypeBinding.java:1571)
	at org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.availableMethods(ReferenceBinding.java:248)
	at org.eclipse.jdt.core.dom.TypeBinding.getDeclaredMethods(TypeBinding.java:292)
	at org.eclipse.jdt.internal.ui.text.TypeBindingAnalyzer.findFieldsAndMethods(TypeBindingAnalyzer.java:102)
	at org.eclipse.jdt.internal.ui.text.TypeBindingAnalyzer.findVisibleInstanceFieldsAndRelevantInstanceMethods(TypeBindingAnalyzer.java:86)
	at org.eclipse.jdt.internal.ui.text.ChainFinder.findAllFieldsAndMethods(ChainFinder.java:146)
	at org.eclipse.jdt.internal.ui.text.ChainFinder.searchDeeper(ChainFinder.java:132)
	at org.eclipse.jdt.internal.ui.text.ChainFinder.searchChainsForExpectedType(ChainFinder.java:81)
	at org.eclipse.jdt.internal.ui.text.ChainFinder.startChainSearch(ChainFinder.java:58)
	at org.eclipse.jdt.internal.ui.text.java.ChainCompletionProposalComputer.lambda$0(ChainCompletionProposalComputer.java:158)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)


…

eclipse.buildId=4.12.0.I20190522-1800
java.version=11
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product

org.eclipse.jdt.core
Error
Wed Jun 05 10:03:28 PDT 2019
Could not retrieve declared fields

java.lang.NullPointerException
Comment 2 Garret Wilson CLA 2019-06-05 13:10:01 EDT
Note that I was using content assist in Javadoc comments of another class trying to link to dependencies of the class `com.globalmentor.html.spec.HTML` which is available via Maven Central at the coordinates `com.globalmentor:globalmentor-html-spec:0.6.0`.

For example:

	/**
	 * {@inheritDoc}
	 * @implSpec This version returns the media type <code>text/html</code> for all pages.
	 * @see HTML#
	 */
	@Override
	public FooBar doFoo() …

I was using content assist on the `HTML#` part above.
Comment 3 Stephan Herrmann CLA 2019-06-05 13:11:57 EDT
(In reply to Garret Wilson from comment #0)
> org.eclipse.jdt.internal.ui.text.java.ChainCompletionProposalComputer.
> matchesExpectedPrefix(ChainCompletionProposalComputer.java:145)

Chain completion was never supposed to be automatically enabled. In fact this feature has been withdrawn from 4.12 due to known problems.

Please go to Preferences > Java > Editor > Content Assist > Advanced and disable Chain Proposals.
Comment 4 Garret Wilson CLA 2019-06-05 13:14:06 EDT
Just to confirm the name, that would be "Chain Template Proposals" I am to disable?
Comment 5 Andrey Loskutov CLA 2019-06-05 13:19:50 EDT
(In reply to Garret Wilson from comment #4)
> Just to confirm the name, that would be "Chain Template Proposals" I am to
> disable?

yep. See linked bug 547833.
Comment 6 Garret Wilson CLA 2019-06-05 13:20:45 EDT
Thanks. That seems to have fixed this problem.
Comment 7 Garret Wilson CLA 2019-06-05 13:24:40 EDT
Note that I certainly did not go enable any special content assist settings. And I didn't even "upgrade" Eclipse: I merely unzipped the Eclipse EE 2019-06 M3 distribution (although I did use an existing workspace). So you might want to check if this thing is getting enabled erroneously; someone mentioned in one of the linked bugs that it shouldn't be turned on by default.

Then again there have been problems in the past with some Eclipse builds turning off content assist altogether; see Bug 542925. Maybe when I told it to "restore defaults" back in December 2018 it turned this on. I don't know; that's only a conjecture.
Comment 8 Andrey Loskutov CLA 2019-06-05 13:28:50 EDT
(In reply to Garret Wilson from comment #7)
> Note that I certainly did not go enable any special content assist settings.
> And I didn't even "upgrade" Eclipse: I merely unzipped the Eclipse EE
> 2019-06 M3 distribution (although I did use an existing workspace). So you
> might want to check if this thing is getting enabled erroneously; someone
> mentioned in one of the linked bugs that it shouldn't be turned on by
> default.
> 
> Then again there have been problems in the past with some Eclipse builds
> turning off content assist altogether; see Bug 542925. Maybe when I told it
> to "restore defaults" back in December 2018 it turned this on. I don't know;
> that's only a conjecture.

That is not your fault, that is bug 547833 comment 9. This must be addressed in bug 544108, for now the feature is disabled.
Comment 9 Eclipse Genie CLA 2021-05-26 04:04:33 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 10 Eclipse Genie CLA 2023-06-14 17:11:32 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.