Bug 75644 - Array index out of bounds doing code assist
Summary: Array index out of bounds doing code assist
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M3   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 74680 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-10-05 10:37 EDT by Darin Wright CLA
Modified: 2004-11-04 06:11 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Darin Wright CLA 2004-10-05 10:37:18 EDT
In a detail formatter, I got an exception performing code assist. I was 
performing code assist for a "Hashtable" detail formatter after the "h" 
in "while (it.h"...


StringBuffer buf = new StringBuffer();
Iterator it = entrySet().iterator();

buf.append("{");
while (it.h) {
    Map.Entry e = (Map.Entry) (it.next());
        Object key = e.getKey();
        Object value = e.getValue();
        buf.append(key + "=" + value);

    if (i < max)
	buf.append(",\n");
}
buf.append("}");
return buf.toString();


!ENTRY org.eclipse.ui 4 0 Oct 05, 2004 09:20:45.328
!MESSAGE Array index out of range: 2
!STACK 0
java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 2
	at 
org.eclipse.jdt.internal.compiler.problem.ProblemReporter.invalidType
(ProblemReporter.java:2381)
	at 
org.eclipse.jdt.internal.compiler.ast.TypeReference.reportInvalidType
(TypeReference.java:157)
	at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType
(TypeReference.java:140)
	at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveSuperType
(TypeReference.java:104)
	at org.eclipse.jdt.internal.compiler.lookup.ClassScope.findSupertype
(ClassScope.java:959)
	at 
org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectSuperInterfaces
(ClassScope.java:709)
	at 
org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectTypeHierarchy
(ClassScope.java:767)
	at 
org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectMemberTypes
(ClassScope.java:637)
	at 
org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectTypeHierarchy
(ClassScope.java:774)
	at 
org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.connectTypeHierar
chy(CompilationUnitScope.java:241)
	at 
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.completeTypeBindings
(LookupEnvironment.java:246)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete
(CompletionEngine.java:833)
	at org.eclipse.jdt.internal.core.BinaryType.codeComplete
(BinaryType.java:91)
	at org.eclipse.jdt.internal.core.BinaryType.codeComplete
(BinaryType.java:58)
	at 
org.eclipse.jdt.internal.debug.ui.DetailFormatterCompletionProcessor.computeCom
pletionProposals(DetailFormatterCompletionProcessor.java:50)
	at 
org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposal
s(ContentAssistant.java:1472)
	at 
org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals
(CompletionProposalPopup.java:245)
	at 
org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$7
(CompletionProposalPopup.java:241)
	at org.eclipse.jface.text.contentassist.CompletionProposalPopup$1.run
(CompletionProposalPopup.java:200)
	at org.eclipse.swt.custom.BusyIndicator.showWhile
(BusyIndicator.java:69)
	at 
org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals
(CompletionProposalPopup.java:195)
	at 
org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions
(ContentAssistant.java:1320)
	at org.eclipse.jface.text.source.SourceViewer.doOperation
(SourceViewer.java:694)
	at org.eclipse.jdt.internal.debug.ui.DetailFormatterDialog$1.execute
(DetailFormatterDialog.java:151)
	at org.eclipse.ui.internal.commands.Command.execute(Command.java:130)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand
(WorkbenchKeyboard.java:463)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press
(WorkbenchKeyboard.java:956)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent
(WorkbenchKeyboard.java:997)
	at 
org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings
(WorkbenchKeyboard.java:541)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$2
(WorkbenchKeyboard.java:488)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$1.handleEvent
(WorkbenchKeyboard.java:241)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:748)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:799)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:824)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:809)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:837)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:833)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1096)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3066)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:2977)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:3351)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1489)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2441)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:706)
	at org.eclipse.jface.window.Window.open(Window.java:684)
	at 
org.eclipse.jdt.internal.debug.ui.actions.EditDetailFormatterAction.run
(EditDetailFormatterAction.java:54)
	at 
org.eclipse.jdt.internal.debug.ui.actions.ObjectActionDelegate.runWithEvent
(ObjectActionDelegate.java:87)
	at org.eclipse.ui.internal.PluginAction.runWithEvent
(PluginAction.java:288)
	at 
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:555)
	at org.eclipse.jface.action.ActionContributionItem.access$2
(ActionContributionItem.java:505)
	at org.eclipse.jface.action.ActionContributionItem$6.handleEvent
(ActionContributionItem.java:419)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:800)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2784)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2443)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1443)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1414)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench
(Workbench.java:271)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144)
	at org.eclipse.ui.internal.ide.IDEApplication.run
(IDEApplication.java:102)
	at org.eclipse.core.internal.runtime.PlatformActivator$1.run
(PlatformActivator.java:335)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run
(EclipseStarter.java:273)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run
(EclipseStarter.java:129)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:85)
	at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:58)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:60)
	at java.lang.reflect.Method.invoke(Method.java:391)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:185)
	at org.eclipse.core.launcher.Main.run(Main.java:684)
	at org.eclipse.core.launcher.Main.main(Main.java:668)
Comment 1 Darin Wright CLA 2004-10-05 10:37:32 EDT
(I20041005)
Comment 2 Luc Bourlier CLA 2004-10-05 18:32:35 EDT
That looks like a problem in the reporting problem code of the compiler.
Moving to JDT/Core.

Bug 74680 should be the same problem (not the same stack trace, but close. Same
context).
Comment 3 David Audel CLA 2004-10-08 05:06:36 EDT
Fixed and test added
  SnippetCompletionTests#testCodeSnippetAssistForClassFileWithDollar()

TypeConverter#createTypeReference did not compute correctlty qualified name
position.
Comment 4 David Audel CLA 2004-10-08 05:08:05 EDT
*** Bug 74680 has been marked as a duplicate of this bug. ***
Comment 5 Frederic Fusier CLA 2004-11-04 06:11:03 EST
Verified for 3.1 M3 with build I200411040010 + jdt.core HEAD