Bug 124611 - IAE in Signature.createCharArrayTypeSignature
Summary: IAE in Signature.createCharArrayTypeSignature
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.2 M5   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-20 04:08 EST by Dani Megert CLA
Modified: 2006-02-14 10:22 EST (History)
0 users

See Also:


Attachments
Proposed patch (2.55 KB, patch)
2006-01-20 10:56 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2006-01-20 04:08:06 EST
I20060119-0800

1. binary import plug-ins from I20060119-0800
2. open PageLayout (from org.eclipse.ui.workbench plug-in)
==>
!ENTRY org.eclipse.jface 4 2 2006-01-20 10:07:05.883
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.IllegalArgumentException: 
	at org.eclipse.jdt.core.Signature.createCharArrayTypeSignature(Signature.java:619)
	at org.eclipse.jdt.core.Signature.createTypeSignature(Signature.java:595)
	at org.eclipse.jdt.internal.core.SourceMapper.convertTypeNamesToSigs(SourceMapper.java:308)
	at org.eclipse.jdt.internal.core.SourceMapper.enterAbstractMethod(SourceMapper.java:705)
	at org.eclipse.jdt.internal.core.SourceMapper.enterConstructor(SourceMapper.java:648)
	at org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequestor(SourceElementParser.java:990)
	at org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequestor(SourceElementParser.java:1326)
	at org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequestor(SourceElementParser.java:1330)
	at org.eclipse.jdt.internal.compiler.SourceElementParser$LocalDeclarationVisitor.visit(SourceElementParser.java:83)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.traverse(TypeDeclaration.java:1211)
	at org.eclipse.jdt.internal.compiler.ast.QualifiedAllocationExpression.traverse(QualifiedAllocationExpression.java:394)
	at org.eclipse.jdt.internal.compiler.ast.Assignment.traverse(Assignment.java:249)
	at org.eclipse.jdt.internal.compiler.SourceElementParser.visitIfNeeded(SourceElementParser.java:1572)
	at org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequestor(SourceElementParser.java:1045)
	at org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequestor(SourceElementParser.java:1326)
	at org.eclipse.jdt.internal.compiler.SourceElementParser.notifySourceElementRequestor(SourceElementParser.java:855)
	at org.eclipse.jdt.internal.compiler.SourceElementParser.parseCompilationUnit(SourceElementParser.java:1417)
	at org.eclipse.jdt.internal.core.SourceMapper.mapSource(SourceMapper.java:1179)
	at org.eclipse.jdt.internal.core.SourceMapper.mapSource(SourceMapper.java:1118)
	at org.eclipse.jdt.internal.core.ClassFile.mapSource(ClassFile.java:646)
	at org.eclipse.jdt.internal.core.ClassFile.openBuffer(ClassFile.java:540)
	at org.eclipse.jdt.internal.core.Openable.getBuffer(Openable.java:265)
	at org.eclipse.jdt.internal.core.ClassFile.getBuffer(ClassFile.java:272)
	at org.eclipse.jdt.internal.core.BinaryMember.getCategories(BinaryMember.java:57)
	at org.eclipse.jdt.ui.JavaElementLabels.getTypeLabel(JavaElementLabels.java:836)
	at org.eclipse.jdt.ui.JavaElementLabels.getElementLabel(JavaElementLabels.java:422)
	at org.eclipse.jdt.ui.JavaElementLabels.getElementLabel(JavaElementLabels.java:387)
	at org.eclipse.jdt.ui.JavaElementLabels.getTextLabel(JavaElementLabels.java:369)
	at org.eclipse.jdt.internal.ui.viewsupport.JavaUILabelProvider.getText(JavaUILabelProvider.java:161)
	at org.eclipse.jface.viewers.DecoratingLabelProvider.getText(DecoratingLabelProvider.java:137)
	at org.eclipse.jface.viewers.DecoratingLabelProvider.updateLabel(DecoratingLabelProvider.java:235)
	at org.eclipse.jface.viewers.StructuredViewer.buildLabel(StructuredViewer.java:1951)
	at org.eclipse.jface.viewers.TableViewer.doUpdateItem(TableViewer.java:460)
	at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:440)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.runtime.Platform.run(Platform.java:785)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:44)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:148)
	at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:1859)
	at org.eclipse.jface.viewers.TableViewer.createItem(TableViewer.java:345)
	at org.eclipse.jface.viewers.TableViewer.internalRefreshAll(TableViewer.java:904)
	at org.eclipse.jface.viewers.TableViewer.internalRefresh(TableViewer.java:800)
	at org.eclipse.jface.viewers.TableViewer.internalRefresh(TableViewer.java:789)
	at org.eclipse.jface.viewers.StructuredViewer$7.run(StructuredViewer.java:1322)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1259)
	at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1320)
	at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1279)
	at org.eclipse.jface.viewers.TableViewer.inputChanged(TableViewer.java:750)
	at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:249)
	at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1475)
	at org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart.setViewerInput(JavaBrowsingPart.java:793)
	at org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart.setInput(JavaBrowsingPart.java:779)
	at org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart.adjustInputAndSetSelection(JavaBrowsingPart.java:1011)
	at org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart.setSelectionFromEditor(JavaBrowsingPart.java:1177)
	at org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart.selectionChanged(JavaBrowsingPart.java:717)
	at org.eclipse.jdt.internal.ui.browsing.TypesView.selectionChanged(TypesView.java:201)
	at org.eclipse.ui.internal.AbstractSelectionService.firePostSelection(AbstractSelectionService.java:179)
	at org.eclipse.ui.internal.AbstractSelectionService.setActivePart(AbstractSelectionService.java:284)
	at org.eclipse.ui.internal.WorkbenchPagePartList.fireActivePartChanged(WorkbenchPagePartList.java:59)
	at org.eclipse.ui.internal.PartList.setActivePart(PartList.java:117)
	at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:2961)
	at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage.java:555)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2387)
	at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2311)
	at org.eclipse.ui.internal.WorkbenchPage.access$10(WorkbenchPage.java:2303)
	at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:2289)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2284)
	at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2269)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:266)
	at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor(EditorUtility.java:143)
	at org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run(OpenTypeAction.java:65)
	at org.eclipse.jdt.internal.ui.actions.OpenTypeAction.run(OpenTypeAction.java:78)
	at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251)
	at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:223)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:530)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:480)
	at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:433)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:920)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3287)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2907)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1790)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1754)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:400)
	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:109)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:373)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:168)
	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.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)
Comment 1 Olivier Thomann CLA 2006-01-20 10:56:29 EST
Created attachment 33354 [details]
Proposed patch

The problem occurs when trying to retrieve the parameter types for a declaring type of a class inside an anonymous class.
See the code in org.eclipse.ui.internal.PerspectiveSwitcher#hookDragSupport()

Look at the creation of the class PerspectiveDropTarget. When trying to map the constructor, we try to find the type name of the enclosing type. And we retrieve an empty name.
This is why we get the IllegalArgumentException.
Comment 2 Olivier Thomann CLA 2006-01-20 10:58:40 EST
Jérôme,

Could you please review the patch? It is highly possible that there is a better way to retrieve the required type name. I also noticed that the parameter names are one item shorter than the corresponding type names. Is this desired?

To reproduce you need to switch to the Java Browsing Perspective before you do the step 2 in comment 0.

Let me know if you need any help.
Comment 3 Dani Megert CLA 2006-02-01 10:47:32 EST
Ping.

This is quite nasty: when opening a type that runs into this I get several error dialogs until I can edit the file.
Comment 4 Jerome Lanneluc CLA 2006-02-01 16:16:16 EST
Patch is good except that there is no need for the null check on the class file since it is a binary type.

Released it (without the null check) and added regression test AttachSourceTests#testInnerClass9()
Comment 5 Frederic Fusier CLA 2006-02-14 10:22:17 EST
Verified for 3.2 M5 using build I20060214-0010.