Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


Proposed DSpace Java Style Guide (work-in-progress - not yet approved)


If you would like to comment on this proposal, please add your thoughts to this Pull Request:

Bolded rules are a change from our current Style Guide.

  1. 4-space indents for Java, and 2-space indents for XML. NO TABS ALLOWED.
    1.  Only exception is throws clause, which should be indented 8 spaces if on a new line
  2. K&R style braces required. Braces required on all blocks.

    Code Block
    if (code) {
      // code
    } else {
      // code

  3. Do not use wildcard imports (e.g. import java.util.*). Duplicated or unused imports are also not allowed.
  4. Write Javadocs for public methods and classes. Keep it short and to the point.
    1. (UNDER DISCUSSION) Javadoc @author tags are optional, but should refer to an individual's name or handle (e.g. GitHub username) when included?
  5. Maximum length of lines is 120 characters.

  6. UTF-8 encoding is required
  7. No trailing spaces allowed (except in comments)
  8. Tokens should be surrounded by whitespace, e.g.
  9. Each source file must contain the required license header, e.g.

    Code Block
     * The contents of this file are subject to the license and copyright
     * detailed in the LICENSE and NOTICE files at the root of the source
     * tree and available online at