On Thu, 15 May 2025 11:01:36 GMT, Markus KARG <d...@openjdk.org> wrote:
>> 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. > 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. What relation does such a "heap object" have to character streams? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/24728#discussion_r2092023770