Skip to content

DevGuide_RefactorXtend2Java

Karsten Thoms edited this page Nov 22, 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. Replace Guava Objects#equal() by Java Objects#equals()
  12. Look out for double parantheses ((. Sometimes expressions are unnnecessarily enclosed by parentheses.
  13. Remove unnecessary this. qualifiers
  14. Update copyright header upper year
  15. Remove unused imports
  16. Use method references where appropriate
  17. When nested classes are used, access to them e.g. in casts are unnecessarily qualified by the enclosing type name.
  18. Resolve usage of Exceptions#sneakyThrow()
  19. Check that no inline comment gets lost
Clone this wiki locally