Bug 32111 - ArrayIndexOutOfBoundsException during delete of members
Summary: ArrayIndexOutOfBoundsException during delete of members
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 RC1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-18 09:28 EST by Gunnar Wagenknecht CLA
Modified: 2003-03-11 06:54 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gunnar Wagenknecht CLA 2003-02-18 09:28:34 EST
The following exception occured during deletion of 271 public static final 
class members via the Outline View.

!SESSION Feb 18, 2003 15:18:28.903 ---------------------------------------------
java.version=1.4.1_01
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=de_DE
Command-line arguments: -os win32 -ws win32 -arch x86 -data p:\harbour-
ide\plugins -install file:D:/eclipse-SDK-2.1/
!ENTRY org.eclipse.ui 4 4 Feb 18, 2003 15:18:28.919
!MESSAGE Unable to restore editor - createElement returned null for input 
element factory: org.eclipse.ui.part.FileEditorInputFactory
!ENTRY org.eclipse.jdt.ui 4 10001 Feb 18, 2003 15:26:24.366
!MESSAGE Internal Error
!STACK 0
java.lang.reflect.InvocationTargetException
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread
(ModalContext.java:307)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:246)
	at org.eclipse.jface.window.ApplicationWindow$1.run
(ApplicationWindow.java:433)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:65)
	at org.eclipse.jface.window.ApplicationWindow.run
(ApplicationWindow.java:430)
	at org.eclipse.ui.internal.WorkbenchWindow.run
(WorkbenchWindow.java:1283)
	at 
org.eclipse.jdt.internal.ui.reorg.DeleteSourceReferencesAction.perform
(DeleteSourceReferencesAction.java:75)
	at org.eclipse.jdt.internal.ui.reorg.SourceReferenceAction$1.run
(SourceReferenceAction.java:56)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:65)
	at org.eclipse.jdt.internal.ui.reorg.SourceReferenceAction.run
(SourceReferenceAction.java:53)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun
(SelectionDispatchAction.java:191)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run
(SelectionDispatchAction.java:169)
	at org.eclipse.jdt.internal.ui.reorg.DualReorgAction.run
(DualReorgAction.java:33)
	at 
org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage.handleKeyReleased
(JavaOutlinePage.java:1101)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage.access$6
(JavaOutlinePage.java:1090)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage$5.keyPressed
(JavaOutlinePage.java:940)
	at org.eclipse.swt.widgets.TypedListener.handleEvent
(TypedListener.java:118)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:836)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1692)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1410)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1289)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:1272)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:845)
	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:247)
	at org.eclipse.core.launcher.Main.run(Main.java:703)
	at org.eclipse.core.launcher.Main.main(Main.java:539)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1000
	at 
org.eclipse.jdt.internal.compiler.ClassFile.completeCodeAttributeForClinit
(ClassFile.java:1887)
	at org.eclipse.jdt.internal.compiler.ClassFile.addProblemClinit
(ClassFile.java:649)
	at org.eclipse.jdt.internal.compiler.ClassFile.createProblemType
(ClassFile.java:2419)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode
(TypeDeclaration.java:454)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.generateCode
(TypeDeclaration.java:539)
	at 
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.generateCode
(CompilationUnitDeclaration.java:177)
	at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:592)
	at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process
(CompilationUnitProblemFinder.java:208)
	at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure
(CompilationUnit.java:90)
	at org.eclipse.jdt.internal.core.CompilationUnit.makeConsistent
(CompilationUnit.java:664)
	at org.eclipse.jdt.internal.core.WorkingCopy.reconcile
(WorkingCopy.java:439)
	at org.eclipse.jdt.internal.core.WorkingCopy.reconcile
(WorkingCopy.java:414)
	at org.eclipse.jdt.internal.core.WorkingCopy.save(WorkingCopy.java:506)
	at org.eclipse.jdt.internal.core.DeleteElementsOperation.processElement
(DeleteElementsOperation.java:134)
	at org.eclipse.jdt.internal.core.MultiOperation.processElements
(MultiOperation.java:160)
	at org.eclipse.jdt.internal.core.DeleteElementsOperation.processElements
(DeleteElementsOperation.java:148)
	at org.eclipse.jdt.internal.core.MultiOperation.executeOperation
(MultiOperation.java:90)
	at org.eclipse.jdt.internal.core.JavaModelOperation.execute
(JavaModelOperation.java:343)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run
(JavaModelOperation.java:671)
	at org.eclipse.core.internal.resources.Workspace.run
(Workspace.java:1588)
	at org.eclipse.jdt.internal.core.JavaElement.runOperation
(JavaElement.java:556)
	at org.eclipse.jdt.internal.core.JavaModel.delete(JavaModel.java:148)
	at org.eclipse.jdt.internal.core.SourceRefElement.delete
(SourceRefElement.java:56)
	at org.eclipse.jdt.internal.ui.reorg.DeleteSourceReferencesAction.delete
(DeleteSourceReferencesAction.java:183)
	at 
org.eclipse.jdt.internal.ui.reorg.DeleteSourceReferencesAction.deleteAll
(DeleteSourceReferencesAction.java:154)
	at 
org.eclipse.jdt.internal.ui.reorg.DeleteSourceReferencesAction.performDeletion
(DeleteSourceReferencesAction.java:117)
	at 
org.eclipse.jdt.internal.ui.reorg.DeleteSourceReferencesAction.access$0
(DeleteSourceReferencesAction.java:97)
	at org.eclipse.jdt.internal.ui.reorg.DeleteSourceReferencesAction$1.run
(DeleteSourceReferencesAction.java:87)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread
(ModalContext.java:296)
	... 31 more
Comment 1 Olivier Thomann CLA 2003-02-18 10:07:57 EST
Would you have a test case I could use to reproduce the problem?
It looks like the resulting compilation unit contains problems. I will 
investigate it as soon as I get steps to reproduce.
Comment 2 Gunnar Wagenknecht CLA 2003-02-18 10:31:33 EST
Perhaps, try the following one. Although I'm sure that the compilation unit 
didn't have compile errors.

- import "org.eclipse.jdt.core"
- look for "IProblem"
- create a new Java project
- create a new package in the new Java project
- copy IProblem to the new package (Copy & Paste)
- also copy missing type and fix the import
- select all public static final fields in the Outline View
- delete the fields

During deletion the exception was thrown. The resulting compilation unit 
already had some members deleted and thus compile errors occured.

Comment 3 Olivier Thomann CLA 2003-02-18 10:37:21 EST
Thanks. I am investigating this problem. It looks like the compilation unit is 
recompiled before all fields have been removed.
Comment 4 Gunnar Wagenknecht CLA 2003-02-18 10:42:41 EST
I also recognizied a performance lost while deleting members in M5. It seems 
like a seperate operation is invoked for every selected member.
Comment 5 Olivier Thomann CLA 2003-02-18 12:04:29 EST
There is two problems.
I fixed the problem for JDT/Core. We missed a check that we have enough room 
while generating a .class file during this operation. I will run all tests 
prior to release.
The second problem is a performance issue against JDT/UI. The UI calls a delete 
operation for each field instead of batching it for all the fields. Batching 
this operation would improve the numerous deltas sent during the deletion of 
all fields. I opened a separate bug report against JDT/UI for this issue.
See bug 32138.
Comment 6 Gunnar Wagenknecht CLA 2003-02-18 12:06:21 EST
Thanks
Comment 7 Olivier Thomann CLA 2003-02-18 12:11:31 EST
Fixed and released in 2.1 stream.
Thanks for the excellent test case and steps to reproduce. It helps a lot to
track down the bug.
Comment 8 David Audel CLA 2003-03-11 06:54:51 EST
Verified.