In Eclipse formatter for Java how can I format if-statements like
if (x != null
&& x.getSomething() != null
&& x.getSomething().getSomethingMore()) {
y.doSomething();
}
if they exceed the max line width (each statement on new line!). I thought it should be done with
but somehow I am wrong. Result:
if (x != null && x.getSomething() != null
&& x.getSomething().getSomethingMore()) {
y.doSomething();
}
CodePudding user response:
I'd recommend you to select the following options:
- Wrap all elements, every element on a new line
I do:
- Wrap before operators
- Wrap all elements, every element on a new line
- Force split
- Indent by one
Screenshot:
I hope this help you.