Bug 112030 - ContentAssist fails with IllegalArgumentException on primitive array class
Summary: ContentAssist fails with IllegalArgumentException on primitive array class
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows Server 2003
: P3 minor with 1 vote (vote)
Target Milestone: 3.2 RC2   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-10-08 05:43 EDT by Evgeny V. Chesnokov CLA
Modified: 2006-04-28 11:54 EDT (History)
1 user (show)

See Also:


Attachments
Proposed fix (1.78 KB, patch)
2006-04-19 11:43 EDT, David Audel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Evgeny V. Chesnokov CLA 2005-10-08 05:43:30 EDT
Good day.
Here's the line of code:
new int[0].getClass().
when i press Ctrl+Space after that dot, i get a dialog message java.lang.
IllegalArgumentException. This also takes place for some other primitive values, 
like byte[] or char[](i didn't check all of them). All's fine for Objects and 
Object arrays. I'm using Eclipse 3.2m2. I checked this line of code in Eclipse 
3.1m7, it worked fine.
Here's the stack trace:
========================================================================
!ENTRY org.eclipse.ui 4 4 2005-10-08 16:41:56.765
!MESSAGE "Content Assist" did not complete normally.  Please see the log for 
more information.

!ENTRY org.eclipse.ui 4 0 2005-10-08 16:41:56.765
!MESSAGE java.lang.IllegalArgumentException
!STACK 0
java.lang.IllegalArgumentException
	at org.eclipse.jdt.internal.core.util.Util.scanTypeBoundSignature(Util.
java:2606)
	at org.eclipse.jdt.internal.core.util.Util.scanTypeSignature(Util.java:
2375)
	at org.eclipse.jdt.core.Signature.getReturnType(Signature.java:1635)
	at org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider.
createMethodProposalLabel(CompletionProposalLabelProvider.java:182)
	at org.eclipse.jdt.ui.text.java.CompletionProposalLabelProvider.
createLabel(CompletionProposalLabelProvider.java:351)
	at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.
computeDisplayString(LazyJavaCompletionProposal.java:442)
	at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.
getDisplayString(LazyJavaCompletionProposal.java:436)
	at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.
computeSortString(LazyJavaCompletionProposal.java:803)
	at org.eclipse.jdt.internal.ui.text.java.LazyJavaCompletionProposal.
getSortString(LazyJavaCompletionProposal.java:793)
	at org.eclipse.jdt.ui.text.java.CompletionProposalComparator.
getSortKey(CompletionProposalComparator.java:73)
	at org.eclipse.jdt.ui.text.java.CompletionProposalComparator.
compare(CompletionProposalComparator.java:68)
	at java.util.Arrays.mergeSort(Unknown Source)
	at java.util.Arrays.mergeSort(Unknown Source)
	at java.util.Arrays.mergeSort(Unknown Source)
	at java.util.Arrays.mergeSort(Unknown Source)
	at java.util.Arrays.mergeSort(Unknown Source)
	at java.util.Arrays.sort(Unknown Source)
	at java.util.Collections.sort(Unknown Source)
	at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProcessor.
filter(JavaCompletionProcessor.java:147)
	at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProcessor.
filterAndSortProposals(JavaCompletionProcessor.java:125)
	at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.
computeCompletionProposals(ContentAssistProcessor.java:91)
	at org.eclipse.jface.text.contentassist.ContentAssistant.
computeCompletionProposals(ContentAssistant.java:1558)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.
computeProposals(CompletionProposalPopup.java:350)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.
access$15(CompletionProposalPopup.java:347)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.
run(CompletionProposalPopup.java:293)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup.
showProposals(CompletionProposalPopup.java:287)
	at org.eclipse.jface.text.contentassist.ContentAssistant.
showPossibleCompletions(ContentAssistant.java:1405)
	at org.eclipse.jdt.internal.ui.javaeditor.
CompilationUnitEditor$AdaptedSourceViewer.doOperation(CompilationUnitEditor.
java:201)
	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:996)
	at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:182)
	at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.
execute(LegacyHandlerWrapper.java:108)
	at org.eclipse.core.commands.Command.execute(Command.java:311)
	at org.eclipse.core.commands.ParameterizedCommand.
execute(ParameterizedCommand.java:397)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.
executeCommand(WorkbenchKeyboard.java:459)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.
java:781)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.
processKeyEvent(WorkbenchKeyboard.java:828)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.
filterKeySequenceBindings(WorkbenchKeyboard.java:550)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.
access$3(WorkbenchKeyboard.java:493)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.
handleEvent(WorkbenchKeyboard.java:117)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:971)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:883)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:908)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:893)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:921)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:917)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1231)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3157)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:3058)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3830)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1679)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2821)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1755)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1719)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:
368)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143)
	at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:106)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.
run(PlatformActivator.java:226)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.
java:377)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.
java:164)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:282)
	at org.eclipse.core.launcher.Main.run(Main.java:977)
	at org.eclipse.core.launcher.Main.main(Main.java:952)
========================================================================
Hope that helps.
 Goodbye,
   Evgeny.
Comment 1 David Audel CLA 2006-04-19 11:43:00 EDT
Created attachment 38936 [details]
Proposed fix
Comment 2 David Audel CLA 2006-04-19 11:45:12 EDT
Philippe - Do you want this fix for 3.2RC2 ?

Util.scanTypeBoundSignature() check if the signature length is at least 4 but the length can be 3 with an array of base type (eg. '+[I').
Comment 3 Philipe Mulet CLA 2006-04-19 12:08:47 EDT
+1 for 3.2RC2
Comment 4 David Audel CLA 2006-04-19 12:20:31 EDT
Fix released and test added
  SignatureTests#testGetReturnType2()
Comment 5 Olivier Thomann CLA 2006-04-28 11:54:49 EDT
Verified with I20060427-1600 for 3.2RC2