mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8301086: jdk/internal/util/ByteArray/ReadWriteValues.java fails with CompilationError
Reviewed-by: dfuchs
This commit is contained in:
parent
61775c85b0
commit
a23ff63af1
@ -172,7 +172,6 @@ final class ReadWriteValues {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Unusual cases
|
||||
|
||||
@Test
|
||||
@ -193,147 +192,6 @@ final class ReadWriteValues {
|
||||
assertThrowsOriginal(IndexOutOfBoundsException.class, () -> ByteArray.setInt(BUFF, BUFF.length, 1));
|
||||
}
|
||||
|
||||
// At-zero methods
|
||||
|
||||
@Test
|
||||
void testGetShortAtZero() {
|
||||
longs().forEach(l -> {
|
||||
short expected = (short) l;
|
||||
RefImpl.putShort(BUFF, 0, expected);
|
||||
short actual = ByteArray.getShort(BUFF);
|
||||
assertEquals(expected, actual);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPutShortAtZero() {
|
||||
longs().forEach(l -> {
|
||||
short expected = (short) l;
|
||||
ByteArray.setShort(BUFF, expected);
|
||||
short actual = RefImpl.getShort(BUFF, 0);
|
||||
assertEquals(expected, actual);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetCharAtZero() {
|
||||
longs().forEach(l -> {
|
||||
char expected = (char) l;
|
||||
RefImpl.putChar(BUFF, 0, expected);
|
||||
char actual = ByteArray.getChar(BUFF);
|
||||
assertEquals(expected, actual);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPutCharAtZero() {
|
||||
longs().forEach(l -> {
|
||||
char expected = (char) l;
|
||||
ByteArray.setChar(BUFF, expected);
|
||||
char actual = RefImpl.getChar(BUFF, 0);
|
||||
assertEquals(expected, actual);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetIntAtZero() {
|
||||
longs().forEach(l -> {
|
||||
int expected = (int) l;
|
||||
RefImpl.putInt(BUFF, 0, expected);
|
||||
int actual = ByteArray.getInt(BUFF);
|
||||
assertEquals(expected, actual);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPutIntAtZero() {
|
||||
longs().forEach(l -> {
|
||||
int expected = (int) l;
|
||||
ByteArray.setInt(BUFF, expected);
|
||||
int actual = RefImpl.getInt(BUFF, 0);
|
||||
assertEquals(expected, actual);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetLongAtZero() {
|
||||
longs().forEach(expected -> {
|
||||
RefImpl.putLong(BUFF, 0, expected);
|
||||
long actual = ByteArray.getLong(BUFF);
|
||||
assertEquals(expected, actual);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPutLongAtZero() {
|
||||
longs().forEach(expected -> {
|
||||
ByteArray.setLong(BUFF, expected);
|
||||
long actual = RefImpl.getLong(BUFF, 0);
|
||||
assertEquals(expected, actual);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetFloatAtZero() {
|
||||
floats().forEach(expected -> {
|
||||
RefImpl.putFloat(BUFF, 0, expected);
|
||||
float actual = ByteArray.getFloat(BUFF);
|
||||
assertEquals(expected, actual);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPutFloatAtZero() {
|
||||
floats().forEach(expected -> {
|
||||
ByteArray.setFloat(BUFF, expected);
|
||||
float actual = RefImpl.getFloat(BUFF, 0);
|
||||
assertEquals(expected, actual);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void testGetDoubleAtZero() {
|
||||
doubles().forEach(expected -> {
|
||||
RefImpl.putDouble(BUFF, 0, expected);
|
||||
double actual = ByteArray.getDouble(BUFF);
|
||||
assertEquals(expected, actual);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPutDoubleAtZero() {
|
||||
doubles().forEach(expected -> {
|
||||
ByteArray.setDouble(BUFF, expected);
|
||||
double actual = RefImpl.getDouble(BUFF, 0);
|
||||
assertEquals(expected, actual);
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void testPutUnsignedShortAtZero() {
|
||||
longs().forEach(l -> {
|
||||
int expected = Short.toUnsignedInt((short) l);
|
||||
ByteArray.setUnsignedShort(BUFF, expected);
|
||||
int actual = Short.toUnsignedInt(RefImpl.getShort(BUFF, 0));
|
||||
assertEquals(expected, actual);
|
||||
});
|
||||
}
|
||||
|
||||
// Unusual cases
|
||||
|
||||
@Test
|
||||
void testNullArrayAtZero() {
|
||||
assertThrowsOriginal(NullPointerException.class, () -> ByteArray.getInt(null));
|
||||
assertThrowsOriginal(NullPointerException.class, () -> ByteArray.setInt(null, 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testOutOfBoundsAtZero() {
|
||||
assertThrowsOriginal(IndexOutOfBoundsException.class, () -> ByteArray.getInt(new byte[1]));
|
||||
assertThrowsOriginal(IndexOutOfBoundsException.class, () -> ByteArray.setInt(new byte[1],1));
|
||||
}
|
||||
|
||||
|
||||
static LongStream longs() {
|
||||
return ThreadLocalRandom.current().longs(ITERATIONS);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user