Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4819074

Remove the index < 0 test from RangeCheck in ArrayList

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.4.1
    • core-libs



      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)
      ======================================================================

            jjb Josh Bloch (Inactive)
            nthompsosunw Nathanael Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: