Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code assist fails when missing optional dependency in your project #675

Closed
mauromol opened this issue Aug 14, 2018 · 3 comments
Closed

Code assist fails when missing optional dependency in your project #675

mauromol opened this issue Aug 14, 2018 · 3 comments
Assignees
Labels
Milestone

Comments

@mauromol
Copy link

With Greclipse 3.1.0.xx-201808132239-e47, create a project with the following compile dependencies:
org.codehaus.groovy:groovy:2.4.15
junit:junit:4.12
org.springframework:spring-test:4.3.11.RELEASE

Then, try to write:

package test31

import org.junit.Test

class Test31 {

	@Test
	void testName() {
		Asse|
	}
}

Invoke code assist at "|". You'll get:

Exception:java.lang.NoClassDefFoundError: Unable to load class org.springframework.test.web.client.match.MockRestRequestMatchers due to missing dependency org/springframework/http/client/ClientHttpRequest
	 at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:430)
	 at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:358)
	 at org.codehaus.groovy.ast.ClassNode.getFields(ClassNode.java:442)
	 at org.codehaus.groovy.eclipse.codeassist.creators.FieldProposalCreator.findStaticFavoriteProposals(FieldProposalCreator.java:146)
	 at org.codehaus.groovy.eclipse.codeassist.creators.FieldProposalCreator.findAllProposals(FieldProposalCreator.java:87)
	 at org.codehaus.groovy.eclipse.codeassist.processors.StatementAndExpressionCompletionProcessor.proposalCreatorLoop(StatementAndExpressionCompletionProcessor.java:527)
	 at org.codehaus.groovy.eclipse.codeassist.processors.StatementAndExpressionCompletionProcessor.generateProposals(StatementAndExpressionCompletionProcessor.java:385)
	 at org.codehaus.groovy.eclipse.codeassist.requestor.GroovyCompletionProposalComputer.computeCompletionProposals(GroovyCompletionProposalComputer.java:215)
	 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.run(ContentAssistant.java:2007)
	 at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	 at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:2004)
	 at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:560)
	 at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$7(CompletionProposalPopup.java:555)
	 at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:489)
	 at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	 at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:482)
	 at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1823)
	 at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:184)
	 at org.eclipse.ui.texteditor.ContentAssistAction$1.run(ContentAssistAction.java:84)
	 at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
	 at org.eclipse.ui.texteditor.ContentAssistAction.run(ContentAssistAction.java:81)
	 at org.eclipse.jface.action.Action.runWithEvent(Action.java:473)
	 at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:118)
	 at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:92)
	 at sun.reflect.GeneratedMethodAccessor123.invoke(null:-1)
	 at sun.reflect.DelegatingMethodAccessorImpl.invoke(null:-1)
	 at java.lang.reflect.Method.invoke(null:-1)
	 at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55)
	 at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:305)
	 at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:239)
	 at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
	 at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152)
	 at org.eclipse.core.commands.Command.executeWithChecks(Command.java:494)
	 at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
	 at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
	 at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:287)
	 at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:527)
	 at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:577)
	 at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:385)
	 at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:331)
	 at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:88)
	 at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	 at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1271)
	 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1078)
	 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1103)
	 at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1088)
	 at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1130)
	 at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1126)
	 at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1547)
	 at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4962)
	 at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:364)
	 at org.eclipse.swt.widgets.Control.windowProc(Control.java:4843)
	 at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:359)
	 at org.eclipse.swt.widgets.Display.windowProc(Display.java:5178)
	 at org.eclipse.swt.internal.win32.OS.DispatchMessageW(OS.java:-2)
	 at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2560)
	 at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3815)
	 at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1150)
	 at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	 at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1039)
	 at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	 at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
	 at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	 at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
	 at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	 at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
	 at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	 at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	 at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	 at sun.reflect.NativeMethodAccessorImpl.invoke0(null:-2)
	 at sun.reflect.NativeMethodAccessorImpl.invoke(null:-1)
	 at sun.reflect.DelegatingMethodAccessorImpl.invoke(null:-1)
	 at java.lang.reflect.Method.invoke(null:-1)
	 at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	 at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	 at org.eclipse.equinox.launcher.Main.run(Main.java:1499)

The mentioned class is an optional dependency that should not be needed unless you use the mentioned Spring Test class. Anyway, I think it should not make Greclipse code assist fail.

@eric-milles
Copy link
Member

You must have "org.springframework.test.web.client.match.MockRestRequestMatchers" set as a content assist favorite. I do not get the error when completing the test case as stated or even MockRestRequestMatchers.g|, which directly references the method that requires ClientHttpRequest.

@eric-milles eric-milles self-assigned this Aug 14, 2018
@eric-milles eric-milles added this to the v3.1.0 milestone Aug 14, 2018
@eric-milles
Copy link
Member

Ready to test

@mauromol
Copy link
Author

Hi Eric, indeed I do have that content assist favourite (as I'm using Spring Tools Suite as well), but now with 3.1.0.xx-201808152215-e47 all works fine, thank you! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants