Skip to content

Commit c6cd176

Browse files
authored
Merge pull request #16 from minborg/fix-tests2
Fix failing tests
2 parents 2d75f95 + d7a1c7e commit c6cd176

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

test/jdk/java/nio/channels/FileChannel/LargeMapTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public static void main(String[] args) throws IOException {
7878
try (FileChannel fc = FileChannel.open(p, READ, WRITE)) {
7979
MemorySegment mappedMemorySegment =
8080
fc.map(FileChannel.MapMode.READ_WRITE, 0, p.toFile().length(),
81-
MemorySession.openImplicit());
81+
MemorySession.implicit());
8282
MemorySegment target = mappedMemorySegment.asSlice(BASE, EXTRA);
8383
if (!target.asByteBuffer().equals(bb)) {
8484
throw new RuntimeException("Expected buffers to be equal");

test/jdk/java/nio/channels/FileChannel/MapToMemorySegmentTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
import java.io.File;
3232
import java.io.IOException;
33+
import java.lang.foreign.Arena;
3334
import java.lang.foreign.MemorySegment;
3435
import java.lang.foreign.MemorySession;
3536
import java.nio.ByteBuffer;
@@ -61,21 +62,21 @@ public class MapToMemorySegmentTest {
6162

6263
@Test(expectedExceptions = UnsupportedOperationException.class)
6364
public void testCustomFileChannel() throws IOException {
64-
var session = MemorySession.openConfined();
65+
var arena = Arena.openConfined();
6566
var fc = FileChannel.open(tempPath, StandardOpenOption.WRITE, StandardOpenOption.READ);
6667
var fileChannel = new CustomFileChannel(fc);
67-
try (session; fileChannel){
68-
fileChannel.map(FileChannel.MapMode.READ_WRITE, 1L, 10L, session);
68+
try (arena; fileChannel){
69+
fileChannel.map(FileChannel.MapMode.READ_WRITE, 1L, 10L, arena.session());
6970
}
7071
}
7172

7273
@Test
7374
public void testCustomFileChannelOverride() throws IOException {
74-
var session = MemorySession.openConfined();
75+
var arena = Arena.openConfined();
7576
var fc = FileChannel.open(tempPath, StandardOpenOption.WRITE, StandardOpenOption.READ);
7677
var fileChannel = new CustomFileChannelOverride(fc);
77-
try (session; fileChannel){
78-
fileChannel.map(FileChannel.MapMode.READ_WRITE, 1L, 10L, session);
78+
try (arena; fileChannel){
79+
fileChannel.map(FileChannel.MapMode.READ_WRITE, 1L, 10L, arena.session());
7980
}
8081
}
8182

0 commit comments

Comments
 (0)