You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Roland Weber <os...@dubioso.net> on 2008/02/01 20:33:33 UTC

Java 5 tags and indentation

Hi folks,

after adding the Java 5 tags, our code is now formatted
like this example:

    @Override
	protected HttpParams createHttpParams() {
        HttpParams params = new BasicHttpParams();
        HttpProtocolParams.setVersion(params,
                HttpVersion.HTTP_1_1);
        HttpProtocolParams.setContentCharset(params,
                HTTP.DEFAULT_CONTENT_CHARSET);
        HttpProtocolParams.setUseExpectContinue(params,
                true);

That is, the actual method signature is now indented to
the same depth as the method body. Not even an empty line
to separate the two. I'm sorry, but this hurts my eyes.

Suggestions?

cheers,
  Roland

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Java 5 tags and indentation

Posted by Roland Weber <os...@dubioso.net>.
Hi Sebastian,

> No problem; they've all been fixed now.

Thanks.

> While I was scanning the code for the problems I'd introduced, I
> noticed that there are quite a few tabs in the http-core code (which
> is not 1.5, so I did not add @Override).
> 
> Is it worth me fixing these? I'm happy to do so.

Yes, please.

> Maybe there should be a "no tabs" policy?

I thought we had one, inherited from Jakarta [1] which points
to Sun coding conventions [2]. Which indeed is not the case,
Sun cc only require that tabs be set to 8 spaces.
I configured my editor to no-tabs years ago, and I haven't
noticed tabs in Oleg's contributions yet. Maybe the tabs got
in by one of the infrequent contributors.

[1] http://jakarta.apache.org/site/source.html
[2] http://java.sun.com/docs/codeconv/html/CodeConventions.doc3.html#262

> Might be useful to have a section in the
> http://hc.apache.org/dev-docs.html page about coding conventions. Or
> maybe on the Wiki.

Definitely. Wiki, with a link from dev-docs. I'll put it
on my ever-growing todo list. I want to create a page that
explains how to submit patches, the no-tabs rule and other
formatting stuff can be mentioned or linked from there.

cheers,
  Roland


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Java 5 tags and indentation

Posted by sebb <se...@gmail.com>.
On 03/02/2008, Roland Weber <os...@dubioso.net> wrote:
> sebb wrote:
> > It looks OK to me - the method is aligned with the @ - but I have tabs
> > set at 4 spaces.
> >
> > I can fix those shortly.
>
> Thanks. It's been a while since I had to deal with
> tab vs. space problems, sorry for not spotting that
> in the first place.

No problem; they've all been fixed now.

While I was scanning the code for the problems I'd introduced, I
noticed that there are quite a few tabs in the http-core code (which
is not 1.5, so I did not add @Override).

Some of these are really odd, e.g. tabs in the middle of groups of spaces.
There are often a few lines together with embedded tabs, usually the
rest of the source uses spaces for indenting.

Is it worth me fixing these? I'm happy to do so.

Maybe there should be a "no tabs" policy?
Might be useful to have a section in the
http://hc.apache.org/dev-docs.html page about coding conventions. Or
maybe on the Wiki.

> cheers,
>   Roland
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Java 5 tags and indentation

Posted by Roland Weber <os...@dubioso.net>.
sebb wrote:
> It looks OK to me - the method is aligned with the @ - but I have tabs
> set at 4 spaces.
> 
> I can fix those shortly.

Thanks. It's been a while since I had to deal with
tab vs. space problems, sorry for not spotting that
in the first place.

cheers,
  Roland


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Java 5 tags and indentation

Posted by sebb <se...@gmail.com>.
Ah - that must be my fault.
It looks OK to me - the method is aligned with the @ - but I have tabs
set at 4 spaces.

It appears that the auto-correct must have changed the method line as
well. Strange since the @Override has 4 spaces and the method was
previously 4 spaces indented. Seems like an Elipse bug.

I can fix those shortly.

Sebastian
On 01/02/2008, Roland Weber <os...@dubioso.net> wrote:
> Hi folks,
>
> after adding the Java 5 tags, our code is now formatted
> like this example:
>
>     @Override
>         protected HttpParams createHttpParams() {
>         HttpParams params = new BasicHttpParams();
>         HttpProtocolParams.setVersion(params,
>                 HttpVersion.HTTP_1_1);
>         HttpProtocolParams.setContentCharset(params,
>                 HTTP.DEFAULT_CONTENT_CHARSET);
>         HttpProtocolParams.setUseExpectContinue(params,
>                 true);
>
> That is, the actual method signature is now indented to
> the same depth as the method body. Not even an empty line
> to separate the two. I'm sorry, but this hurts my eyes.
>
> Suggestions?
>
> cheers,
>   Roland
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Java 5 tags and indentation

Posted by Ortwin Glück <od...@odi.ch>.

Roland Weber wrote:
> Hi folks,
> 
> after adding the Java 5 tags, our code is now formatted
> like this example:
> 
>     @Override
> 	protected HttpParams createHttpParams() {

Look closely. The code mixes TABs and spaces. This mix should be cleaned up in
the whole codebase (no TABs).

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org