JLS string concatenation clarification
Alex Buckley
alex.buckley at oracle.com
Wed Jan 22 14:14:26 PST 2014
To compiler-dev and others,
Since the original question asked when the JLS allows compilers to
deviate from "always" creating a new String object, I would like to know
more about the following case:
On 1/21/2014 4:45 PM, Alex Buckley wrote:
> - "Semi" constant expressions like s+"". Concatenating the empty string
> literal "" with a String expression is mentioned in
> https://bugs.openjdk.java.net/browse/JDK-4036535. The expectation (per
> JLS1) that a new String object is always created in this case is
> misplaced (per the JDK's actual behavior). But, the JLS never clarified
> this.
If compiler authors can confirm (on-list or privately) that indeed
"concatenation with empty string does not create the new instance of
String", then I will clarify the JLS.
Alex
More information about the compiler-dev
mailing list