Return-Path: Delivered-To: apmail-maven-m2-dev-archive@www.apache.org Received: (qmail 27391 invoked from network); 1 Oct 2004 12:04:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 1 Oct 2004 12:04:08 -0000 Received: (qmail 48895 invoked by uid 500); 1 Oct 2004 12:03:26 -0000 Delivered-To: apmail-maven-m2-dev-archive@maven.apache.org Received: (qmail 48811 invoked by uid 500); 1 Oct 2004 12:03:26 -0000 Mailing-List: contact m2-dev-help@maven.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: List-Id: "Maven 2 Developers List" Reply-To: "Maven 2 Developers List" Delivered-To: mailing list m2-dev@maven.apache.org Received: (qmail 48714 invoked by uid 99); 1 Oct 2004 12:03:24 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [62.193.206.9] (HELO webmail9.amenworld.com) (62.193.206.9) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 01 Oct 2004 05:03:22 -0700 Received: (qmail 3316 invoked from network); 1 Oct 2004 12:03:20 -0000 Received: from unknown (HELO ICS016566) (194.2.91.222) by 0 with SMTP; 1 Oct 2004 12:03:20 -0000 Message-ID: <004a01c4a7ae$a4bacc30$398c440a@cgeyfr.cgey.fr> From: "Emmanuel Venisse" To: "Maven 2 Developers List" References: Subject: Re: cvs commit: maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/phase GoalAttainmentPhase.java Date: Fri, 1 Oct 2004 14:03:18 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ----- Original Message ----- From: "Maczka Michal" To: "'Maven 2 Developers List'" Sent: Friday, October 01, 2004 10:44 AM Subject: RE: cvs commit: maven-components/maven-core/src/main/java/org/apache/maven/lifecycle/goal/ph ase GoalAttainmentPhase.java > > > + private String createPluginParameterRequiredMessage( > > MojoDescriptor mojo, Parameter parameter ) > > + { > > + StringBuffer message = new StringBuffer(); > > + > > + message.append( "The " + parameter.getName() ). > > + append( " is required for the execution of the " ). > > + append( mojo.getId() ). > > + append( " mojo and cannot be null." ); > > + > > + return message.toString(); > > } > Jason! > > Any particular reason why are you using StringBuffers for such tasks? Is it > question of the style? > > AFAIK this will result of such code in exactly the same > as: > > > String message = "The " + parameter.getName() + " is required for the > execution of the " + mojo.getId() + " mojo and cannot be null." ); > > > I mean that byteycode & performance is identical Yes for the Sun jdk, but it isn't the case for all bytecode generator. > > If I remember it is mentioned in JLS and described in "effective java". I think it's only a recommandation. If a generator doesn't use the stringbuffer model, it's a correct bytecode but not optimized. > > StringBuffers are normally recommended if you need to use loops for > constructing messages. > > I personally always use second form - but this is really the question of > style - that's why I am asking if this is a style which you prefer? > > > Michal >