+1 for the codestyle document.

Another Eclipse formatter limitation (already discussed with trygve):
comment blocks doesn't start on column 1.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=34552

Cheers,

Vincent

2006/8/24, Kenney Westerhof <[EMAIL PROTECTED]>:


Vincent Siveton wrote:
> Hi Kenney,
>
> Other problems exist in the Eclipse codestyle (See MNG-2522 Regression
> for the Eclipse codestyle)
> If you are an Eclipse user, it should be great if you have time to
> review it.
>

I'm looking into it.

I'm having a hard time finding out what the correct formatting is,
though. It seems the IDEA version is slightly underconfigured and
relying on a lot of IDEA defaults. The checkstyle configuration isn't
checking a lot of things.

I think we need some textual document describing this. Here's a shot at
some of the issues:


-----------

1) newline + indent by one before 'extends' and 'implements'

public class Bla
    extends A
    implements B
{


QUESTION: is this right?


- throws on a new line, exceptions on one line; wrapped exceptions same
  indentation as the throws:

    public void bla()
      throws Exception, Exception, Exception, ...
      Exception, Exception

QUESTION: is this right?

(I prefer the following, btw:

     public void bla()
       throws Exception,
           Exception,
           Exception
)


2) Wrap all arguments for constructors, method invocations etc using
  indent by column:

  foo.bar().something( a, b, c,
                       d, e );

QUESTION: Is this right?

Although eclipse has some problems, it'll render it as:

  foo.bar().something(
                       a, b, c,
                       d, e );

I personally prefer:

   foo.bar().something(
       a, b, c, d, e
   );

or possibly

   foo.bar().something( a, b,
     c, d, e
   );

or this, as eclipse doesn't allow ');' to be on a new line when wrapping:

   foo.bar().something( a, b,
     c, d, e );


3) Wrap long method-invocation chains, indent on column:

    foo.bar().baz()
             .bla()
             .blup()

Mixing this with long argument lists gets interesting..

QUESTION: Is this right? I've also seen

   foo.bar().baz()
       .bla().blup()


4) All { and } on a single line, not indented:

   for ( a; b; c )
   {
       // indented code
   }

5) 'if' parameters are continuously wrapped, indented by one:

  for ( a = a + a + a
      + a + a; a < b
      + b + b + b; a
      += b )
  {
  }

QUESTION: Is this right?

(personally i'd prefer the 3 parts to be on separate lines and indented
one more in this case, makes it more readable:

  for ( a = a + a + a
          + a + a;
      a < b + b + b
          + b;
      a += b )
  {
  }

Maybe even indent on column although I hate non-tab-aligned indents.. ;)

)

6) Line wrapped operators at the beginning of the line:

   a + a + a
     + a;

(instead of:
   a + a + a +
     a;
)

(possibly not indented, depending on context).


7) Spaces after ( and before ) except when empty or when it's a typecast:

   ( (Typecast) something ).foo()


-----------

If someone could confirm my assumptions I'll make sure the eclipse
codestyle reflects this, and possibly checkstyle too.

-- Kenney

> Cheers,
>
> Vincent
>
> 2006/8/24, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
>> Author: kenney
>> Date: Thu Aug 24 06:01:19 2006
>> New Revision: 434393
>>
>> URL: http://svn.apache.org/viewvc?rev=434393&view=rev
>> Log:
>> Changed '( typecast )' to '(typecast)' in eclipse codestyle, as this
>> is used everywhere in maven code.
>>
>> Modified:
>>
>> maven/site/trunk/src/site/resources/developers/maven-eclipse-codestyle.xml
>>
>>
>> Modified:
>> maven/site/trunk/src/site/resources/developers/maven-eclipse-codestyle.xml
>>
>> URL:
>> 
http://svn.apache.org/viewvc/maven/site/trunk/src/site/resources/developers/maven-eclipse-codestyle.xml?rev=434393&r1=434392&r2=434393&view=diff
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to