Bug 61075

Summary: [Compiler] implementation uses numerous ArrayIndexOutOfBoundsException
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: fraenkel
Version: 3.0Keywords: performance
Target Milestone: 3.0 M9   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Initial set none

Description Philipe Mulet CLA 2004-05-05 12:05:06 EDT
Build 20040428

The implementation relies on not checking array length upfront and rather deal 
with exceptions. However, these seem to be quite frequent, and we may either 
change our default sizes for arrays, or perform bound checks.
Comment 1 Michael Fraenkel CLA 2004-05-06 23:16:43 EDT
Created attachment 10379 [details]
Initial set

Here are a couple of places which removed the Exception case.
I actually did two implementations of CodeStream, but according to my crystal
ball, this more verbose method actually performs better across the JVMs I
tested.

There are two places in Scanner which I did not fix because I haven't quite
figured out how to untangle the logic to simplify it.  Its getNextToken and
getNextCharAsJavaIdentifier.
There are obviously other places to fix but these were the major ones that
popped up in the debugger during a compile/index of a bunch of plugins.
Comment 2 Michael Fraenkel CLA 2004-05-07 15:44:22 EDT
There is a bug in the patch which I need to track down.  It seems that the 
parsing is adding an extra character because I see a box in the package name 
when I perform an Open Type (Ctrl-T) and type some class name.
Comment 3 Michael Fraenkel CLA 2004-05-07 17:25:05 EDT
Disregard my babble.  There seems to be an issue with I20040506 which is 
causing the box character to appear.  Don't know if its a JDT problem or a 
general UI issue.
Comment 4 Kent Johnson CLA 2004-05-11 17:10:54 EDT
Actually we catch ArrayIndexOutOfBoundsException in very few places which are 
not error cases (I released a couple changes).

The main problem is with IndexOutOfBoundsException, see bug 38839.
Comment 5 Olivier Thomann CLA 2004-05-18 13:38:32 EDT
Cannot really verify this PR.
Verified in 200405180816 looking at the source code.