On Oct 29, 2008, at 10:44 AM, Alex Grönholm wrote:
Formatter:
- max line width is 100 characters
I prefer 120, but as long as it is only suggestion it isn't a big deal
for me.
- indentation is 4 spaces
Would XML be 4 spaces also? I don't care if it is 2 or 4.
- javadocs are formatted
What does that mean?
Cleanup:
- always use braces with control statements (I actually disagree
with this, and it's not even consistently used in existing code)
One line if statement should be allowed. For example,
if (debug) System.out.println("This is a one liner");
- removes unused imports and local variables
Order and grouping of import should be specified. I use the following:
java.*
javax.*
<blank line>
others
I like this because it puts the important imports closest to the code.
- removes "this" qualifier for non-static method/field accesses
(where possible)
- adds missing @Override/@Deprecated annotations
I don't like the @Override annotation in most cases. The only place I
have used it is when doing complex subclassing of the SFSB container
in geronimo, where it helps catch interface changes. In openejb we
typically don't do complex subclassing since it is so brittle, so the
@Override annotation just becomes annoying.
- removes unnecessary casts
- removes trailing whitespace
- corrects indentation
Code templates:
- for newly create .java files, inserts the ASL comment to the top
Also, in general, I dislike aligned text because it becomes a burden
to maintain over time. There are places where it is nice
(specifically simple look tables), but I find it annoying in javadoc
comments and parameter declarations.