Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coverboy/678901991dd81dc315cbf6712af3e114 to your computer and use it in GitHub Desktop.
Save coverboy/678901991dd81dc315cbf6712af3e114 to your computer and use it in GitHub Desktop.
Example of the use of the @Formatter:off and @Formatter:on annotations in eclipse to disable formatting for a piece of code.
public class Formatter {
/**
* The next piece of code is not formatted
* because of the @formatter annotations.
*/
// @formatter:off
public void nonFormattedMethod() {
int sum = 1 + 2 + 3 + 4 + 5;
}
// @formatter:on
/**
* Without the @formatter annotations the
* same piece of code is formatted as below.
*/
public void formattedMethod() {
int sum = 1 + 2 + 3
+ 4 + 5;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment