ceylon/ceylon-compiler — Issue #402: NPE from IDE autocompletion
Author: gavinking
Created: 2012-02-26 19:56:01+00:00
State: open
Labels: BUG, interoperability, model-loader

When autocompleting Java declarations inside an `import` statement, I got this NPE related to lazy model loading:

```java.lang.NullPointerException
at com.redhat.ceylon.compiler.typechecker.model.ProducedType.getProducedTypeName(ProducedType.java:1130)
at com.redhat.ceylon.compiler.typechecker.model.UnionType.getName(UnionType.java:20)
at com.redhat.ceylon.compiler.typechecker.model.Declaration.equals(Declaration.java:214)
at com.redhat.ceylon.compiler.typechecker.model.TypeDeclaration.equals(TypeDeclaration.java:159)
at com.redhat.ceylon.compiler.typechecker.model.Util.addToSupertypes(Util.java:443)
at com.redhat.ceylon.compiler.typechecker.model.ProducedType.getSupertypes(ProducedType.java:464)
at com.redhat.ceylon.compiler.typechecker.model.ProducedType.getSupertypes(ProducedType.java:428)
at com.redhat.ceylon.compiler.typechecker.model.Util.addToIntersection(Util.java:313)
at com.redhat.ceylon.compiler.typechecker.model.Util.intersectionType(Util.java:463)
at com.redhat.ceylon.compiler.typechecker.model.Unit.getDefiniteType(Unit.java:485)
at com.redhat.ceylon.compiler.typechecker.model.Util.definiteTypeDec(Util.java:163)
at com.redhat.ceylon.compiler.typechecker.model.Util.hasMatchingSignature(Util.java:115)
at com.redhat.ceylon.compiler.typechecker.model.Util.lookupMember(Util.java:514)
at com.redhat.ceylon.compiler.typechecker.model.Element.getDirectMember(Element.java:69)
at com.redhat.ceylon.compiler.loader.model.LazyInterface.getDirectMember(LazyInterface.java:304)
at com.redhat.ceylon.compiler.typechecker.model.TypeDeclaration.getRefinedMember(TypeDeclaration.java:336)
at com.redhat.ceylon.compiler.typechecker.model.TypeDeclaration.getRefinedMember(TypeDeclaration.java:331)
at com.redhat.ceylon.compiler.typechecker.model.TypeDeclaration.getRefinedMember(TypeDeclaration.java:325)
at com.redhat.ceylon.compiler.typechecker.model.TypeDeclaration.getRefinedMember(TypeDeclaration.java:325)
at com.redhat.ceylon.compiler.typechecker.model.TypeDeclaration.getRefinedMember(TypeDeclaration.java:312)
at com.redhat.ceylon.compiler.loader.model.LazyClass.getRefinedMember(LazyClass.java:213)
at com.redhat.ceylon.compiler.loader.AbstractModelLoader.findRefinedDeclaration(AbstractModelLoader.java:991)
at com.redhat.ceylon.compiler.loader.AbstractModelLoader.fillRefinedDeclarations(AbstractModelLoader.java:970)
at com.redhat.ceylon.compiler.loader.AbstractModelLoader.complete(AbstractModelLoader.java:889)
at com.redhat.ceylon.compiler.loader.AbstractModelLoader.complete(AbstractModelLoader.java:755)
at com.redhat.ceylon.compiler.loader.model.LazyClass.load(LazyClass.java:78)
at com.redhat.ceylon.compiler.loader.model.LazyClass.isShared(LazyClass.java:248)
at com.redhat.ceylon.compiler.typechecker.model.TypeDeclaration.getMatchingMemberDeclarations(TypeDeclaration.java:535)
at com.redhat.ceylon.compiler.typechecker.model.TypeDeclaration.getMatchingMemberDeclarations(TypeDeclaration.java:532)
at com.redhat.ceylon.eclipse.imp.proposals.CeylonContentProposer.getProposals(CeylonContentProposer.java:749)
at com.redhat.ceylon.eclipse.imp.proposals.CeylonContentProposer.getContentProposals(CeylonContentProposer.java:258)
at org.eclipse.imp.editor.internal.CompletionProcessor.computeCompletionProposals(CompletionProcessor.java:52)
at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1830)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:556)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup.java:553)
at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:488)
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:1656)
at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:926)
at org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1534)
at org.eclipse.imp.editor.StructuredSourceViewer.doOperation(StructuredSourceViewer.java:129)
at org.eclipse.ui.texteditor.ContentAssistAction$1.run(ContentAssistAction.java:82)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
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:468)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:786)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:885)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:567)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:508)
at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:123)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1069)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4124)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1457)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1480)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1465)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1494)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1490)
at org.eclipse.swt.widgets.Canvas.sendKeyEvent(Canvas.java:463)
at org.eclipse.swt.widgets.Control.doCommandBySelector(Control.java:1051)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5560)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSResponder.interpretKeyEvents(NSResponder.java:68)
at org.eclipse.swt.widgets.Composite.keyDown(Composite.java:587)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5470)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:220)
at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:2092)
at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2255)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5532)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:4986)
at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5135)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:128)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3607)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
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:344)
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:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
```