On Thu, 15 May 2025 10:53:27 GMT, Johannes Döbler <d...@openjdk.org> wrote:

>> Also, in JAX-RS for example, you cannot make use of `transferTo` as what you 
>> get is a heap object, and what you must forward also is a heap object.
>
> Thanks for the examples. Imho I think that performance sensitive, specialised 
> code can invest some lines to put together the best solution for the context 
> whereas the majority of code can simply use a convenient 
> `reader.readAllAsString()` instead of 
> `reader.readAllAsCharSequence().toString()` which is borderline to parody.

It is **impossible** to "invest some lines" to solve this in JAX-RS, and JAX-RS 
as a standard technology on tens of thousands of servers. Enforcing `String` 
prevents these useful optimizations, but brings *no actual benefit*, as *only 
few* callers actually care for *constant* objects, but would be satisfied with 
`CharSequence`'s lack of mutation methods.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2090910821

Reply via email to