RFR: 8138614: (spec str) StringBuffer and StringBuilder methods improperly require "new" String to be returned [v2]
Roger Riggs
rriggs at openjdk.org
Fri Feb 14 15:33:10 UTC 2025
On Thu, 13 Feb 2025 20:51:26 GMT, Stuart Marks <smarks at openjdk.org> wrote:
>> A couple adjustments to the specs for four methods of StringBuilder and StringBuffer so that they no longer require new Strings to be created, just a String with the right contents. No implementation changes. Note that the actual specs (and implementations) are actually in AbstractStringBuilder, and they're inherited by StringBuilder and StringBuffer.
>
> Stuart Marks has updated the pull request incrementally with one additional commit since the last revision:
>
> A tiny bit of wordsmithing.
It should be pointed out (in the CSR) that this is aligning the spec with the current implementation, there no compatibility risk to existing programs.
Except for the empty string, neither StringBuilder or StringBuffer is holding a string, but a sequence of characters, so a String is created.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/23599#issuecomment-2659630463
More information about the core-libs-dev
mailing list