Bug 45982 - Array out of bounds error while editing Java file
Summary: Array out of bounds error while editing Java file
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.0 M5   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 46149 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-11-03 15:07 EST by Jonathan Gossage CLA
Modified: 2003-11-20 12:42 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Gossage CLA 2003-11-03 15:07:00 EST
I am using I20030917 with the Sun SDK 1.4.2_02.

I was editing a new Java file - see below - and I got a popup saying that an 
error had occurred and I should check the Eclipse log. The error occurred 
while I was trying to type the word ArrayList.

/*
 * Created on Nov 3, 2003
 *
 * To change this generated comment go to 
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
package com.cryptocard.cryptoadmin.consolecli;

/**
 * @author jonathan
 *
 * To change this generated comment go to 
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class CliSource extends CliCommandSource
{
    /**
     * 
     */
    public CliSource(Array) <<<========= Error happened here
    {
        super();
        // TODO Auto-generated constructor stub
    }
}

The stack dump from the Eclipse log follows

!ENTRY org.eclipse.ui.workbench 4 2 Nov 03, 2003 14:37:08.559
!MESSAGE Problems occurred when invoking code from plug-
in: "org.eclipse.ui.workbench".
!STACK 0
java.lang.ArrayIndexOutOfBoundsException: 1
	at org.eclipse.jdt.internal.compiler.parser.diagnose.Util.isInInterval
(Util.java:165)
	at 
org.eclipse.jdt.internal.compiler.parser.diagnose.LexStream.readTokenFromScanne
r(LexStream.java:81)
	at org.eclipse.jdt.internal.compiler.parser.diagnose.LexStream.token
(LexStream.java:137)
	at org.eclipse.jdt.internal.compiler.parser.diagnose.LexStream.kind
(LexStream.java:177)
	at 
org.eclipse.jdt.internal.compiler.parser.diagnose.DiagnoseParser.diagnoseParse
(DiagnoseParser.java:288)
	at org.eclipse.jdt.internal.compiler.parser.Parser.reportSyntaxErrors
(Parser.java:5654)
	at org.eclipse.jdt.internal.compiler.parser.Parser.parse
(Parser.java:5633)
	at org.eclipse.jdt.internal.compiler.parser.Parser.parse
(Parser.java:5944)
	at org.eclipse.jdt.internal.compiler.parser.Parser.parse
(Parser.java:5916)
	at 
org.eclipse.jdt.internal.compiler.SourceElementParser.parseCompilationUnit
(SourceElementParser.java:1041)
	at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure
(CompilationUnit.java:121)
	at org.eclipse.jdt.internal.core.Openable.generateInfos
(Openable.java:200)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed
(JavaElement.java:487)
	at org.eclipse.jdt.internal.core.CompilationUnit.makeConsistent
(CompilationUnit.java:918)
	at 
org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation
(ReconcileWorkingCopyOperation.java:48)
	at org.eclipse.jdt.internal.core.JavaModelOperation.execute
(JavaModelOperation.java:366)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run
(JavaModelOperation.java:705)
	at org.eclipse.jdt.internal.core.JavaElement.runOperation
(JavaElement.java:523)
	at org.eclipse.jdt.internal.core.CompilationUnit.reconcile
(CompilationUnit.java:1031)
	at org.eclipse.jdt.internal.core.CompilationUnit.reconcile
(CompilationUnit.java:1007)
	at org.eclipse.jdt.internal.core.CompilationUnit.reconcile
(CompilationUnit.java:1000)
	at 
org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart.getElementForInputAt
(JavaBrowsingPart.java:1295)
	at 
org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart.setSelectionFromEditor
(JavaBrowsingPart.java:1146)
	at 
org.eclipse.jdt.internal.ui.browsing.JavaBrowsingPart.selectionChanged
(JavaBrowsingPart.java:698)
	at org.eclipse.jdt.internal.ui.browsing.TypesView.selectionChanged
(TypesView.java:200)
	at org.eclipse.ui.internal.AbstractSelectionService$4.run
(AbstractSelectionService.java:178)
	at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:1016)
	at org.eclipse.core.runtime.Platform.run(Platform.java:420)
	at org.eclipse.ui.internal.AbstractSelectionService.firePostSelection
(AbstractSelectionService.java:176)
	at org.eclipse.ui.internal.AbstractSelectionService$2.selectionChanged
(AbstractSelectionService.java:76)
	at org.eclipse.jface.text.TextViewer.firePostSelectionChanged
(TextViewer.java:2099)
	at org.eclipse.jface.text.TextViewer.firePostSelectionChanged
(TextViewer.java:2052)
	at org.eclipse.jface.text.TextViewer$4.run(TextViewer.java:2031)
	at org.eclipse.swt.widgets.Display.runTimer(Display.java:2229)
	at org.eclipse.swt.widgets.Display.messageProc(Display.java:1763)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1343)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1875)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2037)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:2020)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:858)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461)
	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.basicRun(Main.java:295)
	at org.eclipse.core.launcher.Main.run(Main.java:751)
	at org.eclipse.core.launcher.Main.main(Main.java:587)
Comment 1 David Audel CLA 2003-11-04 06:28:43 EST
I can not reproduce the problem.

Jonathan - Can you reproduce the bug with this simple test case every time?
Comment 2 Jonathan Gossage CLA 2003-11-04 08:34:16 EST
Unfortunately, no. I get anywhere between 10 and 20 of these a day and they 
all exhibit different stack traces. I run on a dual 933Mhz machine with 1GB of 
physical memory at work. I also experience the problem at home but less 
frequently. There I run on a dual Athlon MP2200 system with 2GB of memory. I 
believe that all these problems are related to thread synchronization issues 
between the code that is parsing the statement being typed and the code that 
is managing the GUI.

Reproducing the problem is difficult because I believe that you need an exact 
sequence of timing to make any specific set of symptoms reappear. I believe 
that you may need to do a code audit to verify that there are no 
synchronization holes and plug those which may exist.

Regards

Jonathan
Comment 3 David Audel CLA 2003-11-05 06:36:54 EST
The method 
org.eclipse.jdt.internal.compiler.parser.diagnose.Util#computeDietRange
(TypeDeclaration[] types) use static fields.
I think the problem come from these fields and multithreading. I change 
computeDietRange() to not use static fields.

Fixed.

Comment 4 David Audel CLA 2003-11-06 07:00:28 EST
*** Bug 46149 has been marked as a duplicate of this bug. ***
Comment 5 David Audel CLA 2003-11-20 12:42:41 EST
Verified.