On Fri, 28 Dec 2001, Erik Hatcher wrote:
> Date: Fri, 28 Dec 2001 09:05:32 -0500
> From: Erik Hatcher <[EMAIL PROTECTED]>
> Reply-To: Jakarta Commons Developers List <[EMAIL PROTECTED]>
> To: Jakarta Commons Developers List <[EMAIL PROTECTED]>
> Subject: Re: cvs commit:
> jakarta-commons/beanutils/src/java/org/apache/commons/beanutils
> BasicDynaBean.java BasicDynaClass.java DynaProperty.java DynaBean.java
> DynaClass.java
>
> A question about coding standards...
>
> ----- Original Message -----
> From: <[EMAIL PROTECTED]>
>
> > if (!values.containsKey(name))
> > throw new IllegalArgumentException
> > ("No property " + name + " exists");
>
> I'm in the camp that believes curly brackets should surround even single
> statement code blocks. Is this mentioned in the Sun coding standards?
>
They do ... Section 7.4.
> Granted, Struts works very well, but ActionServlet drives me crazy to read
> through! :) (no offense, Craig)
>
:-)
> But more importantly, why the inconsistency?
>
Laziness and sloth ... because my fingers have been typing if statements
like this for a loooong time. :-)
I have no problems with switching to { } around all if blocks.
> > try {
> > return ((DynaBean)
> constructor.newInstance(constructorValues));
> > } catch (InvocationTargetException e) {
> > throw new InstantiationException
> > (e.getTargetException().getMessage());
> > }
>
> Curly brackets are used for try/catch, but not for if.
>
Java code won't compile without these braces ... it will without braces on
the if statements.
> I'd like to push for always using curly brackets, but those might be
> fighting words for some.... so ignore little ol' me if its a big deal as I
> don't want to get a long thread started about such things, I just wanted to
> bring it up and see if this particular issue is specified in the Jakarta
> (aka Sun) coding standards. I'm a follower (as best I humanly can) of the
> guidelines in the book The Elements of Java Style.
>
Sounds fine to me ... let's just not fight about whether the left brace
goes on the end of the "if" or not ...
> Erik
>
Craig
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>