Wicket Source Code Style has been created by Gwyn Evans (Sep 07, 2007).

Content:

Bookmarkable link

Overview

At present, the definitive Wicket Code Style may be considered to be that defined by the /trunk/jdk-1.4/wicket/.settings/org.eclipse.jdt.core.prefs file, which is all well & good as long as you're using Eclipse!

The intention here is to act as an aid for any developers interested in replicating the Wicket Code Style into something other than Eclipse. At present, as all the main committers appear to user that IDE, this hasn't a big problem, but I'd like to attempt to document the main points to help those considering alternative formatters.

It'll be a work-in-progress, so if you see something missing/wrong, please feel free to comment/update! I'm using the IDEA options as a guide, so if not clear to those not familiar with it, please ask for clarification.

(At the moment, I've just documented the primary options, but not yet tried to double-check the actual values)

Java Style

General - Tabs and Indents

Option Value Description
Use Tabs or Spaces Tabs
Smart Tabs () Inserts tabs for indentation and reformatting but the fine alignment to a necessary column is done using spaces. Otherwise, only tabs are used.
Tab Size 4 Number of spaces included within a tab
Indent 4 Number of spaces to insert for each indent level
Continuation indent 8 Number of spaces to insert in case of a construct break to be inserted at the next line
Right Margin (columns) 120 Column to wrap at

Alignment & Braces

Option Value Description
Class declaration On next line
Method declaration On next line
Other On next line
Special 'else if' treatment false Keep on same line
Indent 'case' from 'switch' true

Wrapping

Blank Lines

Keep Blank Lines

In declarations 0 Maximum number of blank lines that will be kept before class or method declarations after reformatting
In code 0 Maximum number of blank lines that will be kept among items within classes or methods after reformatting
Before '}' Maximum number of blank lines that will be kept before the closing code block brace after reformatting

Blank Lines

Before package statement 0
After package statement 1
Before imports 1
After imports 1
Around class 1
Around field 0
Around method 1
After class header 0

Spaces

Before Parentheses

Method call parentheses  
Method declaration parentheses  
'if' parentheses
'while' parentheses
'for' parentheses
'catch' parentheses
'switch' parentheses
'synchronized' parentheses  
Annotation parentheses  

Around operators

All operators

Before left brace ({)

All left braces

Within Parentheses

All parentheses  

Within Ternary Operator(?

Before '?' ()
After '?' ()
Before ':' ()
After ':' ()

Other

After comma (e.g. in argument lists) ()
After semicolon (e.g. in 'for' loops) ()

Imports

Use single class import () Import a particular class from a package is imported rather than '.*'
Use fully qualified class names in Javadoc () Use fully qualified class name rather than importing
Class count to use import with '*' 99 Specify number of classes to import from a package until switching to '.*'
Names count to use static import with '*' 99 Specify number of classes to import from a package until switching to '.*'

Layout

Imported classes will be grouped as below and sorted alphabetically within a grouping

  • java.*...
  • <blank line>
  • javax.*...
  • <blank line>
  • <all other imports>

JavaDoc

Alignment

Use these options to define how Javadoc comments are aligned.

Align parameter description () If this option is checked, parameter descriptions are aligned against the longest parameter name. Otherwise, the description is separated from the parameter name by a single space.
Align thrown exception description () If this option is checked, thrown exception descriptions are aligned against the longest exception name. Otherwise, the description is separated from the exception name by a single space.

Blank lines

Use these options to define where blank lines are inserted in the Javadoc comments.

After description () If this option is checked, a blank line is automatically inserted after the description section of Javadoc comment.
After parameter descriptions   If this option is checked, a blank line is inserted after the group of @param tags.
After return tag   If this option is checked, a blank line is inserted after the @return tag.

Invalid tags

Keep invalid tags () If this option is checked, the @invalidTag is preserved.
Keep empty @param tags () If this option is checked, the @param tags without description are preserved.
Keep empty @return tags () If this option is checked, the @return tags without description are preserved.
Keep empty @throws tags () If this option is checked, the @throws tags without description are preserved.

Other

Enable leading asterisks () If this option is checked, each line of a Javadoc comment starts with an asterisk.
Use @throws rather than @exception () If this option is checked, @throws tag is used.
Wrap at right margin   If this option is checked, the text that exceeds the right margin, is wrapped to the next line.
Generate </p> on empty lines   If this option is checked, </p> tag is automatically inserted to an empty line.
Keep empty lines () If this option is checked, the empty lines, inserted by the user, are preserved.
Do not wrap one-line comment   If this option is checked, short comments will be kept in one line with the opening and closing tags.

Reply via email to