[jdk16] RFR: 8259032: MappedMemorySegmentImpl#makeMappedSegment() ignores Unmapper#pagePosition
Uwe Schindler
uschindler at openjdk.java.net
Tue Jan 5 16:06:56 UTC 2021
On Tue, 5 Jan 2021 15:55:10 GMT, Uwe Schindler <uschindler at openjdk.org> wrote:
>> test/jdk/java/foreign/TestByteBuffer.java line 28:
>>
>>> 26: * @modules java.base/sun.nio.ch
>>> 27: * jdk.incubator.foreign/jdk.internal.foreign
>>> 28: * @run testng/othervm --illegal-access=permit -Dforeign.restricted=permit TestByteBuffer
>>
>> Can you change java.base/sun.nio.ch to java.base/sun.nio.ch:+open instead? That would avoid the --illegal-access=permit.
>
> I am not sure if a test like this is really needed.
> The alignment is pageSize on Linux and some arbitrary value (65536) on Windows. If you have some test file that writes like a few bytes (1, 2, 3, 4,...) To a file and then maps it with offsets other than zero, you just have to get the first byte and compare it to offset.
In fact the new test only checks if everything is aligned like we expect, but it does not test that our mapping returns a memory segment with expected contents.
-------------
PR: https://git.openjdk.java.net/jdk16/pull/84
More information about the core-libs-dev
mailing list