Skip to end of metadata
Go to start of metadata

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

Compare with Current View Page History

Version 1 Next »

Java Errors/Warnings


Developers should override default compiler error/warning and use project specific errors/warnings. These errors should be enabled:

  • Method with a constructor name - Error
  • Non-externalized strings (missing/unused $NON-NLS$ tag) - Warning
  • Assignment has no effect - Error
  • Possible accidental boolean assignment - Error
  • finally does not complete normally - Error
  • Using a char array in string concatenation - Error
  • Null pointer access - Error
  • Potential null pointer access - Warning
  • Unused Import - Error

Patches with errors listed above including API errors will not be accepted without corrections.

Additional requirements for Java source


  • Use interfaces as much as possible
  • All interfaces and methods must include a Javadoc comment
  • Interface implementations must include a non-Javadoc comment (using Generate Element Comment)
  • All classes, methods and fields should have an access modifier (public, protected, private)
  • Use the following class, method and field modifier order:
    1. Access modifier
    2. abstract
    3. static
    4. final
    5. transient
    6. volatile
  • All source should be formatted using the "mHARP" code formatter profile (see below)
  • All members should be cleaned up using the "mHARP" profile (Source->Clean Up)
  • Statement blocks should always be used, even for single line 'if', 'for', etc.
  • Column width should be set to 132

mHARP formatting and cleanup profiles for Java

The mHARP formatter and clean-up profiles are available here. To use the profiles,

  • Unzip on your machine to find two files: mHARP_format.xml and mHARP_cleanup.xml
  • Formatter: in Window > Preferences > Java > Code Style > Clean Up and select "Import" and import the mHARP-cleanup.xml file. The active profile should say "mHARP".
    • To use: Select a source file in Package Explorer (or container/folder/etc.) and select Source menu > Format
  • Cleanup in Window > Preferences > Java > Code Style > Formatter and select "Import" and import the mHARP-formatter.xml file. The active profile should say "mHARP".
    • To use: Select a source file in Package Explorer (or container/folder/etc.) and select Source menu > Cleanup ...
  • Optionally Set the editor to apply the formatting changes automatically on save for convenience and consistency in use in Window > Preferences > Java > Editor > Save Actions. Check "Perform the selected actions on save", check "Format source code", and check "Additional actions"
  • No labels