Skip to content

Instantly share code, notes, and snippets.

@vanpeerdevelopment
Last active August 22, 2021 07:17
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vanpeerdevelopment/8198598 to your computer and use it in GitHub Desktop.
Save vanpeerdevelopment/8198598 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