View | Details | Raw Unified | Return to bug 311578 | Differences between
and this patch

Collapse All | Expand All

(-)formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java (-4 / +86 lines)
Lines 913-919 Link Here
913
	 * void bar1() {}
913
	 * void bar1() {}
914
	 * void bar2() {}
914
	 * void bar2() {}
915
	 * }
915
	 * }
916
	 * </pre>
916
	 * </pre></p>
917
	 * </li>
917
	 * </li>
918
	 * <li>If no enabling tag is found by the formatter after the disabling tag, then
918
	 * <li>If no enabling tag is found by the formatter after the disabling tag, then
919
	 * the end of the snippet won't be formatted.<br>
919
	 * the end of the snippet won't be formatted.<br>
Lines 951-957 Link Here
951
	 * <li>The tag cannot include newline character (i.e. '\n') but it can have white
951
	 * <li>The tag cannot include newline character (i.e. '\n') but it can have white
952
	 * spaces.<br>
952
	 * spaces.<br>
953
	 * E.g. "<b>format: off</b>" is a valid disabling tag.<br>
953
	 * E.g. "<b>format: off</b>" is a valid disabling tag.<br>
954
	 * In the future, newlines may be used to support multiple disabling tags.</li>
954
	 * In the future, newlines may be used to support multiple disabling tags.
955
	 * </li>
956
	 * <li>The tag can include line or block comments start/end tokens.
957
	 * <p>If such tags are used, e.g. "<b>//J-</b>", then the single comment can
958
	 * also stop the formatting as shown in the following snippet:</p>
959
	 * <pre>
960
	 * //J-
961
	 * // Formatting was stopped from comment above...
962
	 * public class X {
963
	 * //J+
964
	 * // Formatting is restarted from here...
965
	 * void foo() {}
966
	 * </pre>
967
	 * <p>As any disabling tags, as soon as a comment includes it,
968
	 * the formatting stops from this comment:</p>
969
	 * <pre>
970
	 * public class X {
971
	 * // Line comment including the disabling tag: //J-
972
	 * // Formatting was stopped from comment above...
973
	 * void   foo1()   {}
974
	 * //J+
975
	 * // Formatting restarts from here...
976
	 * void   bar1()   {}
977
	 * &#47;&#42;
978
	 * &nbsp;&#42; Block comment including the disabling tag: //J+
979
	 * &nbsp;&#42; The formatter stops from this comment...
980
	 * &nbsp;&#42;&#47;
981
	 * void   foo2()   {}
982
	 * //J+
983
	 * // Formatting restarts from here...
984
	 * void   bar2()   {}
985
	 * &#47;&#42;&#42;
986
	 * &nbsp;&#42; Javadoc comment including the enabling tag: //J+
987
	 * &nbsp;&#42; The formatter stops from this comment...
988
	 * &nbsp;&#42;&#47;
989
	 * void   foo3()   {}
990
	 * }
991
	 * </pre>
992
	 * </li>
955
	 * </ol>
993
	 * </ol>
956
	 * </p>
994
	 * </p>
957
	 * @since 3.6
995
	 * @since 3.6
Lines 1012-1018 Link Here
1012
	 * // @formatter:on
1050
	 * // @formatter:on
1013
	 * void bar2() {}
1051
	 * void bar2() {}
1014
	 * }
1052
	 * }
1015
	 * </pre>
1053
	 * </pre></p>
1016
	 * </li>
1054
	 * </li>
1017
	 * <li>If a mix of disabling and enabling tags is done in the same comment, then
1055
	 * <li>If a mix of disabling and enabling tags is done in the same comment, then
1018
	 * the formatter will only take into account the last encountered tag in the
1056
	 * the formatter will only take into account the last encountered tag in the
Lines 1033-1042 Link Here
1033
	 * void bar() {}
1071
	 * void bar() {}
1034
	 * }
1072
	 * }
1035
	 * </pre>
1073
	 * </pre>
1074
	 * </li>
1036
	 * <li>The tag cannot include newline character (i.e. '\n') but it can have white
1075
	 * <li>The tag cannot include newline character (i.e. '\n') but it can have white
1037
	 * spaces.<br>
1076
	 * spaces.<br>
1038
	 * E.g. "<b>format: on</b>" is a valid enabling tag<br>
1077
	 * E.g. "<b>format: on</b>" is a valid enabling tag<br>
1039
	 * In the future, newlines may be used to support multiple enabling tags.</li>
1078
	 * In the future, newlines may be used to support multiple enabling tags.
1079
	 * </li>
1080
	 * <li>The tag can include line or block comments start/end tokens. Javadoc
1081
	 * tokens are not considered as valid tags.
1082
	 * <p>If such tags are used, e.g. "<b>//J+</b>", then the single comment can
1083
	 * also start the formatting as shown in the following snippet:</p>
1084
	 * <pre>
1085
	 * //J-
1086
	 * // Formatting was stopped from comment above...
1087
	 * public class X {
1088
	 * //J+
1089
	 * // Formatting restarts from here...
1090
	 * void foo() {}
1091
	 * }
1092
	 * </pre>
1093
	 * <p>As any enabling tags, as soon as a comment includes it,
1094
	 * the formatting restarts just after the comment:</p>
1095
	 * <pre>
1096
	 * public class X {
1097
	 * //J-
1098
	 * // Formatting was stopped from comment above...
1099
	 * void   foo1()   {}
1100
	 * // Line comment including the enabling tag: //J+
1101
	 * // Formatting restarts from here...
1102
	 * void   bar1()   {}
1103
	 * //J-
1104
	 * // Formatting was stopped from comment above...
1105
	 * void   foo2()   {}
1106
	 * &#47;&#42;
1107
	 * &nbsp;&#42; Block comment including the enabling tag: //J+
1108
	 * &nbsp;&#42; The formatter restarts after this comment...
1109
	 * &nbsp;&#42;&#47;
1110
	 * // Formatting restarts from here...
1111
	 * void   bar2()   {}
1112
	 * //J-
1113
	 * // Formatting was stopped from comment above...
1114
	 * void   foo3()   {}
1115
	 * &#47;&#42;&#42;
1116
	 * &nbsp;&#42; Javadoc comment including the enabling tag: //J+
1117
	 * &nbsp;&#42; The formatter restarts after this comment...
1118
	 * &nbsp;&#42;&#47;
1119
	 * void   bar3()   {}
1120
	 * }
1121
	 * </pre>
1040
	 * </li>
1122
	 * </li>
1041
	 * </ol>
1123
	 * </ol>
1042
	 * </p>
1124
	 * </p>
(-)formatter/org/eclipse/jdt/internal/formatter/Scribe.java (-43 / +121 lines)
Lines 108-113 Link Here
108
	/** disabling */
108
	/** disabling */
109
	boolean editsEnabled;
109
	boolean editsEnabled;
110
	boolean useTags;
110
	boolean useTags;
111
	int tagsKind;
111
112
112
	/* Comments formatting */
113
	/* Comments formatting */
113
	private static final int INCLUDE_BLOCK_COMMENTS = CodeFormatter.F_INCLUDE_COMMENTS | CodeFormatter.K_MULTI_LINE_COMMENT;
114
	private static final int INCLUDE_BLOCK_COMMENTS = CodeFormatter.F_INCLUDE_COMMENTS | CodeFormatter.K_MULTI_LINE_COMMENT;
Lines 1419-1424 Link Here
1419
1420
1420
	private void initializeScanner(long sourceLevel, DefaultCodeFormatterOptions preferences) {
1421
	private void initializeScanner(long sourceLevel, DefaultCodeFormatterOptions preferences) {
1421
		this.useTags = preferences.use_tags;
1422
		this.useTags = preferences.use_tags;
1423
		this.tagsKind = 0;
1422
		char[][] taskTags = null;
1424
		char[][] taskTags = null;
1423
		if (this.useTags) {
1425
		if (this.useTags) {
1424
			this.disablingTag = preferences.disabling_tag;
1426
			this.disablingTag = preferences.disabling_tag;
Lines 1433-1438 Link Here
1433
				taskTags = new char[][] { this.disablingTag, this.enablingTag };
1435
				taskTags = new char[][] { this.disablingTag, this.enablingTag };
1434
			}
1436
			}
1435
		}
1437
		}
1438
		if (taskTags != null) {
1439
			loop: for (int i=0,length=taskTags.length; i<length; i++) {
1440
				if (taskTags[i].length > 2 && taskTags[i][0] == '/') {
1441
					switch (taskTags[i][1]) {
1442
						case '/':
1443
							this.tagsKind = TerminalTokens.TokenNameCOMMENT_LINE;
1444
							break loop;
1445
						case '*':
1446
							if (taskTags[i][2] != '*') {
1447
								this.tagsKind = TerminalTokens.TokenNameCOMMENT_BLOCK;
1448
								break loop;
1449
							}
1450
							break;
1451
					}
1452
				}
1453
			}
1454
		}
1436
		this.scanner = new Scanner(true, true, false/*nls*/, sourceLevel/*sourceLevel*/, taskTags, null/*taskPriorities*/, true/*taskCaseSensitive*/);
1455
		this.scanner = new Scanner(true, true, false/*nls*/, sourceLevel/*sourceLevel*/, taskTags, null/*taskPriorities*/, true/*taskCaseSensitive*/);
1437
		this.editsEnabled = true;
1456
		this.editsEnabled = true;
1438
	}
1457
	}
Lines 2368-2377 Link Here
2368
			int lines = 0;
2387
			int lines = 0;
2369
			while ((this.currentToken = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
2388
			while ((this.currentToken = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
2370
				int foundTaskCount = this.scanner.foundTaskCount;
2389
				int foundTaskCount = this.scanner.foundTaskCount;
2390
				int tokenStartPosition = this.scanner.getCurrentTokenStartPosition();
2371
				switch(this.currentToken) {
2391
				switch(this.currentToken) {
2372
					case TerminalTokens.TokenNameWHITESPACE :
2392
					case TerminalTokens.TokenNameWHITESPACE :
2373
						char[] whiteSpaces = this.scanner.getCurrentTokenSource();
2393
						char[] whiteSpaces = this.scanner.getCurrentTokenSource();
2374
						int whitespacesStartPosition = this.scanner.getCurrentTokenStartPosition();
2375
						int whitespacesEndPosition = this.scanner.getCurrentTokenEndPosition();
2394
						int whitespacesEndPosition = this.scanner.getCurrentTokenEndPosition();
2376
						lines = 0;
2395
						lines = 0;
2377
						for (int i = 0, max = whiteSpaces.length; i < max; i++) {
2396
						for (int i = 0, max = whiteSpaces.length; i < max; i++) {
Lines 2445-2451 Link Here
2445
							// if a line comment is consumed, no other comment can be on the same line after
2464
							// if a line comment is consumed, no other comment can be on the same line after
2446
							if (hasLineComment) {
2465
							if (hasLineComment) {
2447
								if (lines >= 1) {
2466
								if (lines >= 1) {
2448
									currentTokenStartPosition = whitespacesStartPosition;
2467
									currentTokenStartPosition = tokenStartPosition;
2449
									preserveEmptyLines(lines, currentTokenStartPosition);
2468
									preserveEmptyLines(lines, currentTokenStartPosition);
2450
									addDeleteEdit(currentTokenStartPosition, whitespacesEndPosition);
2469
									addDeleteEdit(currentTokenStartPosition, whitespacesEndPosition);
2451
									this.scanner.resetTo(this.scanner.currentPosition, this.scannerEndPosition - 1);
2470
									this.scanner.resetTo(this.scanner.currentPosition, this.scannerEndPosition - 1);
Lines 2457-2463 Link Here
2457
							// if one or several new lines are consumed, following comments cannot be considered as trailing ones
2476
							// if one or several new lines are consumed, following comments cannot be considered as trailing ones
2458
							if (lines >= 1) {
2477
							if (lines >= 1) {
2459
								if (hasComment) {
2478
								if (hasComment) {
2460
									this.printNewLine(whitespacesStartPosition);
2479
									this.printNewLine(tokenStartPosition);
2461
								}
2480
								}
2462
								this.scanner.resetTo(currentTokenStartPosition, this.scannerEndPosition - 1);
2481
								this.scanner.resetTo(currentTokenStartPosition, this.scannerEndPosition - 1);
2463
								return;
2482
								return;
Lines 2465-2501 Link Here
2465
							// delete consumed white spaces
2484
							// delete consumed white spaces
2466
							hasWhitespaces = true;
2485
							hasWhitespaces = true;
2467
							currentTokenStartPosition = this.scanner.currentPosition;
2486
							currentTokenStartPosition = this.scanner.currentPosition;
2468
							addDeleteEdit(whitespacesStartPosition, whitespacesEndPosition);
2487
							addDeleteEdit(tokenStartPosition, whitespacesEndPosition);
2469
						} else {
2488
						} else {
2470
							if (lines == 0) {
2489
							if (lines == 0) {
2471
								hasWhitespaces = true;
2490
								hasWhitespaces = true;
2472
								addDeleteEdit(whitespacesStartPosition, whitespacesEndPosition);
2491
								addDeleteEdit(tokenStartPosition, whitespacesEndPosition);
2473
							} else if (hasLineComment) {
2492
							} else if (hasLineComment) {
2474
								currentTokenStartPosition = whitespacesStartPosition;
2493
								currentTokenStartPosition = tokenStartPosition;
2475
								preserveEmptyLines(lines, currentTokenStartPosition);
2494
								preserveEmptyLines(lines, currentTokenStartPosition);
2476
								addDeleteEdit(currentTokenStartPosition, whitespacesEndPosition);
2495
								addDeleteEdit(currentTokenStartPosition, whitespacesEndPosition);
2477
							} else if (hasComment) {
2496
							} else if (hasComment) {
2478
								if (lines == 1) {
2497
								if (lines == 1) {
2479
									this.printNewLine(whitespacesStartPosition);
2498
									this.printNewLine(tokenStartPosition);
2480
								} else {
2499
								} else {
2481
									preserveEmptyLines(lines - 1, whitespacesStartPosition);
2500
									preserveEmptyLines(lines - 1, tokenStartPosition);
2482
								}
2501
								}
2483
								addDeleteEdit(whitespacesStartPosition, whitespacesEndPosition);
2502
								addDeleteEdit(tokenStartPosition, whitespacesEndPosition);
2484
							} else if (lines != 0 && (!this.formatter.preferences.join_wrapped_lines || this.formatter.preferences.number_of_empty_lines_to_preserve != 0 || this.blank_lines_between_import_groups > 0)) {
2503
							} else if (lines != 0 && (!this.formatter.preferences.join_wrapped_lines || this.formatter.preferences.number_of_empty_lines_to_preserve != 0 || this.blank_lines_between_import_groups > 0)) {
2485
								addReplaceEdit(whitespacesStartPosition, whitespacesEndPosition, getPreserveEmptyLines(lines-1));
2504
								addReplaceEdit(tokenStartPosition, whitespacesEndPosition, getPreserveEmptyLines(lines-1));
2486
							} else {
2505
							} else {
2487
								addDeleteEdit(whitespacesStartPosition, whitespacesEndPosition);
2506
								addDeleteEdit(tokenStartPosition, whitespacesEndPosition);
2488
							}
2507
							}
2489
						}
2508
						}
2490
						currentTokenStartPosition = this.scanner.currentPosition;
2509
						currentTokenStartPosition = this.scanner.currentPosition;
2491
						break;
2510
						break;
2492
					case TerminalTokens.TokenNameCOMMENT_LINE :
2511
					case TerminalTokens.TokenNameCOMMENT_LINE :
2493
						if (this.useTags && this.editsEnabled && foundTaskCount > 0) {
2512
						if (this.useTags && this.editsEnabled) {
2494
							setEditsEnabled(foundTaskCount);
2513
							boolean turnOff = false;
2495
							if (!this.editsEnabled && this.editsIndex > 1) {
2514
							if (foundTaskCount > 0) {
2496
								OptimizedReplaceEdit currentEdit = this.edits[this.editsIndex-1];
2515
								setEditsEnabled(foundTaskCount);
2497
								if (this.scanner.startPosition == currentEdit.offset+currentEdit.length) {
2516
								turnOff = true;
2498
									printNewLinesBeforeDisablingComment();
2517
							} else if (this.tagsKind == this.currentToken
2518
								&& CharOperation.fragmentEquals(this.disablingTag, this.scanner.source, tokenStartPosition, true)) {
2519
    							this.editsEnabled = false;
2520
								turnOff = true;
2521
					    	}
2522
							if (turnOff) {
2523
								if (!this.editsEnabled && this.editsIndex > 1) {
2524
									OptimizedReplaceEdit currentEdit = this.edits[this.editsIndex-1];
2525
									if (this.scanner.startPosition == currentEdit.offset+currentEdit.length) {
2526
										printNewLinesBeforeDisablingComment();
2527
									}
2499
								}
2528
								}
2500
							}
2529
							}
2501
						}
2530
						}
Lines 2514-2530 Link Here
2514
						currentTokenStartPosition = this.scanner.currentPosition;
2543
						currentTokenStartPosition = this.scanner.currentPosition;
2515
						hasLineComment = true;
2544
						hasLineComment = true;
2516
						lines = 0;
2545
						lines = 0;
2517
						if (this.useTags && !this.editsEnabled && foundTaskCount > 0) {
2546
						if (this.useTags && !this.editsEnabled) {
2518
							setEditsEnabled(foundTaskCount);
2547
							if (foundTaskCount > 0) {
2548
								setEditsEnabled(foundTaskCount);
2549
							} else if (this.tagsKind == this.currentToken) {
2550
	    						this.editsEnabled = CharOperation.fragmentEquals(this.enablingTag, this.scanner.source, tokenStartPosition, true);
2551
					    	}
2519
						}
2552
						}
2520
						break;
2553
						break;
2521
					case TerminalTokens.TokenNameCOMMENT_BLOCK :
2554
					case TerminalTokens.TokenNameCOMMENT_BLOCK :
2522
						if (this.useTags && this.editsEnabled && foundTaskCount > 0) {
2555
						if (this.useTags && this.editsEnabled) {
2523
							setEditsEnabled(foundTaskCount);
2556
							boolean turnOff = false;
2524
							if (!this.editsEnabled && this.editsIndex > 1) {
2557
							if (foundTaskCount > 0) {
2525
								OptimizedReplaceEdit currentEdit = this.edits[this.editsIndex-1];
2558
								setEditsEnabled(foundTaskCount);
2526
								if (this.scanner.startPosition == currentEdit.offset+currentEdit.length) {
2559
								turnOff = true;
2527
									printNewLinesBeforeDisablingComment();
2560
							} else if (this.tagsKind == this.currentToken
2561
								&& CharOperation.fragmentEquals(this.disablingTag, this.scanner.source, tokenStartPosition, true)) {
2562
    							this.editsEnabled = false;
2563
								turnOff = true;
2564
					    	}
2565
							if (turnOff) {
2566
								if (!this.editsEnabled && this.editsIndex > 1) {
2567
									OptimizedReplaceEdit currentEdit = this.edits[this.editsIndex-1];
2568
									if (this.scanner.startPosition == currentEdit.offset+currentEdit.length) {
2569
										printNewLinesBeforeDisablingComment();
2570
									}
2528
								}
2571
								}
2529
							}
2572
							}
2530
						}
2573
						}
Lines 2550-2557 Link Here
2550
						hasLineComment = false;
2593
						hasLineComment = false;
2551
						hasComment = true;
2594
						hasComment = true;
2552
						lines = 0;
2595
						lines = 0;
2553
						if (this.useTags && !this.editsEnabled && foundTaskCount > 0) {
2596
						if (this.useTags && !this.editsEnabled) {
2554
							setEditsEnabled(foundTaskCount);
2597
							if (foundTaskCount > 0) {
2598
								setEditsEnabled(foundTaskCount);
2599
							} else if (this.tagsKind == this.currentToken) {
2600
	    						this.editsEnabled = CharOperation.fragmentEquals(this.enablingTag, this.scanner.source, tokenStartPosition, true);
2601
					    	}
2555
						}
2602
						}
2556
						break;
2603
						break;
2557
					case TerminalTokens.TokenNameCOMMENT_JAVADOC :
2604
					case TerminalTokens.TokenNameCOMMENT_JAVADOC :
Lines 4430-4435 Link Here
4430
			boolean hasModifiers = false;
4477
			boolean hasModifiers = false;
4431
			while ((this.currentToken = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
4478
			while ((this.currentToken = this.scanner.getNextToken()) != TerminalTokens.TokenNameEOF) {
4432
				int foundTaskCount = this.scanner.foundTaskCount;
4479
				int foundTaskCount = this.scanner.foundTaskCount;
4480
				int tokenStartPosition = this.scanner.getCurrentTokenStartPosition();
4481
				int tokenEndPosition = this.scanner.getCurrentTokenEndPosition();
4433
				switch(this.currentToken) {
4482
				switch(this.currentToken) {
4434
					case TerminalTokens.TokenNamepublic :
4483
					case TerminalTokens.TokenNamepublic :
4435
					case TerminalTokens.TokenNameprotected :
4484
					case TerminalTokens.TokenNameprotected :
Lines 4494-4528 Link Here
4494
						break;
4543
						break;
4495
					case TerminalTokens.TokenNameCOMMENT_BLOCK :
4544
					case TerminalTokens.TokenNameCOMMENT_BLOCK :
4496
					case TerminalTokens.TokenNameCOMMENT_JAVADOC :
4545
					case TerminalTokens.TokenNameCOMMENT_JAVADOC :
4497
						if (this.useTags && this.editsEnabled && foundTaskCount > 0) {
4546
						if (this.useTags && this.editsEnabled) {
4498
							setEditsEnabled(foundTaskCount);
4547
							boolean turnOff = false;
4499
							if (!this.editsEnabled && this.editsIndex > 1) {
4548
							if (foundTaskCount > 0) {
4500
								OptimizedReplaceEdit currentEdit = this.edits[this.editsIndex-1];
4549
								setEditsEnabled(foundTaskCount);
4501
								if (this.scanner.startPosition == currentEdit.offset+currentEdit.length) {
4550
								turnOff = true;
4502
									printNewLinesBeforeDisablingComment();
4551
							} else if (this.tagsKind == this.currentToken
4552
								&& CharOperation.equals(this.disablingTag, this.scanner.source, tokenStartPosition, tokenEndPosition+1)) {
4553
    							this.editsEnabled = false;
4554
								turnOff = true;
4555
					    	}
4556
							if (turnOff) {
4557
								if (!this.editsEnabled && this.editsIndex > 1) {
4558
									OptimizedReplaceEdit currentEdit = this.edits[this.editsIndex-1];
4559
									if (this.scanner.startPosition == currentEdit.offset+currentEdit.length) {
4560
										printNewLinesBeforeDisablingComment();
4561
									}
4503
								}
4562
								}
4504
							}
4563
							}
4505
						}
4564
						}
4506
						printBlockComment(this.currentToken == TerminalTokens.TokenNameCOMMENT_JAVADOC);
4565
						printBlockComment(this.currentToken == TerminalTokens.TokenNameCOMMENT_JAVADOC);
4507
						if (this.useTags && !this.editsEnabled && foundTaskCount > 0) {
4566
						if (this.useTags && !this.editsEnabled) {
4508
							setEditsEnabled(foundTaskCount);
4567
							if (foundTaskCount > 0) {
4568
								setEditsEnabled(foundTaskCount);
4569
							} else if (this.tagsKind == this.currentToken) {
4570
	    						this.editsEnabled = CharOperation.equals(this.enablingTag, this.scanner.source, tokenStartPosition, tokenEndPosition+1);
4571
					    	}
4509
						}
4572
						}
4510
						currentTokenStartPosition = this.scanner.currentPosition;
4573
						currentTokenStartPosition = this.scanner.currentPosition;
4511
						hasComment = true;
4574
						hasComment = true;
4512
						break;
4575
						break;
4513
					case TerminalTokens.TokenNameCOMMENT_LINE :
4576
					case TerminalTokens.TokenNameCOMMENT_LINE :
4514
						if (this.useTags && this.editsEnabled && foundTaskCount > 0) {
4577
						tokenEndPosition = -this.scanner.commentStops[this.scanner.commentPtr];
4515
							setEditsEnabled(foundTaskCount);
4578
						if (this.useTags && this.editsEnabled) {
4516
							if (!this.editsEnabled && this.editsIndex > 1) {
4579
							boolean turnOff = false;
4517
								OptimizedReplaceEdit currentEdit = this.edits[this.editsIndex-1];
4580
							if (foundTaskCount > 0) {
4518
								if (this.scanner.startPosition == currentEdit.offset+currentEdit.length) {
4581
								setEditsEnabled(foundTaskCount);
4519
									printNewLinesBeforeDisablingComment();
4582
								turnOff = true;
4583
							} else if (this.tagsKind == this.currentToken
4584
								&& CharOperation.equals(this.disablingTag, this.scanner.source, tokenStartPosition, tokenEndPosition)) {
4585
    							this.editsEnabled = false;
4586
								turnOff = true;
4587
					    	}
4588
							if (turnOff) {
4589
								if (!this.editsEnabled && this.editsIndex > 1) {
4590
									OptimizedReplaceEdit currentEdit = this.edits[this.editsIndex-1];
4591
									if (this.scanner.startPosition == currentEdit.offset+currentEdit.length) {
4592
										printNewLinesBeforeDisablingComment();
4593
									}
4520
								}
4594
								}
4521
							}
4595
							}
4522
						}
4596
						}
4523
						printLineComment();
4597
						printLineComment();
4524
						if (this.useTags && !this.editsEnabled && foundTaskCount > 0) {
4598
						if (this.useTags && !this.editsEnabled) {
4525
							setEditsEnabled(foundTaskCount);
4599
							if (foundTaskCount > 0) {
4600
								setEditsEnabled(foundTaskCount);
4601
							} else if (this.tagsKind == this.currentToken) {
4602
	    						this.editsEnabled = CharOperation.equals(this.enablingTag, this.scanner.source, tokenStartPosition, tokenEndPosition);
4603
					    	}
4526
						}
4604
						}
4527
						currentTokenStartPosition = this.scanner.currentPosition;
4605
						currentTokenStartPosition = this.scanner.currentPosition;
4528
						break;
4606
						break;
(-)src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java (-50 / +466 lines)
Lines 363-379 Link Here
363
	this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray();
363
	this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray();
364
	this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray();
364
	this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray();
365
	String source =
365
	String source =
366
		"public class X04 {\r\n" + 
366
		"public class X04 {\n" + 
367
		"\r\n" + 
367
		"\n" + 
368
		"/* disable-formatter */\r\n" + 
368
		"/* disable-formatter */\n" + 
369
		"void     foo(    )      {	\r\n" + 
369
		"void     foo(    )      {	\n" + 
370
		"				//      unformatted       comment  	  \r\n" + 
370
		"				//      unformatted       comment  	  \n" + 
371
		"}\r\n" + 
371
		"}\n" + 
372
		"/* enable-formatter */\r\n" + 
372
		"/* enable-formatter */\n" + 
373
		"void     bar(    )      {	\r\n" + 
373
		"void     bar(    )      {	\n" + 
374
		"				//      formatted       comment  	  \r\n" + 
374
		"				//      formatted       comment  	  \n" + 
375
		"}\r\n" + 
375
		"}\n" + 
376
		"}\r\n";
376
		"}\n";
377
	formatSource(source,
377
	formatSource(source,
378
		"public class X04 {\n" + 
378
		"public class X04 {\n" + 
379
		"\n" + 
379
		"\n" + 
Lines 410-431 Link Here
410
		"}\n" + 
410
		"}\n" + 
411
		"}\n";
411
		"}\n";
412
	formatSource(source,
412
	formatSource(source,
413
		"public class X04b {\r\n" + 
413
		"public class X04b {\n" + 
414
		"\r\n" + 
414
		"\n" + 
415
		"/* disable-formatter */\r\n" + 
415
		"/* disable-formatter */\n" + 
416
		"void     foo(    )      {	\r\n" + 
416
		"void     foo(    )      {	\n" + 
417
		"				//      unformatted       comment  	  \r\n" + 
417
		"				//      unformatted       comment  	  \n" + 
418
		"}\r\n" + 
418
		"}\n" + 
419
		"/* enable-formatter */\r\n" + 
419
		"/* enable-formatter */\n" + 
420
		"	void bar() {\r\n" + 
420
		"	void bar() {\n" + 
421
		"		// formatted comment\r\n" + 
421
		"		// formatted comment\n" + 
422
		"	}\r\n" + 
422
		"	}\n" + 
423
		"}\r\n",
423
		"}\n",
424
		CodeFormatter.K_COMPILATION_UNIT | CodeFormatter.F_INCLUDE_COMMENTS,
424
		CodeFormatter.K_COMPILATION_UNIT | CodeFormatter.F_INCLUDE_COMMENTS,
425
		0 /* indentation level */,
425
		0 /* indentation level */,
426
		0 /* offset */,
426
		0 /* offset */,
427
		-1 /* length (all) */,
427
		-1 /* length (all) */,
428
		"\r\n",
428
		"\n",
429
		true/*repeat*/);
429
		true/*repeat*/);
430
}
430
}
431
public void testBug027079d3() throws JavaModelException {
431
public void testBug027079d3() throws JavaModelException {
Lines 433-466 Link Here
433
	this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray();
433
	this.formatterPrefs.disabling_tag = "disable-formatter".toCharArray();
434
	this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray();
434
	this.formatterPrefs.enabling_tag = "enable-formatter".toCharArray();
435
	String source =
435
	String source =
436
		"public class X04c {\r\n" + 
436
		"public class X04c {\n" + 
437
		"\r\n" + 
437
		"\n" + 
438
		"/* disable-formatter */\r\n" + 
438
		"/* disable-formatter */\n" + 
439
		"void     foo(    )      {	\r\n" + 
439
		"void     foo(    )      {	\n" + 
440
		"				//      unformatted       comment  	  \r\n" + 
440
		"				//      unformatted       comment  	  \n" + 
441
		"}\r\n" + 
441
		"}\n" + 
442
		"/* enable-formatter */\r\n" + 
442
		"/* enable-formatter */\n" + 
443
		"void     bar(    )      {	\r\n" + 
443
		"void     bar(    )      {	\n" + 
444
		"				//      formatted       comment  	  \r\n" + 
444
		"				//      formatted       comment  	  \n" + 
445
		"}\r\n" + 
445
		"}\n" + 
446
		"}\r\n";
446
		"}\n";
447
	formatSource(source,
447
	formatSource(source,
448
		"public class X04c {\r\n" + 
448
		"public class X04c {\n" + 
449
		"\r\n" + 
449
		"\n" + 
450
		"/* disable-formatter */\r\n" + 
450
		"/* disable-formatter */\n" + 
451
		"void     foo(    )      {	\r\n" + 
451
		"void     foo(    )      {	\n" + 
452
		"				//      unformatted       comment  	  \r\n" + 
452
		"				//      unformatted       comment  	  \n" + 
453
		"}\r\n" + 
453
		"}\n" + 
454
		"/* enable-formatter */\r\n" + 
454
		"/* enable-formatter */\n" + 
455
		"	void bar() {\r\n" + 
455
		"	void bar() {\n" + 
456
		"		// formatted comment\r\n" + 
456
		"		// formatted comment\n" + 
457
		"	}\r\n" + 
457
		"	}\n" + 
458
		"}\r\n",
458
		"}\n",
459
		CodeFormatter.K_COMPILATION_UNIT | CodeFormatter.F_INCLUDE_COMMENTS,
459
		CodeFormatter.K_COMPILATION_UNIT | CodeFormatter.F_INCLUDE_COMMENTS,
460
		0 /* indentation level */,
460
		0 /* indentation level */,
461
		0 /* offset */,
461
		0 /* offset */,
462
		-1 /* length (all) */,
462
		-1 /* length (all) */,
463
		"\r\n",
463
		"\n",
464
		true/*repeat*/);
464
		true/*repeat*/);
465
}
465
}
466
public void testBug027079d4() throws JavaModelException {
466
public void testBug027079d4() throws JavaModelException {
Lines 6046-6051 Link Here
6046
}
6046
}
6047
6047
6048
/**
6048
/**
6049
 * @bug 311578: [formatter] Enable/disable tag detection should include comment start/end tokens
6050
 * @test Ensure that the formatter now accepts tags with comment start/end tokens
6051
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=311578"
6052
 */
6053
public void testBug311578a() throws JavaModelException {
6054
	this.formatterPrefs.use_tags = true;
6055
	this.formatterPrefs.disabling_tag = "//J-".toCharArray();
6056
	this.formatterPrefs.enabling_tag = "//J+".toCharArray();
6057
	String source =
6058
		"package a;\n" + 
6059
		"public class Bug {\n" + 
6060
		"int a      =  -     1  +    42;\n" + 
6061
		"\n" + 
6062
		"//J-\n" + 
6063
		"int b      =  -     1  +    42;\n" + 
6064
		"//J+\n" + 
6065
		"\n" + 
6066
		"char                       x;\n" + 
6067
		"\n" + 
6068
		"////J-\n" + 
6069
		"int c      =  -     1  +    42;\n" + 
6070
		"////J+\n" + 
6071
		"\n" + 
6072
		"char                       y;\n" + 
6073
		"\n" + 
6074
		"/* J- */\n" + 
6075
		"int d      =  -     1  +    42;\n" + 
6076
		"/* J+ */\n" + 
6077
		"\n" + 
6078
		"char                       z;\n" + 
6079
		"\n" + 
6080
		"/* //J- */\n" + 
6081
		"int e      =  -     1  +    42;\n" + 
6082
		"/* //J+ */\n" + 
6083
		"\n" + 
6084
		"/** J-1 blabla */\n" + 
6085
		"char                       t;\n" + 
6086
		"}\n";
6087
	formatSource(source,
6088
		"package a;\n" + 
6089
		"\n" + 
6090
		"public class Bug {\n" + 
6091
		"	int a = -1 + 42;\n" + 
6092
		"\n" + 
6093
		"//J-\n" + 
6094
		"int b      =  -     1  +    42;\n" + 
6095
		"//J+\n" + 
6096
		"\n" + 
6097
		"	char x;\n" + 
6098
		"\n" + 
6099
		"////J-\n" + 
6100
		"int c      =  -     1  +    42;\n" + 
6101
		"////J+\n" + 
6102
		"\n" + 
6103
		"	char y;\n" + 
6104
		"\n" + 
6105
		"	/* J- */\n" + 
6106
		"	int d = -1 + 42;\n" + 
6107
		"	/* J+ */\n" + 
6108
		"\n" + 
6109
		"	char z;\n" + 
6110
		"\n" + 
6111
		"/* //J- */\n" + 
6112
		"int e      =  -     1  +    42;\n" + 
6113
		"/* //J+ */\n" + 
6114
		"\n" + 
6115
		"	/** J-1 blabla */\n" + 
6116
		"	char t;\n" + 
6117
		"}\n"
6118
	);
6119
}
6120
public void testBug311578b() throws JavaModelException {
6121
	this.formatterPrefs.use_tags = true;
6122
	this.formatterPrefs.disabling_tag = "/* J- */".toCharArray();
6123
	this.formatterPrefs.enabling_tag = "/* J+ */".toCharArray();
6124
	String source =
6125
		"package a;\n" + 
6126
		"public class Bug {\n" + 
6127
		"int a      =  -     1  +    42;\n" + 
6128
		"\n" + 
6129
		"//J-\n" + 
6130
		"int b      =  -     1  +    42;\n" + 
6131
		"//J+\n" + 
6132
		"\n" + 
6133
		"char                       x;\n" + 
6134
		"\n" + 
6135
		"////J-\n" + 
6136
		"int c      =  -     1  +    42;\n" + 
6137
		"////J+\n" + 
6138
		"\n" + 
6139
		"char                       y;\n" + 
6140
		"\n" + 
6141
		"/* J- */\n" + 
6142
		"int d      =  -     1  +    42;\n" + 
6143
		"/* J+ */\n" + 
6144
		"\n" + 
6145
		"char                       z;\n" + 
6146
		"\n" + 
6147
		"/* //J- */\n" + 
6148
		"int e      =  -     1  +    42;\n" + 
6149
		"/* //J+ */\n" + 
6150
		"\n" + 
6151
		"/** J-1 blabla */\n" + 
6152
		"char                       t;\n" + 
6153
		"}\n";
6154
	formatSource(source,
6155
		"package a;\n" + 
6156
		"\n" + 
6157
		"public class Bug {\n" + 
6158
		"	int a = -1 + 42;\n" + 
6159
		"\n" + 
6160
		"	// J-\n" + 
6161
		"	int b = -1 + 42;\n" + 
6162
		"	// J+\n" + 
6163
		"\n" + 
6164
		"	char x;\n" + 
6165
		"\n" + 
6166
		"	// //J-\n" + 
6167
		"	int c = -1 + 42;\n" + 
6168
		"	// //J+\n" + 
6169
		"\n" + 
6170
		"	char y;\n" + 
6171
		"\n" + 
6172
		"/* J- */\n" + 
6173
		"int d      =  -     1  +    42;\n" + 
6174
		"/* J+ */\n" + 
6175
		"\n" + 
6176
		"	char z;\n" + 
6177
		"\n" + 
6178
		"	/* //J- */\n" + 
6179
		"	int e = -1 + 42;\n" + 
6180
		"	/* //J+ */\n" + 
6181
		"\n" + 
6182
		"	/** J-1 blabla */\n" + 
6183
		"	char t;\n" + 
6184
		"}\n"
6185
	);
6186
}
6187
public void testBug311578c() throws JavaModelException {
6188
	this.formatterPrefs = null;
6189
	this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_USE_ON_OFF_TAGS, DefaultCodeFormatterConstants.TRUE);
6190
	this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_DISABLING_TAG, "//F--");
6191
	this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_ENABLING_TAG, "//F++");
6192
	String source =
6193
		"package a;\n" + 
6194
		"public class Bug {\n" + 
6195
		"int a      =  -     1  +    42;\n" + 
6196
		"\n" + 
6197
		"//F--\n" + 
6198
		"int b      =  -     1  +    42;\n" + 
6199
		"//F++\n" + 
6200
		"\n" + 
6201
		"char                       x;\n" + 
6202
		"\n" + 
6203
		"////F--\n" + 
6204
		"int c      =  -     1  +    42;\n" + 
6205
		"////F++\n" + 
6206
		"\n" + 
6207
		"char                       y;\n" + 
6208
		"\n" + 
6209
		"/* F-- */\n" + 
6210
		"int d      =  -     1  +    42;\n" + 
6211
		"/* F++ */\n" + 
6212
		"\n" + 
6213
		"char                       z;\n" + 
6214
		"\n" + 
6215
		"/* //F-- */\n" + 
6216
		"int e      =  -     1  +    42;\n" + 
6217
		"/* //F++ */\n" + 
6218
		"\n" + 
6219
		"/** F--1 blabla */\n" + 
6220
		"char                       t;\n" + 
6221
		"}\n";
6222
	formatSource(source,
6223
		"package a;\n" + 
6224
		"\n" + 
6225
		"public class Bug {\n" + 
6226
		"	int a = -1 + 42;\n" + 
6227
		"\n" + 
6228
		"//F--\n" + 
6229
		"int b      =  -     1  +    42;\n" + 
6230
		"//F++\n" + 
6231
		"\n" + 
6232
		"	char x;\n" + 
6233
		"\n" + 
6234
		"////F--\n" + 
6235
		"int c      =  -     1  +    42;\n" + 
6236
		"////F++\n" + 
6237
		"\n" + 
6238
		"	char y;\n" + 
6239
		"\n" + 
6240
		"	/* F-- */\n" + 
6241
		"	int d = -1 + 42;\n" + 
6242
		"	/* F++ */\n" + 
6243
		"\n" + 
6244
		"	char z;\n" + 
6245
		"\n" + 
6246
		"/* //F-- */\n" + 
6247
		"int e      =  -     1  +    42;\n" + 
6248
		"/* //F++ */\n" + 
6249
		"\n" + 
6250
		"	/** F--1 blabla */\n" + 
6251
		"	char t;\n" + 
6252
		"}\n"
6253
	);
6254
}
6255
public void testBug311578d() throws JavaModelException {
6256
	this.formatterPrefs = null;
6257
	this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_USE_ON_OFF_TAGS, DefaultCodeFormatterConstants.TRUE);
6258
	this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_DISABLING_TAG, "/*F--*/");
6259
	this.formatterOptions.put(DefaultCodeFormatterConstants.FORMATTER_ENABLING_TAG, "/*F++*/");
6260
	String source =
6261
		"package a;\n" + 
6262
		"public class Bug {\n" + 
6263
		"int a      =  -     1  +    42;\n" + 
6264
		"\n" + 
6265
		"//F--\n" + 
6266
		"int b      =  -     1  +    42;\n" + 
6267
		"//F++\n" + 
6268
		"\n" + 
6269
		"char                       x;\n" + 
6270
		"\n" + 
6271
		"////F--\n" + 
6272
		"int c      =  -     1  +    42;\n" + 
6273
		"////F++\n" + 
6274
		"\n" + 
6275
		"char                       y;\n" + 
6276
		"\n" + 
6277
		"/* F-- */\n" + 
6278
		"int d      =  -     1  +    42;\n" + 
6279
		"/* F++ */\n" + 
6280
		"\n" + 
6281
		"char                       y2;\n" + 
6282
		"\n" + 
6283
		"/*F--*/\n" + 
6284
		"int d2      =  -     1  +    42;\n" + 
6285
		"/*F++*/\n" + 
6286
		"\n" + 
6287
		"char                       z;\n" + 
6288
		"\n" + 
6289
		"/* //F-- */\n" + 
6290
		"int e      =  -     1  +    42;\n" + 
6291
		"/* //F++ */\n" + 
6292
		"\n" + 
6293
		"/** F--1 blabla */\n" + 
6294
		"char                       t;\n" + 
6295
		"}\n";
6296
	formatSource(source,
6297
		"package a;\n" + 
6298
		"\n" + 
6299
		"public class Bug {\n" + 
6300
		"	int a = -1 + 42;\n" + 
6301
		"\n" + 
6302
		"	// F--\n" + 
6303
		"	int b = -1 + 42;\n" + 
6304
		"	// F++\n" + 
6305
		"\n" + 
6306
		"	char x;\n" + 
6307
		"\n" + 
6308
		"	// //F--\n" + 
6309
		"	int c = -1 + 42;\n" + 
6310
		"	// //F++\n" + 
6311
		"\n" + 
6312
		"	char y;\n" + 
6313
		"\n" + 
6314
		"	/* F-- */\n" + 
6315
		"	int d = -1 + 42;\n" + 
6316
		"	/* F++ */\n" + 
6317
		"\n" + 
6318
		"	char y2;\n" + 
6319
		"\n" + 
6320
		"/*F--*/\n" + 
6321
		"int d2      =  -     1  +    42;\n" + 
6322
		"/*F++*/\n" + 
6323
		"\n" + 
6324
		"	char z;\n" + 
6325
		"\n" + 
6326
		"	/* //F-- */\n" + 
6327
		"	int e = -1 + 42;\n" + 
6328
		"	/* //F++ */\n" + 
6329
		"\n" + 
6330
		"	/** F--1 blabla */\n" + 
6331
		"	char t;\n" + 
6332
		"}\n"
6333
	);
6334
}
6335
public void testBug311578e() throws JavaModelException {
6336
	this.formatterPrefs.use_tags = true;
6337
	this.formatterPrefs.disabling_tag = "//J-".toCharArray();
6338
	this.formatterPrefs.enabling_tag = "//J+".toCharArray();
6339
	String source =
6340
		"package a;\n" + 
6341
		"public class Bug {\n" + 
6342
		"char                       z2;\n" + 
6343
		"\n" + 
6344
		"//J-1\n" + 
6345
		"int f      =  -     1  +    42;\n" + 
6346
		"//J+2\n" + 
6347
		"\n" + 
6348
		"char                       z3;\n" + 
6349
		"\n" + 
6350
		"//J- 1\n" + 
6351
		"int g      =  -     1  +    42;\n" + 
6352
		"//J+ 2\n" + 
6353
		"\n" + 
6354
		"char                       z4;\n" + 
6355
		"\n" + 
6356
		"  //J-\n" + 
6357
		"int h      =  -     1  +    42;\n" + 
6358
		"  //J+\n" + 
6359
		"\n" + 
6360
		"char                       z5;\n" + 
6361
		"\n" + 
6362
		"/*\n" + 
6363
		"//J-\n" + 
6364
		"*/\n" + 
6365
		"int i      =  -     1  +    42;\n" + 
6366
		"/*\n" + 
6367
		" //J+\n" + 
6368
		" */\n" + 
6369
		"\n" + 
6370
		"char                       z6;" +
6371
		"}\n";
6372
	formatSource(source,
6373
		"package a;\n" + 
6374
		"\n" + 
6375
		"public class Bug {\n" + 
6376
		"	char z2;\n" + 
6377
		"\n" + 
6378
		"//J-1\n" + 
6379
		"int f      =  -     1  +    42;\n" + 
6380
		"//J+2\n" + 
6381
		"\n" + 
6382
		"	char z3;\n" + 
6383
		"\n" + 
6384
		"//J- 1\n" + 
6385
		"int g      =  -     1  +    42;\n" + 
6386
		"//J+ 2\n" + 
6387
		"\n" + 
6388
		"	char z4;\n" + 
6389
		"\n" + 
6390
		"	//J-\n" + 
6391
		"int h      =  -     1  +    42;\n" + 
6392
		"  //J+\n" + 
6393
		"\n" + 
6394
		"	char z5;\n" + 
6395
		"\n" + 
6396
		"/*\n" + 
6397
		"//J-\n" + 
6398
		"*/\n" + 
6399
		"int i      =  -     1  +    42;\n" + 
6400
		"/*\n" + 
6401
		" //J+\n" + 
6402
		" */\n" + 
6403
		"\n" + 
6404
		"	char z6;\n" + 
6405
		"}\n"
6406
	);
6407
}
6408
public void testBug311578_320754a() throws JavaModelException {
6409
	this.formatterPrefs.use_tags = true;
6410
	this.formatterPrefs.disabling_tag = "//J-".toCharArray();
6411
	this.formatterPrefs.enabling_tag = "//J+".toCharArray();
6412
	String source =
6413
		"//J-\n" + 
6414
		"@MyAnnot (\n" + 
6415
		"  testAttribute = {\"test1\", \"test2\", \"test3\"}\n" + 
6416
		")\n" + 
6417
		"//J+\n" + 
6418
		"public class X\n" + 
6419
		"{\n" + 
6420
		"    public void foo()\n" + 
6421
		"    {\n" + 
6422
		"    }\n" + 
6423
		"}\n";
6424
	formatSource(source,
6425
		"//J-\n" + 
6426
		"@MyAnnot (\n" + 
6427
		"  testAttribute = {\"test1\", \"test2\", \"test3\"}\n" + 
6428
		")\n" + 
6429
		"//J+\n" + 
6430
		"public class X {\n" + 
6431
		"	public void foo() {\n" + 
6432
		"	}\n" + 
6433
		"}\n"
6434
	);
6435
}
6436
public void testBug311578_320754b() throws JavaModelException {
6437
	this.formatterPrefs.use_tags = true;
6438
	this.formatterPrefs.disabling_tag = "/*J-*/".toCharArray();
6439
	this.formatterPrefs.enabling_tag = "/*J+*/".toCharArray();
6440
	String source =
6441
		"/*J-*/\n" + 
6442
		"@MyAnnot (\n" + 
6443
		"  testAttribute = {\"test1\", \"test2\", \"test3\"}\n" + 
6444
		")\n" + 
6445
		"/*J+*/\n" + 
6446
		"public class X\n" + 
6447
		"{\n" + 
6448
		"    public void foo()\n" + 
6449
		"    {\n" + 
6450
		"    }\n" + 
6451
		"}\n";
6452
	formatSource(source,
6453
		"/*J-*/\n" + 
6454
		"@MyAnnot (\n" + 
6455
		"  testAttribute = {\"test1\", \"test2\", \"test3\"}\n" + 
6456
		")\n" + 
6457
		"/*J+*/\n" + 
6458
		"public class X {\n" + 
6459
		"	public void foo() {\n" + 
6460
		"	}\n" + 
6461
		"}\n"
6462
	);
6463
}
6464
6465
/**
6049
 * @bug 311582: [formatter] Master switch to enable/disable on/off tags
6466
 * @bug 311582: [formatter] Master switch to enable/disable on/off tags
6050
 * @test Ensure that the formatter does not take care of formatting tags by default
6467
 * @test Ensure that the formatter does not take care of formatting tags by default
6051
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=311582"
6468
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=311582"
Lines 6693-6701 Link Here
6693
}
7110
}
6694
7111
6695
/**
7112
/**
6696
 * @bug 320754: [formatter] Add preference for improved lines wrapping in nested method calls
7113
 * @bug 320754: [formatter] formatter:off/on tags does not work correctly
6697
 * @test Ensure that the formatter keep previous eclipse versions behavior when
7114
 * @test Ensure disabling/enabling tags work properly around annotations
6698
 * 		the "Try to keep nested expressions on one line" preference is set.
6699
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=320754"
7115
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=320754"
6700
 */
7116
 */
6701
public void testBug320754_00() throws JavaModelException {
7117
public void testBug320754_00() throws JavaModelException {

Return to bug 311578