Community
Participate
Working Groups
// preserve line breaks in wrapping if specified
// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=198074
if (this.currentAlignment != null && this.memberAlignment != null && !this.formatter.preferences.join_wrapped_lines) {
if (this.memberAlignment.depth() <= this.currentAlignment.depth()) {
if (this.scanner.currentCharacter != '}' && this.memberAlignment.depth() <= this.currentAlignment.depth()) {
int savedIndentation = this.indentationLevel;
StringBuffer buffer = new StringBuffer(getNewLine());
this.indentationLevel = this.currentAlignment.breakIndentationLevel;
);
}
/**
* @bug 279359: [formatter] Formatter with 'never join lines' produces extra level of indent
* @test Ensure that no extra indentation is produced at the end of a body when
* 'never join lines' preference is set.
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=279359"
*/
public void testBug279359() throws JavaModelException {
this.formatterPrefs.join_wrapped_lines = false;
String source =
"public class Formatter {\n" +
"\n" +
" public static void main(String[] args) {\n" +
" Executors.newCachedThreadPool().execute(new Runnable() {\n" +
" public void run() {\n" +
" throw new UnsupportedOperationException(\"stub\");\n" +
" }\n" +
" });\n" +
"}\n";
formatSource(source,
"}\n"