RFR: 7174936: several String methods claim to always create new String

Stuart Marks stuart.marks at oracle.com
Thu Nov 7 23:16:12 UTC 2013


On 11/7/13 12:12 AM, Stuart Marks wrote:
> The concat() method is weird in that if the arg is empty, it requires returning
> 'this'; but if 'this' is empty, it requires creating a new String instead of
> just returning the arg. I think this is overspecified. But the implementation
> follows this exactly, so I didn't want to change the spec in this case. Maybe
> later.

Woops, I forgot, I did change the concat() spec to no longer require creating a 
new string in the case where 'this' is empty. I think it's still overspecified, 
in that it requires returning 'this' if the arg is empty, though this doesn't 
seem to do much harm.

s'marks



More information about the core-libs-dev mailing list