Hi all,

For this reproducer:

import jdk.incubator.vector.ByteVector;
import jdk.incubator.vector.VectorSpecies;

public class Test {
    static final VectorSpecies<Byte> SPECIES_128 = ByteVector.SPECIES_128;
    static byte[] a = new byte[8];
    static byte[] b = new byte[8];

    public static void main(String[] args) {
        ByteVector av = ByteVector.fromArray(SPECIES_128, a, 0);
        av.intoArray(b, 0);
        System.out.println("b: " + b[0]);
    }
}

The following IndexOutOfBoundsException message (length -7) is unreasonable.

Exception in thread "main" java.lang.IndexOutOfBoundsException: Index 0 out of 
bounds for length -7

It might be better to fix it like this.

Exception in thread "main" java.lang.IndexOutOfBoundsException: Index 0 out of 
bounds for length 0

Thanks.
Best regards,
Jie

-------------

Commit messages:
 - 8259925: [Vector API] Unreasonable IndexOutOfBoundsException message when 
length < vlen

Changes: https://git.openjdk.java.net/jdk/pull/2127/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2127&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8259925
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2127.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2127/head:pull/2127

PR: https://git.openjdk.java.net/jdk/pull/2127

Reply via email to