jdk/src/java.base/share/classes/java/lang/ArrayIndexOutOfBoundsException.java
changeset 32929 7e1bb9268b8a
parent 25859 3317bb8137f4
child 37345 9cb6e1141bdb
equal deleted inserted replaced
32928:a3f03999ed62 32929:7e1bb9268b8a
     1 /*
     1 /*
     2  * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    24  */
    24  */
    25 
    25 
    26 package java.lang;
    26 package java.lang;
    27 
    27 
    28 /**
    28 /**
    29  * Thrown to indicate that an array has been accessed with an
    29  * Thrown to indicate that an array has been accessed with an illegal index. The
    30  * illegal index. The index is either negative or greater than or
    30  * index is either negative or greater than or equal to the size of the array.
    31  * equal to the size of the array.
       
    32  *
    31  *
    33  * @author  unascribed
    32  * @since 1.0
    34  * @since   1.0
       
    35  */
    33  */
    36 public
    34 public class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException {
    37 class ArrayIndexOutOfBoundsException extends IndexOutOfBoundsException {
       
    38     private static final long serialVersionUID = -5116101128118950844L;
    35     private static final long serialVersionUID = -5116101128118950844L;
    39 
    36 
    40     /**
    37     /**
    41      * Constructs an <code>ArrayIndexOutOfBoundsException</code> with no
    38      * Constructs an {@code ArrayIndexOutOfBoundsException} with no detail
    42      * detail message.
    39      * message.
    43      */
    40      */
    44     public ArrayIndexOutOfBoundsException() {
    41     public ArrayIndexOutOfBoundsException() {
    45         super();
    42         super();
    46     }
    43     }
    47 
    44 
    48     /**
    45     /**
    49      * Constructs a new <code>ArrayIndexOutOfBoundsException</code>
    46      * Constructs an {@code ArrayIndexOutOfBoundsException} class with the
    50      * class with an argument indicating the illegal index.
    47      * specified detail message.
    51      *
    48      *
    52      * @param   index   the illegal index.
    49      * @param s the detail message.
       
    50      */
       
    51     public ArrayIndexOutOfBoundsException(String s) {
       
    52         super(s);
       
    53     }
       
    54 
       
    55     /**
       
    56      * Constructs a new {@code ArrayIndexOutOfBoundsException} class with an
       
    57      * argument indicating the illegal index.
       
    58      *
       
    59      * <p>The index is included in this exception's detail message.  The
       
    60      * exact presentation format of the detail message is unspecified.
       
    61      *
       
    62      * @param index the illegal index.
    53      */
    63      */
    54     public ArrayIndexOutOfBoundsException(int index) {
    64     public ArrayIndexOutOfBoundsException(int index) {
    55         super("Array index out of range: " + index);
    65         super("Array index out of range: " + index);
    56     }
    66     }
    57 
    67 
    58     /**
    68     /**
    59      * Constructs an <code>ArrayIndexOutOfBoundsException</code> class
    69      * Constructs a new {@code ArrayIndexOutOfBoundsException} class with
    60      * with the specified detail message.
    70      * arguments indicating two out of bound values.
    61      *
    71      *
    62      * @param   s   the detail message.
    72      * <p>The out of bound values are included in this exception's detail
       
    73      * message.  The exact presentation format of the detail message is
       
    74      * unspecified.
       
    75      *
       
    76      * @param a the first out of bound value.
       
    77      * @param b the second out of bound value.
       
    78      * @since 9
    63      */
    79      */
    64     public ArrayIndexOutOfBoundsException(String s) {
    80     public ArrayIndexOutOfBoundsException(int a, int b) {
    65         super(s);
    81         super("Array indexed access out of bounds: " + a + ", " + b);
    66     }
    82     }
    67 }
    83 }