Community
Participate
Working Groups
+++ This bug was initially created as a clone of Bug #182642 +++ I'm getting this stack trace as of 3.4RC3, which is very similar to #182642. I'm cloning the bug since I'd wanted to mark it against 3.4. org.eclipse.jdt.internal.compiler.problem.AbortCompilation at org.eclipse.jdt.internal.compiler.problem.ProblemHandler.handle(ProblemHandler.java:121) at org.eclipse.jdt.internal.compiler.problem.ProblemHandler.handle(ProblemHandler.java:179) at org.eclipse.jdt.internal.compiler.problem.ProblemReporter.handle(ProblemReporter.java:1830) at org.eclipse.jdt.internal.compiler.problem.ProblemReporter.isClassPathCorrect(ProblemReporter.java:3702) at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:54) at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:101) at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:168) at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findImport(CompilationUnitScope.java:456) at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findSingleImport(CompilationUnitScope.java:510) at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.resolveSingleImport(CompilationUnitScope.java:713) at org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:2443) at org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:2184) at org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.getTypeBinding(SingleTypeReference.java:44) at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:130) at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:197) at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypeFor(SourceTypeBinding.java:1297) at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.fields(SourceTypeBinding.java:616) at org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.availableFields(ReferenceBinding.java:167) at org.eclipse.jdt.internal.codeassist.InternalExtendedCompletionContext.searchVisibleFields(InternalExtendedCompletionContext.java:491) at org.eclipse.jdt.internal.codeassist.InternalExtendedCompletionContext.searchVisibleVariablesAndMethods(InternalExtendedCompletionContext.java:761) at org.eclipse.jdt.internal.codeassist.InternalExtendedCompletionContext.computeVisibleElementBindings(InternalExtendedCompletionContext.java:175) at org.eclipse.jdt.internal.codeassist.InternalExtendedCompletionContext.getVisibleElements(InternalExtendedCompletionContext.java:352) at org.eclipse.jdt.core.CompletionContext.getVisibleElements(CompletionContext.java:327) at org.eclipse.jdt.internal.ui.text.java.ParameterGuessingProposal.getAssignableElements(ParameterGuessingProposal.java:109) at org.eclipse.jdt.internal.ui.text.java.ParameterGuessingProposal.guessParameters(ParameterGuessingProposal.java:289) at org.eclipse.jdt.internal.ui.text.java.ParameterGuessingProposal.computeGuessingCompletion(ParameterGuessingProposal.java:224) at org.eclipse.jdt.internal.ui.text.java.ParameterGuessingProposal.computeReplacementString(ParameterGuessingProposal.java:190) at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.getReplacementString(LazyJavaCompletionProposal.java:306) at org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.apply(AbstractJavaCompletionProposal.java:345) at org.eclipse.jdt.internal.ui.text.java.JavaMethodCompletionProposal.apply(JavaMethodCompletionProposal.java:51) at org.eclipse.jdt.internal.ui.text.java.ParameterGuessingProposal.apply(ParameterGuessingProposal.java:119) at org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal.apply(AbstractJavaCompletionProposal.java:443) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertProposal(CompletionProposalPopup.java:923) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$21(CompletionProposalPopup.java:887) at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:492) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:479) at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1664) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:177) at org.eclipse.ui.texteditor.ContentAssistAction$1.run(ContentAssistAction.java:82) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.ui.texteditor.ContentAssistAction.run(ContentAssistAction.java:80) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:185) at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:109) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508) at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:471) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:822) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:880) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:569) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:511) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:126) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1128) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1556) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1581) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1566) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1618) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1613) at org.eclipse.swt.widgets.Control.kEventUnicodeKeyPressed(Control.java:2273) at org.eclipse.swt.widgets.Composite.kEventUnicodeKeyPressed(Composite.java:584) at org.eclipse.swt.widgets.Control.kEventTextInputUnicodeForKeyEvent(Control.java:2235) at org.eclipse.swt.widgets.Canvas.kEventTextInputUnicodeForKeyEvent(Canvas.java:217) at org.eclipse.swt.widgets.Widget.textInputProc(Widget.java:1991) at org.eclipse.swt.widgets.Display.textInputProc(Display.java:3959) at org.eclipse.swt.internal.carbon.OS.SendEventToEventTarget(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3044) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:112) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:382) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504) at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
David, isn't it a dup of a bug you worked on recently?
To get rid of this particular problem, I knocked off .metadata, reinstalled eclipse. The only addition plugins I have in my eclipse installation are subversive, mylyn. The problem still continues, and autocomplete is broken *completely* by not being able to make autocomplete selections, although the autocomplete list does pop up. What is surprising is that this issue started without me changing any configuration in my eclipse. Is there any workaround for this ?
Ketan - Can you provide steps to reproduce ?
I created a fresh workspace with a java project containing the following class. I'm able to view and complete methods on the fooBar instance inside the doSomething() method. package a.b.c; public class FooBar { FooBar fooBar = new FooBar(); public void doSomething() { } } However checking out the source code to my application in this *same* workspace fails to do autocompletes. I'm not sure how you can reproduce this, but if there's any more information, logs, etc. that you need, I'll be more than happy to provide it.
Could you share your application source ? Or if confidential (as I would expect), can you provide a reduced version of it, just enough to reproduce the problem ?
I would not be able to share the entire code base, I'll try to isolate it to a couple of classes in a plugin and attach it to this bug.
Here's what I found out: There was a missing dependency in the class that I was auto completing inside: "The type org.eclipse.core.resources.IProject cannot be resolved. It is indirectly referenced from required .class files" Adding o.e.core.resources to the project dependency has fixed autocompletes for me.
Good, still the tooling should be resilient to this kind of mistake, i.e. we are still interested by a reduced testcase.
Scanning the trace, I believe there are 2 problems: 1. #availableFields() should be more resilient in general (not just for BinaryTypeBinding). Same for #availableMethods(). This is more of a 3.5 item. I entered bug 237623 for it 2. in order for the unresolvable type to not cause the abort, the completion context should protect its entry points to ensure a referenceContext is set properly before causing more resolution. This is similar to the problem mentionned by Jerome in comment 1, but a different code path. This one should be addressed for 3.4.1 I think. org.eclipse.jdt.internal.codeassist.InternalExtendedCompletionContext.searchVisibleFields(InternalExtendedCompletionContext.java:491)
Created attachment 105288 [details] Test project to reproduce error A project where: Foobar contains some API that's invoked in foobarTest FoobarTestBase depends on jdt.core, core.resources FoobarTest depends on the above projects in addition to jdt.core and junit Steps to reproduce: 1. Open SeleniumClasspathContainerInitializerTest#testCreatesClasspathEntries, and type in "initializer" to autocomplete. Autocomplete does not work. 2. Add o.e.core.resources to FoobarTest and autocomplete, autocomplete works.
When i use the test case of comment 10 the completion fails due to an internal exception Exception caught by CompletionEngine: org.eclipse.jdt.internal.compiler.problem.AbortCompilation at org.eclipse.jdt.internal.compiler.problem.ProblemHandler.handle(ProblemHandler.java:121) at org.eclipse.jdt.internal.compiler.problem.ProblemHandler.handle(ProblemHandler.java:179) at org.eclipse.jdt.internal.compiler.problem.ProblemReporter.handle(ProblemReporter.java:1830) at org.eclipse.jdt.internal.compiler.problem.ProblemReporter.isClassPathCorrect(ProblemReporter.java:3702) at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:54) at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:101) at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:168) at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findImport(CompilationUnitScope.java:456) at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findSingleImport(CompilationUnitScope.java:510) at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.resolveSingleImport(CompilationUnitScope.java:713) at org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:2443) at org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:2184) at org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.getTypeBinding(SingleTypeReference.java:44) at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:130) at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:197) at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypeFor(SourceTypeBinding.java:1297) at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.fields(SourceTypeBinding.java:616) at org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.availableFields(ReferenceBinding.java:167) at org.eclipse.jdt.internal.codeassist.CompletionEngine.computeAlreadyDefinedName(CompletionEngine.java:9341) at org.eclipse.jdt.internal.codeassist.CompletionEngine.computeAlreadyDefinedName(CompletionEngine.java:9292) at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:1126) at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:2554) at org.eclipse.jdt.internal.core.Openable.codeComplete(Openable.java:129) But if i type 'Object o; o.equa' instead of 'initializer' then i reproduce the same exception. org.eclipse.jdt.internal.compiler.problem.AbortCompilation at org.eclipse.jdt.internal.compiler.problem.ProblemHandler.handle(ProblemHandler.java:121) at org.eclipse.jdt.internal.compiler.problem.ProblemHandler.handle(ProblemHandler.java:179) at org.eclipse.jdt.internal.compiler.problem.ProblemReporter.handle(ProblemReporter.java:1830) at org.eclipse.jdt.internal.compiler.problem.ProblemReporter.isClassPathCorrect(ProblemReporter.java:3702) at org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding.resolve(UnresolvedReferenceBinding.java:54) at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveType(BinaryTypeBinding.java:101) at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:168) at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findImport(CompilationUnitScope.java:456) at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.findSingleImport(CompilationUnitScope.java:510) at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.resolveSingleImport(CompilationUnitScope.java:713) at org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:2443) at org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:2184) at org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.getTypeBinding(SingleTypeReference.java:44) at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:130) at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:197) at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypeFor(SourceTypeBinding.java:1297) at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.fields(SourceTypeBinding.java:616) at org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.availableFields(ReferenceBinding.java:167) at org.eclipse.jdt.internal.codeassist.InternalExtendedCompletionContext.searchVisibleFields(InternalExtendedCompletionContext.java:493) at org.eclipse.jdt.internal.codeassist.InternalExtendedCompletionContext.searchVisibleVariablesAndMethods(InternalExtendedCompletionContext.java:763) at org.eclipse.jdt.internal.codeassist.InternalExtendedCompletionContext.computeVisibleElementBindings(InternalExtendedCompletionContext.java:177) at org.eclipse.jdt.internal.codeassist.InternalExtendedCompletionContext.getVisibleElements(InternalExtendedCompletionContext.java:354) at org.eclipse.jdt.core.CompletionContext.getVisibleElements(CompletionContext.java:327) at org.eclipse.jdt.internal.ui.text.java.ParameterGuessingProposal.getAssignableElements(ParameterGuessingProposal.java:109) at org.eclipse.jdt.internal.ui.text.java.ParameterGuessingProposal.guessParameters(ParameterGuessingProposal.java:289) The fix for bug 101610 fix the problem with 'initializer' and we should add a similar fix in InternalExtendedCompletionContext#computeVisibleElementBindings() to fix the the problem with 'o.equa'.
Clarification re: comment 11 >> When i use the test case of comment 10 the completion fails due to an internal exception This one will be taken care of by fix for bug 101610
Created attachment 107442 [details] Proposed fix
Released for 3.5M1. Tests added CompletionTests2#testBug237469a() -> testBug237469b()
Created attachment 107443 [details] Proposed fix for 3.4.1 To avoid the exception this.lookupEnvironment.unitBeingCompleted must be set to the compilation unit which contains the completion node when the completion context compute the list of visible elements.
This bug is not a regression because the completion context compute visible elements only since 3.4. The fix is simple and not risky. The fix avoid that code assist fail when the classpath of a project is incomplete. Philippe - Do you approve this fix for 3.4.1 ?
+1 for 3.4.1
Released for 3.4.1. Tests added CompletionTests2#testBug237469a() -> testBug237469b()
Verified for 3.5M1 using I20080805-1307
Closing as FIXED to be closed as VERIFIED during 3.4.1 verification pass.
Reopen to close as RESOLVED/FIXED. Will be closed as VERIFIED during 3.4.1 verification pass.
Fixed.
Thanks for the fix :)
Verified for 3.4.1 using M20080827-2000.