You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This page documents the standard adopted for Java code in the Qpid project. All committers are expected to follow these standards; checkstyle or similar is used to check compliance.

Executive Summary

The main things in the standard are:

  • Indent using four spaces. No tabs.
  • braces always go on new lines, e.g.
if (x == 5)
{
    System.out.println("Hello");
}

rather than

if (x == 5} {
    System.out.println("Hello");
}
  • Always add braces, e.g.
    if (x == 5)
    {
        System.out.println("Hello");
    }
    

rather than

if (x == 5}
    System.out.println("Hello");
  • Fields prefixed with underscores, e.g. _messageCount
  • Spaces after keywords but no spaces either before or after parentheses in method calls, e.g.
    if (x == 5)
    
    rather than
    if(x==5)
    
    but
    foo.bar(4, 5)
    
    rather than
    foo.bar( 4, 5 )
    

Details

  • No labels