On Wed, 6 Dec 2023 15:36:57 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> Per Minborg has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Update throws docs fror SegmentAllocator > > src/java.base/share/classes/java/lang/foreign/SegmentAllocator.java line 95: > >> 93: * @param str the Java string to be converted into a C string >> 94: * @return a new native segment containing the converted C string >> 95: * @throws IllegalArgumentException if the allocated segment is > > I don't think the changes here are useful. What does it mean for an allocated > segment to be read-only? I think all these conditions are tied to > `prefixAllocator` blindly accepting read-only segments, which should NOT be > the case. I suggest to revert all the chnages here and document (and throw) a > new exception for when a prefix allocator is created from a read-only segment. I have updated the PR according to this. It should be noted that, theoretically, it is still possible to write a bespoke `SegmentAllocator` that returns read-only segments. I think then, the user made a deliberate choice and perhaps understands the consequences. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16993#discussion_r1418543624