On Fri, 21 Nov 2025 10:38:05 GMT, Liam Miller-Cushon <[email protected]> wrote:
>> Looks like we are already specified to throw IAE if 'the size of the string >> is greater than the largest string supported by the platform' > > Done, and I added a test to cover the IAE I think I'm confused here. This method is called by `MemorySegment::getString` with an explicit length. The question is -- what does the length represent? There's two options: 1. the length, in bytes, of the region of memory that needs to be _decoded_ into the final string bytes 2. the length of the final string bytes IMHO, only (1) really makes sense -- as (2) involves some charset-specific guesswork. But if (1) is (as I hope) what we mean, I think we should probably make that clearer in the javadoc. Then, the exception we throw here is related to the fact that we don't have a way to construct a string from something bigger than a byte[] -- which is, in a way, an impl specific issue (one can imagine manually decoding the segment bytes into a new char[], which is then used to create the string -- in which case it might be possible e.g. to read 4 * N UTF32 string bytes into a LATIN1 string backed by a byte array with size N). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/28043#discussion_r2560145914
