How to keep simple getters/setters on the same line? [message #1849691] |
Sat, 29 January 2022 23:14 |
|
Is it possible to have the formatter format code like this:
public int getNumber() { return 7; }
public void doSomething()
{
System.out.println("Seven.");
}
I want to normally have braces positioned on the NEXT line, with the exception for simple getters and setters such as the above one, which I want entirely on a single line. I tried to achieve this by specifying (what I think are the relevant bits):
brace positions > method declaration = next line
new lines > keep braced code on one line > method declaration = never
new lines > keep braced code on one line > method declaration > keep simple getters and setters on one line = true
line wrapping > never join already wrapped lines = false
line wrapping > wrapping settings = method declarations > declaration = do not wrap
But the result is at best something like this:
public int getNumber()
{ return 7; }
public void doSomething()
{
System.out.println("Seven.");
}
That is not what I consider "one line", so what is this about and how can I do it properly?
Note: I tried to change the brace position to "same line" too, and then it does put it on one line, but it also changes the opening brace for all methods instead of just for the simple getters/setters.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04266 seconds