Bug 61075 - [Compiler] implementation uses numerous ArrayIndexOutOfBoundsException
Summary: [Compiler] implementation uses numerous ArrayIndexOutOfBoundsException
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 M9   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2004-05-05 12:05 EDT by Philipe Mulet CLA
Modified: 2004-05-18 13:38 EDT (History)
1 user (show)

See Also:


Attachments
Initial set (130.55 KB, patch)
2004-05-06 23:16 EDT, Michael Fraenkel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.