On Thu, 10 Sep 2026 23:50:24 GMT, ExE Boss <[email protected]> wrote:

>> Liam Miller-Cushon has updated the pull request with a new target base due 
>> to a merge or a rebase. The incremental webrev excludes the unrelated 
>> changes brought in by the merge/rebase. The pull request contains 13 
>> additional commits since the last revision:
>> 
>>  - Clean up unused import
>>  - Merge remote-tracking branch 'origin/master' into short-vector
>>  - Move asReadOnlyMemorySegment to String
>>  - Add a benchmark
>>    
>>    Also adjust javadoc, convert test to JUnit 5, other small adjustments
>>  - javadoc
>>  - Move access to jdk.internal.foreign.StringSupport
>>  - Make test inputs longer
>>  - Test coverage
>>  - Move to X-Vector.java.template, update javadoc, add masked overloads
>>  - ShortVector.compatibleWith
>>  - ... and 3 more: https://git.openjdk.org/jdk/compare/10da5943...1c6ff6ab
>
> src/java.base/share/classes/java/lang/System.java line 2229:
> 
>> 2227:             public MemorySegment asReadOnlyMemorySegment(String str) {
>> 2228:                 return MemorySegment.ofArray(str.value()).asReadOnly();
>> 2229:             }
> 
> Note that it’s generally preferred for `*Access` methods to keep their 
> implementations trivial, that is, do:
> Suggestion:
> 
>             public MemorySegment asReadOnlyMemorySegment(String str) {
>                 return str.asReadOnlyMemorySegment();
>             }
> 
> And add the following method to `java.lang.String`:
> 
> /* package-private */ MemorySegment asReadOnlyMemorySegment() {
>       return MemorySegment.ofArray(this.value).asReadOnly();
> }

Thanks, this is done

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/32373#discussion_r4256161838

Reply via email to