Community
Participate
Working Groups
Completion throws an NPE when trying to complete on "c." in class Main below: public interface Cl$ss { void test(Cl$ss c); } public class Main { void m(Cl$ss c) { c. } } the reason for this is: method test cannot be displayed. the reason for that is: SourceTypeConverter.decodeType(String,int,int,int) creates a QualifiedTypeReference with these tokens: tokens[0] = { 'C', 'l', '$', 's', 's' } tokens[1] = null The reason behind that is: decodeType recognizes '.' AND '$' as delimiters, whereas extractIdentifiers(..) (used by decodeType) only looks for '.'. I know that handling of '$' in identifiers is a pain. I don't think there is an easy solution to this, since no resolved information is directly available and without that no-one can tell whether '$' is a delimiter (inner classes) or not (part of an identifier). wild phantasie #1: What exactly would break, if decodeType would completely ignore any special semantics of '$'? I assume quite a number of places would have to be changed as to find inner classes as toplevel classes with compound names ... (the JVM-view of the world). wild phantasie #2: Could the java model actually use two different chars to encode (1) dollar-as-inner-class-delimiter and (2) dollar-as-part-of-identifier?? quick solution(?): make extractIdentifiers(..) aware of '$' as delimiter? When I tried this, the NPE disappeared, but still no proposal for method test was given, mh..
Since the mildly related bug 127739 is targeted for 3.4 I took a fresh look at this issue. Indeed it still throws NPE in 3.3. Actually, I'm positively surprised, how far you get with '$' in a type name, but... FYI here's a stack trace from the logs (the analysis from above still holds): eclipse.buildId=I20070625-1500 java.version=1.5.0_11 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_AU Command-line arguments: -os linux -ws gtk -arch x86 Warning Wed Sep 26 17:39:53 CEST 2007 The 'org.eclipse.jdt.ui.JavaNoTypeCompletionProposalComputer' 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 org.eclipse.jdt.core.compiler.CharOperation.concatWith(CharOperation.java:1048) at org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.readableName(ReferenceBinding.java:1085) at org.eclipse.jdt.internal.compiler.problem.ProblemReporter.invalidType(ProblemReporter.java:3391) at org.eclipse.jdt.internal.compiler.ast.TypeReference.reportInvalidType(TypeReference.java:195) at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:138) at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypesFor(SourceTypeBinding.java:1358) at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.methods(SourceTypeBinding.java:1099) at org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding.availableMethods(ReferenceBinding.java:174) at org.eclipse.jdt.internal.codeassist.CompletionEngine.findInterfacesMethods(CompletionEngine.java:4676) at org.eclipse.jdt.internal.codeassist.CompletionEngine.findMethods(CompletionEngine.java:6078) at org.eclipse.jdt.internal.codeassist.CompletionEngine.findFieldsAndMethods(CompletionEngine.java:3430) at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:1066) at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:2098) at org.eclipse.jdt.internal.core.Openable.codeComplete(Openable.java:123) at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:327) at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:320) at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposalComputer.internalComputeCompletionProposals(JavaCompletionProposalComputer.java:180) at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposalComputer.computeCompletionProposals(JavaCompletionProposalComputer.java:148) at org.eclipse.jdt.internal.ui.text.java.CompletionProposalComputerDescriptor.computeCompletionProposals(CompletionProposalComputerDescriptor.java:303) at org.eclipse.jdt.internal.ui.text.java.CompletionProposalCategory.computeCompletionProposals(CompletionProposalCategory.java:264) at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.collectProposals(ContentAssistProcessor.java:251) at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.computeCompletionProposals(ContentAssistProcessor.java:220) at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1759) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:478) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup.java:475) at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:410) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:404) at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1588) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:176) 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:475) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:429) at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:165) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:470) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:821) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:879) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:568) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:510) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:126) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1423) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1100) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1125) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1110) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1137) at org.eclipse.swt.widgets.Widget.gtk_key_press_event(Widget.java:663) at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:2533) at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:679) at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1486) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4234) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3973) at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method) at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:5593) at org.eclipse.swt.widgets.Display.eventProc(Display.java:1192) at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method) at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:1487) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2969) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:153) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176) 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:504) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:443) at org.eclipse.equinox.launcher.Main.run(Main.java:1169)
The NPE does not occur anymore in I20080516-1333 but the behavior is still not correct due to bug 127749 and bug 232803.
Since the NPE no longer occurs the remainder can be addressed in bug 127749. *** This bug has been marked as a duplicate of bug 127749 ***