Bug 89268 [assist] IllegalArgumentException during code assist on annotation attribute
I20050324 On the following test case: @Ann(at| // code complete here public class A { } @interface Ann { String attr(); } I got the following IllegalArgumentException: java.lang.IllegalArgumentException at org.eclipse.jdt.core.Signature.getParameterCount(Signature.java:950) at org.eclipse.jdt.core.Signature.getParameterTypes(Signature.java:1083) at org.eclipse.jdt.internal.ui.text.java.ProposalLabelProvider.appendUnboundedParameterList(ProposalLabelProvider.java:73) at org.eclipse.jdt.internal.ui.text.java.ProposalLabelProvider.createMethodProposalLabel(ProposalLabelProvider.java:168) at org.eclipse.jdt.internal.ui.text.java.ProposalLabelProvider.createLabel(ProposalLabelProvider.java:323) at org.eclipse.jdt.internal.ui.text.java.ResultCollector.createAnnotationAttributeReferenceProposal(ResultCollector.java:392) at org.eclipse.jdt.internal.ui.text.java.ResultCollector.acceptAnnotationAttributeReference(ResultCollector.java:387) at org.eclipse.jdt.internal.ui.text.java.ResultCollector.accept(ResultCollector.java:506) at org.eclipse.jdt.internal.codeassist.CompletionEngine.findAnnotationAttributes(CompletionEngine.java:1264) at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:874) at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:1167) at org.eclipse.jdt.internal.core.Openable.codeComplete(Openable.java:119) at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:300) at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:293) at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProcessor.internalComputeCompletionProposals(JavaCompletionProcessor.java:358) at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProcessor.computeCompletionProposals(JavaCompletionProcessor.java:332) at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1470) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:250) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$7(CompletionProposalPopup.java:247) at org.eclipse.jface.text.contentassist.CompletionProposalPopup$1.run(CompletionProposalPopup.java:206) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:201) at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1319) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.java:183) at org.eclipse.ui.texteditor.ContentAssistAction$1.run(ContentAssistAction.java:82) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.ui.texteditor.ContentAssistAction.run(ContentAssistAction.java:80) at org.eclipse.jface.action.Action.runWithEvent(Action.java:1003) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:181) at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:108) at org.eclipse.core.commands.Command.execute(Command.java:331) at org.eclipse.core.commands.ParameterizedCommand.execute(ParameterizedCommand.java:390) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:452) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:741) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:784) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:543) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:486) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:110) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:777) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:841) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:866) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:851) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:879) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:875) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1182) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3121) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3024) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3466) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1624) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2525) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1538) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1502) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:306) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:228) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:338) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:151) 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:324) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:268) at org.eclipse.core.launcher.Main.basicRun(Main.java:260) at org.eclipse.core.launcher.Main.run(Main.java:887) at org.eclipse.core.launcher.Main.main(Main.java:871)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/text/java/ResultCollector.java
String completion= String.valueOf(proposal.getCompletion());
		return new JavaCompletionProposal(completion, proposal.getReplaceStart(), getLength(proposal), getImage(descriptor), displayString, computeRelevance(proposal));
	}
	
	private IJavaCompletionProposal createAnonymousTypeProposal(CompletionProposal proposal) {
		if (fCompilationUnit == null || fJavaProject == null)
			return null;
		
		String declaringType= SignatureUtil.stripSignatureToFQN(String.valueOf(proposal.getDeclarationSignature()));
		String completion= String.valueOf(proposal.getCompletion());
		int start= proposal.getReplaceStart();
		int length= getLength(proposal);
		int relevance= computeRelevance(proposal);
		
		String label= fLabelProvider.createAnonymousTypeLabel(proposal);
		
		JavaCompletionProposal javaProposal= new AnonymousTypeCompletionProposal(fJavaProject, fCompilationUnit, start, length, completion, label, declaringType, relevance);
		javaProposal.setProposalInfo(new AnonymousTypeProposalInfo(fJavaProject, proposal));
		return javaProposal;
	}	
	
	private IJavaCompletionProposal createFieldProposal(CompletionProposal proposal) {
		String completion= String.valueOf(proposal.getCompletion());
		int start= proposal.getReplaceStart();
		int length= getLength(proposal);
		String label= fLabelProvider.createLabelWithTypeAndDeclaration(proposal);
		Image image= getImage(fLabelProvider.createFieldImageDescriptor(proposal));
		int relevance= computeRelevance(proposal);
		JavaCompletionProposal javaProposal= new JavaCompletionProposal(completion, start, length, image, label, relevance);
		if (fJavaProject != null)