Skip to content

DevGuide_RefactorXtend2Java

Karsten Thoms edited this page Nov 21, 2019 · 2 revisions

Some steps to consider when refactoring compiled Xtend code to Java again (see #1569):

  1. Disable Automatic Build
  2. Move Java sources from xtend-gen to src
  3. Auto-Format the source code
  4. Perform Source / Clean Up action. See here for the cleanup actions settings to apply.
  5. Remove @SuppressWarnings("all")
  6. Start manual source cleanup
  7. Move constructor to appropriate place. Often they are much too late in the code
  8. Remove super() calls in constructors
  9. Look for unnecessary final modifiers, esp. in parameters
  10. Remove references to active annotations. The resulting code should not import anything unnecessary from org.eclipse.xtext.xbase.lib.
  11. hashCode: Use java.util.Objects#hash()
  12. Replace Guava Objects#equal() by Java Objects#equals()
  13. Look out for double parantheses ((. Sometimes expressions are unnnecessarily enclosed by parentheses.
  14. Remove unnecessary this. qualifiers
  15. Update copyright header upper year
  16. Remove unused imports
  17. Use method references where appropriate
  18. When nested classes are used, access to them e.g. in casts are unnecessarily qualified by the enclosing type name.
  19. Resolve usage of Exceptions#sneakyThrow()
Clone this wiki locally