It's exactly the way it's been working since 1.6 I believe. <source>
public class Optimization { public String concat(String... strings) { return "#: " + strings[0] + strings[2] + strings[3] + "..."; } } <compiled into> public class Optimization { public Optimization(); Code: 0: aload_0 1: invokespecial #1 // Method java/lang/Object."<init>":()V 4: return public java.lang.String concat(java.lang.String...); Code: 0: new #2 // class java/lang/StringBuilder 3: dup 4: invokespecial #3 // Method java/lang/StringBuilder."<init>":()V 7: ldc #4 // String #: 9: invokevirtual #5 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 12: aload_1 13: iconst_0 14: aaload 15: invokevirtual #5 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 18: aload_1 19: iconst_2 20: aaload 21: invokevirtual #5 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 24: aload_1 25: iconst_3 26: aaload 27: invokevirtual #5 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 30: ldc #6 // String ... 32: invokevirtual #5 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 35: invokevirtual #7 // Method java/lang/StringBuilder.toString:()Ljava/lang/String; 38: areturn } -Pavel On 26 Aug 2014, at 06:20, Xuelei Fan <xuelei....@oracle.com> wrote: > I was wondering, is it nice to address it in Java compiler to use string > builder for the string "+" operator? > > Xuelei > > > On 8/26/2014 11:28 AM, Wang Weijun wrote: >> New webrevs available at >> >> http://cr.openjdk.java.net/~weijun/8055723/client/webrev.01/ >> http://cr.openjdk.java.net/~weijun/8055723/core/webrev.01/ >> >> There are only 2 now. Everything non-client is in core. >> >> Everyone, please do code review quickly because the patch touches too many >> files and any delay could mean re-merge. >> >> *Otávio*: If there is only small change in feedback, tell me to update my >> own repo and you don't need to generate the big patch again. >> >> I see you still include that demo file. >> >> Thanks >> Max >> >> >