mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8268698: Use Objects.check{Index,FromToIndex,FromIndexSize} for java.base
Reviewed-by: mchung, rriggs
This commit is contained in:
parent
a4e5f08fef
commit
afe957cd97
40 changed files with 186 additions and 284 deletions
|
@ -28,9 +28,6 @@ package java.lang.invoke;
|
|||
import java.util.*;
|
||||
import jdk.internal.vm.annotation.Stable;
|
||||
|
||||
import static java.lang.invoke.MethodHandleStatics.rangeCheck1;
|
||||
import static java.lang.invoke.MethodHandleStatics.rangeCheck2;
|
||||
|
||||
/** Utility class for implementing ConstantGroup. */
|
||||
/*non-public*/
|
||||
abstract class AbstractConstantGroup implements ConstantGroup {
|
||||
|
@ -119,11 +116,11 @@ abstract class AbstractConstantGroup implements ConstantGroup {
|
|||
super(end - start);
|
||||
this.self = self;
|
||||
this.offset = start;
|
||||
rangeCheck2(start, end, size);
|
||||
Objects.checkFromToIndex(start, end, size);
|
||||
}
|
||||
|
||||
private int mapIndex(int index) {
|
||||
return rangeCheck1(index, size) + offset;
|
||||
return Objects.checkIndex(index, size) + offset;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -143,7 +140,7 @@ abstract class AbstractConstantGroup implements ConstantGroup {
|
|||
|
||||
@Override
|
||||
public ConstantGroup subGroup(int start, int end) {
|
||||
rangeCheck2(start, end, size);
|
||||
Objects.checkFromToIndex(start, end, size);
|
||||
return new SubGroup(self, offset + start, offset + end);
|
||||
}
|
||||
|
||||
|
@ -160,7 +157,7 @@ abstract class AbstractConstantGroup implements ConstantGroup {
|
|||
@Override
|
||||
public int copyConstants(int start, int end,
|
||||
Object[] buf, int pos) throws LinkageError {
|
||||
rangeCheck2(start, end, size);
|
||||
Objects.checkFromToIndex(start, end, size);
|
||||
return self.copyConstants(offset + start, offset + end,
|
||||
buf, pos);
|
||||
}
|
||||
|
@ -169,7 +166,7 @@ abstract class AbstractConstantGroup implements ConstantGroup {
|
|||
public int copyConstants(int start, int end,
|
||||
Object[] buf, int pos,
|
||||
Object ifNotPresent) {
|
||||
rangeCheck2(start, end, size);
|
||||
Objects.checkFromToIndex(start, end, size);
|
||||
return self.copyConstants(offset + start, offset + end,
|
||||
buf, pos, ifNotPresent);
|
||||
}
|
||||
|
@ -189,7 +186,7 @@ abstract class AbstractConstantGroup implements ConstantGroup {
|
|||
this.offset = start;
|
||||
this.resolving = resolving;
|
||||
this.ifNotPresent = ifNotPresent;
|
||||
rangeCheck2(start, end, self.size());
|
||||
Objects.checkFromToIndex(start, end, self.size());
|
||||
}
|
||||
AsList(ConstantGroup self, int start, int end) {
|
||||
this(self, start, end, true, null);
|
||||
|
@ -200,7 +197,7 @@ abstract class AbstractConstantGroup implements ConstantGroup {
|
|||
}
|
||||
|
||||
private int mapIndex(int index) {
|
||||
return rangeCheck1(index, size) + offset;
|
||||
return Objects.checkIndex(index, size) + offset;
|
||||
}
|
||||
|
||||
@Override public final int size() {
|
||||
|
@ -223,7 +220,7 @@ abstract class AbstractConstantGroup implements ConstantGroup {
|
|||
}
|
||||
|
||||
@Override public List<Object> subList(int start, int end) {
|
||||
rangeCheck2(start, end, size);
|
||||
Objects.checkFromToIndex(start, end, size);
|
||||
return new AsList(self, offset + start, offset + end,
|
||||
resolving, ifNotPresent);
|
||||
}
|
||||
|
|
|
@ -189,15 +189,4 @@ class MethodHandleStatics {
|
|||
if (obj != null || obj2 != null) message = message + ": " + obj + ", " + obj2;
|
||||
return message;
|
||||
}
|
||||
/*non-public*/
|
||||
static void rangeCheck2(int start, int end, int size) {
|
||||
if (0 > start || start > end || end > size)
|
||||
throw new IndexOutOfBoundsException(start+".."+end);
|
||||
}
|
||||
/*non-public*/
|
||||
static int rangeCheck1(int index, int size) {
|
||||
if (0 > index || index >= size)
|
||||
throw new IndexOutOfBoundsException(index);
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2179,15 +2179,6 @@ public abstract class VarHandle implements Constable {
|
|||
UNSAFE.fullFence();
|
||||
}
|
||||
|
||||
static final BiFunction<String, List<Number>, ArrayIndexOutOfBoundsException>
|
||||
AIOOBE_SUPPLIER = Preconditions.outOfBoundsExceptionFormatter(
|
||||
new Function<String, ArrayIndexOutOfBoundsException>() {
|
||||
@Override
|
||||
public ArrayIndexOutOfBoundsException apply(String s) {
|
||||
return new ArrayIndexOutOfBoundsException(s);
|
||||
}
|
||||
});
|
||||
|
||||
private static final long VFORM_OFFSET;
|
||||
|
||||
static {
|
||||
|
|
|
@ -830,7 +830,7 @@ final class VarHandle$Type$s {
|
|||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
return UNSAFE.get$Type$Volatile(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase);
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
|
@ -842,7 +842,7 @@ final class VarHandle$Type$s {
|
|||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
UNSAFE.put$Type$Volatile(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
{#if[Object]?runtimeTypeCheck(handle, array, value):value});
|
||||
}
|
||||
|
||||
|
@ -855,7 +855,7 @@ final class VarHandle$Type$s {
|
|||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
return UNSAFE.get$Type$Opaque(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase);
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
|
@ -867,7 +867,7 @@ final class VarHandle$Type$s {
|
|||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
UNSAFE.put$Type$Opaque(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
{#if[Object]?runtimeTypeCheck(handle, array, value):value});
|
||||
}
|
||||
|
||||
|
@ -880,7 +880,7 @@ final class VarHandle$Type$s {
|
|||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
return UNSAFE.get$Type$Acquire(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase);
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
|
@ -892,7 +892,7 @@ final class VarHandle$Type$s {
|
|||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
UNSAFE.put$Type$Release(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
{#if[Object]?runtimeTypeCheck(handle, array, value):value});
|
||||
}
|
||||
#if[CAS]
|
||||
|
@ -906,7 +906,7 @@ final class VarHandle$Type$s {
|
|||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
return UNSAFE.compareAndSet$Type$(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
{#if[Object]?handle.componentType.cast(expected):expected},
|
||||
{#if[Object]?runtimeTypeCheck(handle, array, value):value});
|
||||
}
|
||||
|
@ -920,7 +920,7 @@ final class VarHandle$Type$s {
|
|||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
return UNSAFE.compareAndExchange$Type$(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
{#if[Object]?handle.componentType.cast(expected):expected},
|
||||
{#if[Object]?runtimeTypeCheck(handle, array, value):value});
|
||||
}
|
||||
|
@ -934,7 +934,7 @@ final class VarHandle$Type$s {
|
|||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
return UNSAFE.compareAndExchange$Type$Acquire(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
{#if[Object]?handle.componentType.cast(expected):expected},
|
||||
{#if[Object]?runtimeTypeCheck(handle, array, value):value});
|
||||
}
|
||||
|
@ -948,7 +948,7 @@ final class VarHandle$Type$s {
|
|||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
return UNSAFE.compareAndExchange$Type$Release(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
{#if[Object]?handle.componentType.cast(expected):expected},
|
||||
{#if[Object]?runtimeTypeCheck(handle, array, value):value});
|
||||
}
|
||||
|
@ -962,7 +962,7 @@ final class VarHandle$Type$s {
|
|||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
return UNSAFE.weakCompareAndSet$Type$Plain(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
{#if[Object]?handle.componentType.cast(expected):expected},
|
||||
{#if[Object]?runtimeTypeCheck(handle, array, value):value});
|
||||
}
|
||||
|
@ -976,7 +976,7 @@ final class VarHandle$Type$s {
|
|||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
return UNSAFE.weakCompareAndSet$Type$(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
{#if[Object]?handle.componentType.cast(expected):expected},
|
||||
{#if[Object]?runtimeTypeCheck(handle, array, value):value});
|
||||
}
|
||||
|
@ -990,7 +990,7 @@ final class VarHandle$Type$s {
|
|||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
return UNSAFE.weakCompareAndSet$Type$Acquire(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
{#if[Object]?handle.componentType.cast(expected):expected},
|
||||
{#if[Object]?runtimeTypeCheck(handle, array, value):value});
|
||||
}
|
||||
|
@ -1004,7 +1004,7 @@ final class VarHandle$Type$s {
|
|||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
return UNSAFE.weakCompareAndSet$Type$Release(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
{#if[Object]?handle.componentType.cast(expected):expected},
|
||||
{#if[Object]?runtimeTypeCheck(handle, array, value):value});
|
||||
}
|
||||
|
@ -1018,7 +1018,7 @@ final class VarHandle$Type$s {
|
|||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
return UNSAFE.getAndSet$Type$(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
{#if[Object]?runtimeTypeCheck(handle, array, value):value});
|
||||
}
|
||||
|
||||
|
@ -1031,7 +1031,7 @@ final class VarHandle$Type$s {
|
|||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
return UNSAFE.getAndSet$Type$Acquire(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
{#if[Object]?runtimeTypeCheck(handle, array, value):value});
|
||||
}
|
||||
|
||||
|
@ -1044,7 +1044,7 @@ final class VarHandle$Type$s {
|
|||
$type$[] array = ($type$[]) oarray;
|
||||
#end[Object]
|
||||
return UNSAFE.getAndSet$Type$Release(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
{#if[Object]?runtimeTypeCheck(handle, array, value):value});
|
||||
}
|
||||
#end[CAS]
|
||||
|
@ -1055,7 +1055,7 @@ final class VarHandle$Type$s {
|
|||
Array handle = (Array)ob;
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndAdd$Type$(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
|
@ -1064,7 +1064,7 @@ final class VarHandle$Type$s {
|
|||
Array handle = (Array)ob;
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndAdd$Type$Acquire(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
|
@ -1073,7 +1073,7 @@ final class VarHandle$Type$s {
|
|||
Array handle = (Array)ob;
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndAdd$Type$Release(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
#end[AtomicAdd]
|
||||
|
@ -1084,7 +1084,7 @@ final class VarHandle$Type$s {
|
|||
Array handle = (Array)ob;
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseOr$Type$(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
|
@ -1093,7 +1093,7 @@ final class VarHandle$Type$s {
|
|||
Array handle = (Array)ob;
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseOr$Type$Release(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
|
@ -1102,7 +1102,7 @@ final class VarHandle$Type$s {
|
|||
Array handle = (Array)ob;
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseOr$Type$Acquire(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
|
@ -1111,7 +1111,7 @@ final class VarHandle$Type$s {
|
|||
Array handle = (Array)ob;
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseAnd$Type$(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
|
@ -1120,7 +1120,7 @@ final class VarHandle$Type$s {
|
|||
Array handle = (Array)ob;
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseAnd$Type$Release(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
|
@ -1129,7 +1129,7 @@ final class VarHandle$Type$s {
|
|||
Array handle = (Array)ob;
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseAnd$Type$Acquire(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
|
@ -1138,7 +1138,7 @@ final class VarHandle$Type$s {
|
|||
Array handle = (Array)ob;
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseXor$Type$(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
|
@ -1147,7 +1147,7 @@ final class VarHandle$Type$s {
|
|||
Array handle = (Array)ob;
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseXor$Type$Release(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
|
||||
|
@ -1156,7 +1156,7 @@ final class VarHandle$Type$s {
|
|||
Array handle = (Array)ob;
|
||||
$type$[] array = ($type$[]) oarray;
|
||||
return UNSAFE.getAndBitwiseXor$Type$Acquire(array,
|
||||
(((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase,
|
||||
(((long) Preconditions.checkIndex(index, array.length, Preconditions.AIOOBE_FORMATTER)) << handle.ashift) + handle.abase,
|
||||
value);
|
||||
}
|
||||
#end[Bitwise]
|
||||
|
|
|
@ -109,12 +109,9 @@ final class VarHandleByteArrayAs$Type$s extends VarHandleByteArrayBase {
|
|||
return at.accessModeType(byte[].class, $type$.class, int.class);
|
||||
}
|
||||
|
||||
private static final BiFunction<String, List<Number>, ArrayIndexOutOfBoundsException>
|
||||
OOBEF = Preconditions.outOfBoundsExceptionFormatter(ArrayIndexOutOfBoundsException::new);
|
||||
|
||||
@ForceInline
|
||||
static int index(byte[] ba, int index) {
|
||||
return Preconditions.checkIndex(index, ba.length - ALIGN, OOBEF);
|
||||
return Preconditions.checkIndex(index, ba.length - ALIGN, Preconditions.AIOOBE_FORMATTER);
|
||||
}
|
||||
|
||||
@ForceInline
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue