Java Cleanup (Eclipse)

Tuesday, 31 December 2013, 18:49

Tags: Eclipse

The previous post described how to configure the save actions to clean up your code every time you save a Java file. A similar result can be achieved by configuring the clean up settings and then manually triggering a clean up by clicking right -> Source -> Clean Up.

An export of my clean up settings can be found here. The settings are configured similar to my save actions configuration.

  • Format source code
  • Remove trailing white spaces on all lines
  • Correct indentation
  • Organize imports
  • Change indirect accesses to static members to direct accesses (accesses through subtypes)
  • Change non static accesses to static members using declaring type
  • Add missing '@Override' annotations
  • Add missing '@Override' annotations to implementations of interface methods
  • Add missing '@Deprecated' annotations
  • Remove unused imports
  • Remove unnecessary casts