[foreign-memaccess+abi] RFR: Remove dead code, add tests and fixes [v2]
Jorn Vernee
jvernee at openjdk.org
Tue Feb 14 14:10:24 UTC 2023
On Tue, 14 Feb 2023 13:56:43 GMT, Per Minborg <pminborg at openjdk.org> wrote:
>> This PR suggests removing dead code and addition of some tests. Also, a fix for zero-length mapped segment is added. It is anticipated this special zero-length segment is going to be removed in a separate PR.
>
> Per Minborg has updated the pull request incrementally with two additional commits since the last revision:
>
> - Fix copyright years
> - Remove zero-length fixes and more
test/jdk/java/foreign/TestByteBuffer.java line 319:
> 317: public void testMappedSegmentAsByteBuffer() throws Throwable {
> 318: File f = new File("test4.out");
> 319: assert f.createNewFile();
I suggest just using `assertTrue` here, rather than `assert`. Technically this will always work since we run the tests with assertions enabled, but it looks a little bit fishy to depend on a side-effect from an `assert`.
test/jdk/java/foreign/TestSegmentAllocators.java line 240:
> 238: assertThrows(UnsupportedOperationException.class, segment::isLoaded);
> 239: assertThrows(UnsupportedOperationException.class, segment::force);
> 240: assertEquals(segment.isMapped(), segment instanceof MappedMemorySegmentImpl);
Isn't the actual value always false? Why not use `assertFalse`?
-------------
PR: https://git.openjdk.org/panama-foreign/pull/792
More information about the panama-dev
mailing list