JDK-4819074 : Remove the index < 0 test from RangeCheck in ArrayList
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.util
  • Affected Version: 1.4.1
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2003-02-14
  • Updated: 2003-06-20
  • Resolved: 2003-06-20
Related Reports
Relates :  
Description

Name: nt126004			Date: 02/14/2003


FULL PRODUCT VERSION :
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-b21)
Java HotSpot(TM) Client VM (build 1.4.1-b21, mixed mode)

A DESCRIPTION OF THE PROBLEM :
The RangeCheck method of ArrayList tests for the condition
index < 0 and throws an IndexOutOfBounds exception if
violated.  However, any array access with index < 0 will
throw an equivalent ArrayIndexOutOfBounds exception.  Common
operations in ArrayList such as get and set immediately
follow the call to RangeCheck with an array access.  This
makes the test in RangeCheck redundant and causes an
unnecessary test to be done for these very frequently called
methods.

REPRODUCIBILITY :
This bug can be reproduced always.
(Review ID: 181290) 
======================================================================

Comments
EVALUATION This was fixed by (in?) 1.4.2. ###@###.### 2003-06-19
2003-06-19