title: Why does IndexOutOfBoundsException now have a constructor with a long index as a parameter in Java 16?
body: <p>I was checking the implementation of <a href="https://code.yawk.at/java/16/java.base/java/lang/IndexOutOfBoundsException.java" rel="noreferrer">IndexOutOfBoundsException</a> in JDK 16, and I have noticed that a new constructor with a <code>long</code> index has been introduced:</p>
  <pre><code>/**
   * Constructs a new {@code IndexOutOfBoundsException} class with an
   * argument indicating the illegal index.
   *
   * &lt;p&gt;The index is included in this exception's detail message.  The
   * exact presentation format of the detail message is unspecified.
   *
   * @param index the illegal index.
   * @since 16
   */
  public IndexOutOfBoundsException(long index) {
      super(&quot;Index out of range: &quot; + index);
  }
  </code></pre>
  <p>From what I know, array indices are usually <code>int</code> values, and this is confirmed in the <a href="https://docs.oracle.com/javase/specs/jls/se16/html/jls-10.html#jls-10.4" rel="noreferrer">Language Specification section §10.4</a>:</p>
  <blockquote>
  <p>Arrays must be indexed by <code>int</code> values; <code>short</code>, <code>byte</code>, or <code>char</code> values may also be used as index values because they are subjected to unary numeric promotion (§5.6) and become <code>int</code> values.</p>
  </blockquote>
  <blockquote>
  <p>An attempt to access an array component with a <code>long</code> index value results in a compile-time error.</p>
  </blockquote>
  <p>Any idea when (and why) this <code>long</code> index constructor would be used ?</p>