Last active
September 15, 2025 21:28
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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