Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 31091 invoked from network); 28 Sep 2007 15:56:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Sep 2007 15:56:19 -0000 Received: (qmail 31679 invoked by uid 500); 28 Sep 2007 15:56:08 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 31622 invoked by uid 500); 28 Sep 2007 15:56:08 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 31611 invoked by uid 99); 28 Sep 2007 15:56:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Sep 2007 08:56:08 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of peter.kitt.reilly@gmail.com designates 209.85.146.179 as permitted sender) Received: from [209.85.146.179] (HELO wa-out-1112.google.com) (209.85.146.179) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Sep 2007 15:56:09 +0000 Received: by wa-out-1112.google.com with SMTP id k22so3348700waf for ; Fri, 28 Sep 2007 08:55:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=feHEkv/ZP6mGbxGhr2R6MNOV4YQveirodSzWUAJjwdI=; b=LtGxW37CwUz4h/dG/JWPx+EioHVfvb4/E1FJLjfkUGaHpOjWSvOzyN+8Sk7oH0jQ3lZ7iNkFHIbvMMlOPtwpJv/CdETO0n2Rh05A6QVewQlsSHHJnYOEL5j1WidmU5JUS+l51go38+S5QbaJKEJkrRgTdEMVMiWifdE+a1+7d5Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=MWM9JfngTGNyBKgahq9+FftNs0zVfWAvm/Wr1jhlsgdIqpDYdoXMl2IAmTtiD16skrHl0yfhA3caNnKMRgzCSQFHSKu15dYFs+eS7/ANQbgRWS3b6otrIIvYSpF1A6PDtqo3CRWLBP/Pc6IkzpUdJl7Rk4uVBZWDy9r1kr4MJaY= Received: by 10.114.94.1 with SMTP id r1mr659338wab.1190994922929; Fri, 28 Sep 2007 08:55:22 -0700 (PDT) Received: by 10.35.97.14 with HTTP; Fri, 28 Sep 2007 08:55:22 -0700 (PDT) Message-ID: Date: Fri, 28 Sep 2007 16:55:22 +0100 From: "Peter Reilly" To: "Ant Developers List" Subject: Re: svn commit: r580302 - /ant/core/trunk/src/main/org/apache/tools/ant/types/resources/JavaResource.java In-Reply-To: <46FD1D78.2040005@mdl.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070928111319.D9C0B1A9832@eris.apache.org> <46FD1D78.2040005@mdl.com> X-Virus-Checked: Checked by ClamAV on apache.org On 9/28/07, Alexey Solofnenko wrote: > In general, I do not see a reason to replace perfectly readable single > liners with several lines of code - it just increases code bloat. We agreed to use the checkstyle config (src/etc/checkstyle/checkstyle-config) for ant about 2 years ago. This does ban inner assignments. > Anybody with high IQ should be able to read old code as is. - provided one scans it a number of times. We write enough so the complicated code can be used for complicated problems - not simple problems. I am of the firm belief that code should be as simple as possible (but not simpler!). This means small methods, "near" variables, small single purpose classes, one action per statement, quick exit/fail, all statements at the same level of abstraction, handling of exceptions in "control" classes. > In this case > the change is warranted, but please move "is" variable and try/finally > inside "else" - the scoping is wrong now. The scoping has not changed, but is now more obvious...... I have made the change. Peter > > - Alexey. > > peterreilly@apache.org wrote: > > Author: peterreilly > > Date: Fri Sep 28 04:13:19 2007 > > New Revision: 580302 > > > > URL: http://svn.apache.org/viewvc?rev=580302&view=rev > > Log: > > checkstyle: remove inner assignment > > > > Modified: > > ant/core/trunk/src/main/org/apache/tools/ant/types/resources/JavaResource.java > > > > Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/JavaResource.java > > URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/JavaResource.java?rev=580302&r1=580301&r2=580302&view=diff > > ============================================================================== > > --- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/JavaResource.java (original) > > +++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/JavaResource.java Fri Sep 28 04:13:19 2007 > > @@ -130,8 +130,12 @@ > > public boolean isExists() { > > InputStream is = null; > > try { > > - return isReference() ? ((Resource) getCheckedRef()).isExists() > > - : (is = getInputStream()) != null; > > + if (isReference()) { > > + return ((Resource) getCheckedRef()).isExists(); > > + } else { > > + is = getInputStream(); > > + return is != null; > > + } > > } catch (IOException ex) { > > return false; > > } finally { > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org > > For additional commands, e-mail: dev-help@ant.apache.org > > > > -- > ------------------------------------------------------------------------ > Alexey N. Solofnenko > Pleasant Hill, CA (GMT-8 usually) > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org