Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 169934
Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java (-1 / +20 lines)
Lines 54-60 Link Here
54
	private long time;
54
	private long time;
55
	
55
	
56
	static {
56
	static {
57
//		TESTS_NUMBERS = new int[] { 667 };
57
//		TESTS_NUMBERS = new int[] { 668 };
58
//		TESTS_RANGE = new int[] { 658, -1 };
58
//		TESTS_RANGE = new int[] { 658, -1 };
59
	}
59
	}
60
	public static Test suite() {
60
	public static Test suite() {
Lines 9361-9364 Link Here
9361
			JavaCore.setOptions(javaCoreOptions);
9361
			JavaCore.setOptions(javaCoreOptions);
9362
		}
9362
		}
9363
	}
9363
	}
9364
	
9365
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=169934
9366
	public void test668() {
9367
		final Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
9368
		DefaultCodeFormatterOptions preferences = new DefaultCodeFormatterOptions(options);
9369
		preferences.comment_format_block_comment = true;
9370
		
9371
		preferences.insert_space_after_opening_paren_in_constructor_declaration = true;
9372
		preferences.insert_space_before_closing_paren_in_constructor_declaration = true;
9373
		
9374
		preferences.insert_space_after_opening_paren_in_method_declaration = true;
9375
		preferences.insert_space_before_closing_paren_in_method_declaration = true;
9376
		
9377
		preferences.insert_space_after_opening_paren_in_method_invocation = true;
9378
		preferences.insert_space_before_closing_paren_in_method_invocation = true;
9379
		
9380
		DefaultCodeFormatter codeFormatter = new DefaultCodeFormatter(preferences);
9381
		runTest(codeFormatter, "test668", "A.java", CodeFormatter.K_COMPILATION_UNIT);//$NON-NLS-1$ //$NON-NLS-2$
9382
	}
9364
}
9383
}
(-)workspace/Formatter/test668/A_in.java (+20 lines)
Added Link Here
1
public class FormatTest {
2
3
	public double test( int a, int /**/b/**/ ) {
4
		return a + /**/b/**/ * 2;
5
	}
6
7
	/**/public/**/ void foo() {
8
	}
9
10
	public /**/void/**/ bar() {
11
	}
12
13
	/**/public/**/ /**/void/**/ baz() {
14
	}
15
16
	/*
17
	 * A normal block comment.
18
	 */
19
20
}
(-)workspace/Formatter/test668/A_out.java (+20 lines)
Added Link Here
1
public class FormatTest {
2
3
	public double test( int a, int /**/b/**/ ) {
4
		return a + /**/b/**/ * 2;
5
	}
6
7
	/**/public/**/ void foo() {
8
	}
9
10
	public /**/void/**/ bar() {
11
	}
12
13
	/**/public/**/ /**/void/**/ baz() {
14
	}
15
16
	/*
17
	 * A normal block comment.
18
	 */
19
20
}
(-)formatter/org/eclipse/jdt/internal/formatter/Scribe.java (-1 / +6 lines)
Lines 753-758 Link Here
753
		if (this.pendingSpace) {
753
		if (this.pendingSpace) {
754
			this.addInsertEdit(currentTokenStartPosition, " "); //$NON-NLS-1$
754
			this.addInsertEdit(currentTokenStartPosition, " "); //$NON-NLS-1$
755
		}
755
		}
756
		else if (this.needSpace && currentTokenStartPosition > 0 && this.scanner.source[ currentTokenStartPosition - 1 ] ==  ' ') {
757
			this.addInsertEdit(currentTokenStartPosition, " "); //$NON-NLS-1$
758
			this.needSpace = false;
759
		}
760
		final boolean neededSpace = this.needSpace;
756
		this.needSpace = false;
761
		this.needSpace = false;
757
		this.pendingSpace = false;
762
		this.pendingSpace = false;
758
763
Lines 860-866 Link Here
860
			this.scanner.currentPosition = nextCharacterStart;
865
			this.scanner.currentPosition = nextCharacterStart;
861
		}
866
		}
862
		this.lastNumberOfNewLines = 0;
867
		this.lastNumberOfNewLines = 0;
863
		needSpace = false;
868
		this.needSpace = neededSpace;
864
		this.scanner.resetTo(currentTokenEndPosition, this.scannerEndPosition - 1);
869
		this.scanner.resetTo(currentTokenEndPosition, this.scannerEndPosition - 1);
865
		if (isJavadoc) {
870
		if (isJavadoc) {
866
			printNewLine();
871
			printNewLine();

Return to bug 169934