Bug 49490 - New Code Formatter; Java Coding Conventions; Blank Lines; Before first declaration
Summary: New Code Formatter; Java Coding Conventions; Blank Lines; Before first declar...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-03 16:56 EST by Sebastian Davids CLA
Modified: 2006-04-14 04:43 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Davids CLA 2004-01-03 16:56:29 EST
I think the default for this option should also be 1 instead of 0.
Comment 1 Olivier Thomann CLA 2004-01-05 11:23:35 EST
Where did you find such information?
I have to admit that the Java conventions are not very verbose.
Looking at classes in the core libraries I could not find what should be the
default value. Sometimes there is a blank line, sometimes not.
Comment 2 Sebastian Davids CLA 2004-01-05 16:32:01 EST
Well, I did not look at the guidelines before posting *smiles sheepishly*

I've found "One blank line should always be used in the following circumstances:
{snip} Before a block (see section 5.1.1) or single-line (see section 5.1.2)
comment" (http://java.sun.com/docs/codeconv/html/CodeConventions.doc7.html#475 )
though.

A "well written" (read: documented) class will have a comment before
fields/methods/constructors:

class Test {

    /** Constructor comment */
    Test() {
    }
}

class Test {

    /** Field comment */
    int a;
}

interface Test {

    /** Method comment */
    void m();
}

Exceptions--not having a preceding comment--would be initializers or private
methods (if doc not required by style guide):

class Test {

    {
        //test
    }
}

@@@@

It feels awkward to me, being a "consistency" guy, if all my fields and methods
are preceded by a blank _but_ the ones right after the opening brace.
Comment 3 Olivier Thomann CLA 2004-01-05 16:50:25 EST
Ok, good enough. I will set the default value to 1.
Need to update the tests. When everything is ready, I will release.
Comment 4 Olivier Thomann CLA 2004-01-06 11:48:56 EST
Fixed and released in HEAD.
Comment 5 Frederic Fusier CLA 2004-02-11 12:49:57 EST
Verified for 3.0-M7 with build I200402102000.
Comment 6 Sebastian Davids CLA 2004-12-15 22:20:42 EST
Regression in:

Version: 3.1.0
Build id: 200412142000
Comment 7 Olivier Thomann CLA 2005-08-31 10:48:01 EDT
What is the regression?
Comment 8 Olivier Thomann CLA 2006-02-07 11:14:03 EST
Closing as FIXED since the requested information was never provided.