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

Collapse All | Expand All

(-)buildnotes_jdt-core.html (+1 lines)
Lines 48-53 Link Here
48
<br>Project org.eclipse.jdt.core v_A35
48
<br>Project org.eclipse.jdt.core v_A35
49
(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A35">cvs</a>).
49
(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_A35">cvs</a>).
50
<h2>What's new in this drop</h2>
50
<h2>What's new in this drop</h2>
51
Patch v04 for bug 260381
51
52
52
<h3>Problem Reports Fixed</h3>
53
<h3>Problem Reports Fixed</h3>
53
<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302446">302446</a>
54
<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=302446">302446</a>
(-)formatter/org/eclipse/jdt/internal/formatter/FormatJavadocBlock.java (-2 / +25 lines)
Lines 31-36 Link Here
31
	final static int PARAM_TAG = 0x0020;
31
	final static int PARAM_TAG = 0x0020;
32
	final static int IN_PARAM_TAG = 0x0040;
32
	final static int IN_PARAM_TAG = 0x0040;
33
	final static int IN_DESCRIPTION = 0x0080;
33
	final static int IN_DESCRIPTION = 0x0080;
34
	final static int IMMUTABLE = 0x0100;
34
35
35
	// constants
36
	// constants
36
	final static int MAX_TAG_HIERARCHY = 10;
37
	final static int MAX_TAG_HIERARCHY = 10;
Lines 53-58 Link Here
53
		case TAG_THROWS_VALUE:
54
		case TAG_THROWS_VALUE:
54
		case TAG_EXCEPTION_VALUE:
55
		case TAG_EXCEPTION_VALUE:
55
			this.flags |= PARAM_TAG;
56
			this.flags |= PARAM_TAG;
57
			break;
58
		case TAG_CODE_VALUE:
59
		case TAG_LITERAL_VALUE:
60
			this.flags |= IMMUTABLE;
61
			break;
56
	}
62
	}
57
}
63
}
58
64
Lines 141-146 Link Here
141
		}
147
		}
142
	}
148
	}
143
	addNode(text);
149
	addNode(text);
150
	if (isImmutable()) {
151
		text.immutable = true;
152
	}
144
}
153
}
145
154
146
void clean() {
155
void clean() {
Lines 322-327 Link Here
322
	return (this.flags & PARAM_TAG) == PARAM_TAG;
331
	return (this.flags & PARAM_TAG) == PARAM_TAG;
323
}
332
}
324
333
334
/**
335
 * Returns whether the block is immutable or not.
336
 * <p>
337
 * Currently, only @code inline tag block are considered as immutable.
338
 *
339
 * @return <code>true</code> if the block is immutable,
340
 * 	<code>false</code> otherwise.
341
 */
342
public boolean isImmutable() {
343
	return (this.flags & IMMUTABLE) == IMMUTABLE;
344
}
345
325
void setHeaderLine(int javadocLineStart) {
346
void setHeaderLine(int javadocLineStart) {
326
	if (javadocLineStart == this.lineStart) {
347
	if (javadocLineStart == this.lineStart) {
327
		this.flags |= ON_HEADER_LINE;
348
		this.flags |= ON_HEADER_LINE;
Lines 332-340 Link Here
332
}
353
}
333
354
334
protected void toString(StringBuffer buffer) {
355
protected void toString(StringBuffer buffer) {
335
	if ((this.flags & INLINED) != 0) buffer.append('{');
356
	boolean inlined = (this.flags & INLINED) != 0;
357
	if (inlined) buffer.append("	{"); //$NON-NLS-1$
336
	buffer.append('@');
358
	buffer.append('@');
337
	buffer.append(this.tagValue);
359
	buffer.append(TAG_NAMES[this.tagValue]);
338
	super.toString(buffer);
360
	super.toString(buffer);
339
	if (this.reference == null) {
361
	if (this.reference == null) {
340
		buffer.append('\n');
362
		buffer.append('\n');
Lines 345-350 Link Here
345
	}
367
	}
346
	if (this.nodesPtr > -1) {
368
	if (this.nodesPtr > -1) {
347
		for (int i = 0; i <= this.nodesPtr; i++) {
369
		for (int i = 0; i <= this.nodesPtr; i++) {
370
			if (inlined) buffer.append('\t');
348
			this.nodes[i].toString(buffer);
371
			this.nodes[i].toString(buffer);
349
		}
372
		}
350
	}
373
	}
(-)formatter/org/eclipse/jdt/internal/formatter/FormatJavadocNode.java (+11 lines)
Lines 56-61 Link Here
56
	return false;
56
	return false;
57
}
57
}
58
58
59
/**
60
 * Returns whether the node is immutable or not. If <code>true</code>, then
61
 * the formatter will leave it contents unchanged.
62
 *
63
 * @return <code>true</code> if the node is immutable, <code>false</code>
64
 * 	otherwise.
65
 */
66
public boolean isImmutable() {
67
	return false;
68
}
69
59
public String toString() {
70
public String toString() {
60
	StringBuffer buffer = new StringBuffer();
71
	StringBuffer buffer = new StringBuffer();
61
	toString(buffer);
72
	toString(buffer);
(-)formatter/org/eclipse/jdt/internal/formatter/FormatJavadocText.java (+18 lines)
Lines 31-36 Link Here
31
	long[] separators;
31
	long[] separators;
32
	int separatorsPtr = -1;
32
	int separatorsPtr = -1;
33
	private int htmlTagIndex = -1;
33
	private int htmlTagIndex = -1;
34
	boolean immutable = false;
34
	FormatJavadocNode[] htmlNodes;
35
	FormatJavadocNode[] htmlNodes;
35
	int[] htmlIndexes;
36
	int[] htmlIndexes;
36
	int htmlNodesPtr = -1;
37
	int htmlNodesPtr = -1;
Lines 49-54 Link Here
49
 * child node.
50
 * child node.
50
 */
51
 */
51
void appendText(FormatJavadocText text) {
52
void appendText(FormatJavadocText text) {
53
	this.immutable = text.immutable;
52
	if (this.depth == text.depth) {
54
	if (this.depth == text.depth) {
53
		addSeparator(text);
55
		addSeparator(text);
54
		this.sourceEnd = text.sourceEnd;
56
		this.sourceEnd = text.sourceEnd;
Lines 167-172 Link Here
167
 *
169
 *
168
 * @return <code>true</code> if the node is an immutable tag,
170
 * @return <code>true</code> if the node is an immutable tag,
169
 *		<code>false</code> otherwise.
171
 *		<code>false</code> otherwise.
172
 *@deprecated Use {@link #isImmutable()} instead
170
 */
173
 */
171
public boolean isImmutableHtmlTag() {
174
public boolean isImmutableHtmlTag() {
172
	return this.htmlTagIndex != -1 && (this.htmlTagIndex & JAVADOC_TAGS_ID_MASK) == JAVADOC_IMMUTABLE_TAGS_ID;
175
	return this.htmlTagIndex != -1 && (this.htmlTagIndex & JAVADOC_TAGS_ID_MASK) == JAVADOC_IMMUTABLE_TAGS_ID;
Lines 174-179 Link Here
174
}
177
}
175
178
176
/**
179
/**
180
 * Returns whether the text is immutable or not.
181
 * <p>
182
 * A text in considered as immutable when it  belongs to an immutable block
183
 * or when it's an immutable html tag.
184
 * </p>
185
 *
186
 * @return <code>true</code> if the node is an immutable tag,
187
 *		<code>false</code> otherwise.
188
 */
189
public boolean isImmutable() {
190
	return this.immutable || (this.htmlTagIndex != -1 && (this.htmlTagIndex & JAVADOC_TAGS_ID_MASK) == JAVADOC_IMMUTABLE_TAGS_ID);
191
192
}
193
194
/**
177
 * Returns whether the text at the given separator index position is after a
195
 * Returns whether the text at the given separator index position is after a
178
 * separator tag or not.
196
 * separator tag or not.
179
 *
197
 *
(-)formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java (-2 / +5 lines)
Lines 356-361 Link Here
356
		this.scanner.resetTo(this.index, this.javadocEnd);
356
		this.scanner.resetTo(this.index, this.javadocEnd);
357
		return true;
357
		return true;
358
	}
358
	}
359
	this.tagValue = TAG_OTHERS_VALUE; // tag is invalid, do not keep the parsed tag value
359
	return false;
360
	return false;
360
}
361
}
361
362
Lines 382-387 Link Here
382
			}
383
			}
383
			this.scanner.resetTo(this.tagSourceEnd+1, this.javadocEnd);
384
			this.scanner.resetTo(this.tagSourceEnd+1, this.javadocEnd);
384
		}
385
		}
386
		this.tagValue = TAG_OTHERS_VALUE; // tag is invalid, do not keep the parsed tag value
385
	}
387
	}
386
	return valid;
388
	return valid;
387
}
389
}
Lines 394-399 Link Here
394
	if (!valid) {
396
	if (!valid) {
395
		this.scanner.resetTo(this.tagSourceEnd+1, this.javadocEnd);
397
		this.scanner.resetTo(this.tagSourceEnd+1, this.javadocEnd);
396
		this.index = this.tagSourceEnd+1;
398
		this.index = this.tagSourceEnd+1;
399
		this.tagValue = TAG_OTHERS_VALUE; // tag is invalid, do not keep the parsed tag value
397
	}
400
	}
398
	return valid;
401
	return valid;
399
}
402
}
Lines 506-512 Link Here
506
			if (length == TAG_LINK_LENGTH && CharOperation.equals(TAG_LINK, tagName)) {
509
			if (length == TAG_LINK_LENGTH && CharOperation.equals(TAG_LINK, tagName)) {
507
				this.tagValue = TAG_LINK_VALUE;
510
				this.tagValue = TAG_LINK_VALUE;
508
				if (this.inlineTagStarted || (this.kind & COMPLETION_PARSER) != 0) {
511
				if (this.inlineTagStarted || (this.kind & COMPLETION_PARSER) != 0) {
509
					valid= parseReference();
512
					valid = parseReference();
510
				} else {
513
				} else {
511
					// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=53290
514
					// bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=53290
512
					// Cannot have @link outside inline comment
515
					// Cannot have @link outside inline comment
Lines 605-611 Link Here
605
	} else if (this.invalidTagName) {
608
	} else if (this.invalidTagName) {
606
		this.textStart = previousPosition;
609
		this.textStart = previousPosition;
607
	} else if (this.astPtr == ptr) {
610
	} else if (this.astPtr == ptr) {
608
		this.tagValue = TAG_OTHERS_VALUE; // tag is invalid, do not keep the parsed tag value
609
		createTag();
611
		createTag();
610
	}
612
	}
611
	return true;
613
	return true;
Lines 620-625 Link Here
620
		// If invalid, restart from the end tag position
622
		// If invalid, restart from the end tag position
621
		this.scanner.resetTo(this.tagSourceEnd+1, this.javadocEnd);
623
		this.scanner.resetTo(this.tagSourceEnd+1, this.javadocEnd);
622
		this.index = this.tagSourceEnd+1;
624
		this.index = this.tagSourceEnd+1;
625
		this.tagValue = TAG_OTHERS_VALUE; // tag is invalid, do not keep the parsed tag value
623
	}
626
	}
624
	return valid;
627
	return valid;
625
}
628
}
(-)formatter/org/eclipse/jdt/internal/formatter/Scribe.java (-38 / +47 lines)
Lines 2866-2872 Link Here
2866
							if (newLines > 0)  newLines = 1;
2866
							if (newLines > 0)  newLines = 1;
2867
						}
2867
						}
2868
					}
2868
					}
2869
					if (newLines == 0) {
2869
					if (newLines == 0 && (!node.isImmutable() || block.reference != null)) {
2870
						newLines = printJavadocBlockNodesNewLines(block, node, previousEnd);
2870
						newLines = printJavadocBlockNodesNewLines(block, node, previousEnd);
2871
					}
2871
					}
2872
					printJavadocGapLines(previousEnd+1, nodeStart-1, newLines, clearBlankLines, false, null);
2872
					printJavadocGapLines(previousEnd+1, nodeStart-1, newLines, clearBlankLines, false, null);
Lines 2898-2915 Link Here
2898
			// Print node
2898
			// Print node
2899
			if (node.isText()) {
2899
			if (node.isText()) {
2900
				FormatJavadocText text = (FormatJavadocText) node;
2900
				FormatJavadocText text = (FormatJavadocText) node;
2901
				if (text.isHtmlTag()) {
2901
				if (text.isImmutable()) {
2902
					if (text.isImmutableHtmlTag()) {
2902
					// Indent if new line was added
2903
						// Indent if new line was added
2903
					if (newLines > 0 && this.commentIndentation != null) {
2904
						if (newLines > 0 && this.commentIndentation != null) {
2904
				    	addInsertEdit(node.sourceStart, this.commentIndentation);
2905
					    	addInsertEdit(node.sourceStart, this.commentIndentation);
2905
				    	this.column += this.commentIndentation.length();
2906
					    	this.column += this.commentIndentation.length();
2907
						}
2908
						printJavadocHtmlImmutableTag(text, block, newLines > 0);
2909
						this.column += getTextLength(block, text);
2910
					} else {
2911
						printJavadocHtmlTag(text, block, newLines>0);
2912
					}
2906
					}
2907
					printJavadocImmutableText(text, block, newLines > 0);
2908
					this.column += getTextLength(block, text);
2909
				} else if (text.isHtmlTag()) {
2910
					printJavadocHtmlTag(text, block, newLines>0);
2913
				} else {
2911
				} else {
2914
					printJavadocText(text, block, newLines>0);
2912
					printJavadocText(text, block, newLines>0);
2915
				}
2913
				}
Lines 2934-2948 Link Here
2934
 	    try {
2932
 	    try {
2935
			this.scanner.resetTo(nodeStart , node.sourceEnd);
2933
			this.scanner.resetTo(nodeStart , node.sourceEnd);
2936
	    	int length = 0;
2934
	    	int length = 0;
2937
	    	int newLines = 0;
2938
	    	boolean newLine = false;
2935
	    	boolean newLine = false;
2939
			boolean headerLine = block.isHeaderLine() && this.lastNumberOfNewLines == 0;
2936
			boolean headerLine = block.isHeaderLine() && this.lastNumberOfNewLines == 0;
2940
			int firstColumn = 1 + this.indentationLevel + BLOCK_LINE_PREFIX_LENGTH;
2937
			int firstColumn = 1 + this.indentationLevel + BLOCK_LINE_PREFIX_LENGTH;
2941
			if (this.commentIndentation != null) firstColumn += this.commentIndentation.length();
2938
			if (this.commentIndentation != null) firstColumn += this.commentIndentation.length();
2942
			if (headerLine) maxColumn++;
2939
			if (headerLine) maxColumn++;
2943
	    	if (node.isText()) {
2940
			FormatJavadocText text = null;
2944
	    		FormatJavadocText text = (FormatJavadocText)node;
2941
			boolean isImmutableNode = node.isImmutable();
2945
    			if (text.isImmutableHtmlTag()) {
2942
			boolean nodeIsText = node.isText();
2943
			if (nodeIsText) {
2944
	    		text = (FormatJavadocText)node;
2945
			} else {
2946
				FormatJavadocBlock inlinedBlock = (FormatJavadocBlock)node;
2947
				if (isImmutableNode) {
2948
					text = (FormatJavadocText) inlinedBlock.getLastNode();
2949
		    		length += inlinedBlock.tagEnd - inlinedBlock.sourceStart + 1;  // tag length
2950
			    	if (nodeStart > (previousEnd+1)) {
2951
			    		length++; // include space between nodes
2952
			    	}
2953
					this.scanner.resetTo(text.sourceStart , node.sourceEnd);
2954
				}
2955
			}
2956
	    	if (text != null) {
2957
    			if (isImmutableNode) {
2946
			    	if (nodeStart > (previousEnd+1)) {
2958
			    	if (nodeStart > (previousEnd+1)) {
2947
			    		length++; // include space between nodes
2959
			    		length++; // include space between nodes
2948
			    	}
2960
			    	}
Lines 2952-2959 Link Here
2952
		    				int token = this.scanner.getNextToken();
2964
		    				int token = this.scanner.getNextToken();
2953
		    				switch (token) {
2965
		    				switch (token) {
2954
		    					case TerminalTokens.TokenNameWHITESPACE:
2966
		    					case TerminalTokens.TokenNameWHITESPACE:
2955
		    						if (CharOperation.indexOf('\n', this.scanner.source, this.scanner.startPosition, this.scanner.currentPosition) >= 0) {
2967
		    						if (nodeIsText) {
2956
		    							return newLines;
2968
			    						if (CharOperation.indexOf('\n', this.scanner.source, this.scanner.startPosition, this.scanner.currentPosition) >= 0) {
2969
			    							return 0;
2970
			    						}
2957
		    						}
2971
		    						}
2958
		    						length = 1;
2972
		    						length = 1;
2959
		    						break;
2973
		    						break;
Lines 2975-2989 Link Here
2975
	    				}
2989
	    				}
2976
	    				lastColumn += length;
2990
	    				lastColumn += length;
2977
	    				if (lastColumn > maxColumn) {
2991
	    				if (lastColumn > maxColumn) {
2978
							newLines++;
2992
	    					return 1;
2979
				    		if (headerLine) {
2980
								maxColumn--;
2981
								headerLine = false;
2982
			    			}
2983
							lastColumn = firstColumn;
2984
						}
2993
						}
2985
	    			}
2994
	    			}
2986
	    			return newLines;
2995
	    			return 0;
2987
    			}
2996
    			}
2988
    			if (text.isHtmlTag()) {
2997
    			if (text.isHtmlTag()) {
2989
    				if (text.getHtmlTagID() == JAVADOC_SINGLE_BREAK_TAG_ID) {
2998
    				if (text.getHtmlTagID() == JAVADOC_SINGLE_BREAK_TAG_ID) {
Lines 3146-3152 Link Here
3146
	private int getTextLength(FormatJavadocBlock block, FormatJavadocText text) {
3155
	private int getTextLength(FormatJavadocBlock block, FormatJavadocText text) {
3147
3156
3148
		// Special case for immutable tags
3157
		// Special case for immutable tags
3149
		if (text.isImmutableHtmlTag()) {
3158
		if (text.isImmutable()) {
3150
			this.scanner.resetTo(text.sourceStart , text.sourceEnd);
3159
			this.scanner.resetTo(text.sourceStart , text.sourceEnd);
3151
			int textLength = 0;
3160
			int textLength = 0;
3152
			while (!this.scanner.atEnd()) {
3161
			while (!this.scanner.atEnd()) {
Lines 3468-3490 Link Here
3468
		}
3477
		}
3469
	}
3478
	}
3470
3479
3471
	private void printJavadocHtmlImmutableTag(FormatJavadocText text, FormatJavadocBlock block, boolean textOnNewLine) {
3480
	private void printJavadocImmutableText(FormatJavadocText text, FormatJavadocBlock block, boolean textOnNewLine) {
3472
3481
3473
		try {
3482
		try {
3474
			// Iterate on text line separators
3483
			// Iterate on text line separators
3475
			int lineNumber = text.lineStart;
3484
			int lineNumber = text.lineStart;
3476
			this.scanner.tokenizeWhiteSpace = false;
3485
			this.scanner.tokenizeWhiteSpace = false;
3477
			StringBuffer buffer = null;
3486
			StringBuffer buffer = null;
3478
			for (int idx=1, max=text.separatorsPtr; idx<max ; idx++) {
3487
			for (int idx=0, max=text.separatorsPtr; idx<=max ; idx++) {
3479
				int start = (int) text.separators[idx];
3488
				int start = (int) text.separators[idx];
3480
				int lineStart = Util.getLineNumber(start, this.lineEnds, lineNumber, this.maxLines);
3489
				int lineStart = Util.getLineNumber(start, this.lineEnds, lineNumber-1, this.maxLines);
3481
				if (buffer == null) {
3482
					buffer = new StringBuffer();
3483
					this.column = 1;
3484
					printIndentationIfNecessary(buffer);
3485
					buffer.append(BLOCK_LINE_PREFIX);
3486
					this.column += BLOCK_LINE_PREFIX_LENGTH;
3487
				}
3488
				while (lineNumber < lineStart) {
3490
				while (lineNumber < lineStart) {
3489
					int end = this.lineEnds[lineNumber-1];
3491
					int end = this.lineEnds[lineNumber-1];
3490
					this.scanner.resetTo(end, start);
3492
					this.scanner.resetTo(end, start);
Lines 3499-3504 Link Here
3499
					if (this.scanner.currentCharacter == ' ') {
3501
					if (this.scanner.currentCharacter == ' ') {
3500
						this.scanner.getNextChar();
3502
						this.scanner.getNextChar();
3501
					}
3503
					}
3504
					if (buffer == null) {
3505
						buffer = new StringBuffer();
3506
						this.column = 1;
3507
						printIndentationIfNecessary(buffer);
3508
						buffer.append(BLOCK_LINE_PREFIX);
3509
						this.column += BLOCK_LINE_PREFIX_LENGTH;
3510
					}
3502
					addReplaceEdit(end+1, this.scanner.getCurrentTokenEndPosition(), buffer.toString());
3511
					addReplaceEdit(end+1, this.scanner.getCurrentTokenEndPosition(), buffer.toString());
3503
					lineNumber++;
3512
					lineNumber++;
3504
				}
3513
				}
Lines 3562-3568 Link Here
3562
				if (textStart < previousEnd) {
3571
				if (textStart < previousEnd) {
3563
					addReplaceEdit(textStart, previousEnd, buffer.toString());
3572
					addReplaceEdit(textStart, previousEnd, buffer.toString());
3564
				}
3573
				}
3565
				boolean immutable = htmlTag == null ? false : htmlTag.isImmutableHtmlTag();
3574
				boolean immutable = node.isImmutable();
3566
				if (newLines == 0) {
3575
				if (newLines == 0) {
3567
					newLines = printJavadocBlockNodesNewLines(block, node, previousEnd);
3576
					newLines = printJavadocBlockNodesNewLines(block, node, previousEnd);
3568
				}
3577
				}
Lines 3579-3585 Link Here
3579
					    	addInsertEdit(node.sourceStart, this.commentIndentation);
3588
					    	addInsertEdit(node.sourceStart, this.commentIndentation);
3580
					    	this.column += this.commentIndentation.length();
3589
					    	this.column += this.commentIndentation.length();
3581
						}
3590
						}
3582
						printJavadocHtmlImmutableTag(htmlTag, block, textOnNewLine);
3591
						printJavadocImmutableText(htmlTag, block, textOnNewLine);
3583
						this.column += getTextLength(block, htmlTag);
3592
						this.column += getTextLength(block, htmlTag);
3584
						linesAfter = 0;
3593
						linesAfter = 0;
3585
					} else {
3594
					} else {
(-)src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsBugsTest.java (-2552 / +3240 lines)
Lines 46-114 Link Here
46
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=196308"
46
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=196308"
47
 */
47
 */
48
public void testBug196308() throws JavaModelException {
48
public void testBug196308() throws JavaModelException {
49
	String source = 
49
	String source =
50
		"public class X {\n" + 
50
		"public class X {\n" +
51
		"\n" + 
51
		"\n" +
52
		"	/**\n" + 
52
		"	/**\n" +
53
		"	 * <pre>\n" + 
53
		"	 * <pre>\n" +
54
		"	 * &at;MyAnnotation\n" + 
54
		"	 * &at;MyAnnotation\n" +
55
		"	 * </pre>\n" + 
55
		"	 * </pre>\n" +
56
		"	 */\n" + 
56
		"	 */\n" +
57
		"}\n";
57
		"}\n";
58
	formatSource(source,
58
	formatSource(source,
59
		"public class X {\n" + 
59
		"public class X {\n" +
60
		"\n" + 
60
		"\n" +
61
		"	/**\n" + 
61
		"	/**\n" +
62
		"	 * <pre>\n" + 
62
		"	 * <pre>\n" +
63
		"	 * &at;MyAnnotation\n" + 
63
		"	 * &at;MyAnnotation\n" +
64
		"	 * </pre>\n" + 
64
		"	 * </pre>\n" +
65
		"	 */\n" + 
65
		"	 */\n" +
66
		"}\n"
66
		"}\n"
67
	);
67
	);
68
}
68
}
69
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=204257
69
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=204257
70
public void testBug196308b() throws JavaModelException {
70
public void testBug196308b() throws JavaModelException {
71
	String source = 
71
	String source =
72
		"public class A\n" + 
72
		"public class A\n" +
73
		"{\n" + 
73
		"{\n" +
74
		"  /**\n" + 
74
		"  /**\n" +
75
		"   * <pre>\n" + 
75
		"   * <pre>\n" +
76
		"   *   &#92;u\n" + 
76
		"   *   &#92;u\n" +
77
		"   * </pre>\n" + 
77
		"   * </pre>\n" +
78
		"   */\n" + 
78
		"   */\n" +
79
		"  public void a()\n" + 
79
		"  public void a()\n" +
80
		"  {\n" + 
80
		"  {\n" +
81
		"  }\n" + 
81
		"  }\n" +
82
		"}\n";
82
		"}\n";
83
	formatSource(source,
83
	formatSource(source,
84
		"public class A {\n" + 
84
		"public class A {\n" +
85
		"	/**\n" + 
85
		"	/**\n" +
86
		"	 * <pre>\n" + 
86
		"	 * <pre>\n" +
87
		"	 *   &#92;u\n" + 
87
		"	 *   &#92;u\n" +
88
		"	 * </pre>\n" + 
88
		"	 * </pre>\n" +
89
		"	 */\n" + 
89
		"	 */\n" +
90
		"	public void a() {\n" + 
90
		"	public void a() {\n" +
91
		"	}\n" + 
91
		"	}\n" +
92
		"}\n"
92
		"}\n"
93
	);
93
	);
94
}
94
}
95
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=238547
95
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=238547
96
public void testBug196308c() throws JavaModelException {
96
public void testBug196308c() throws JavaModelException {
97
	String source = 
97
	String source =
98
		"/**\n" + 
98
		"/**\n" +
99
		" * &#x01;&#x20;&#x21;&#x40;&#x41;&#233;\n" + 
99
		" * &#x01;&#x20;&#x21;&#x40;&#x41;&#233;\n" +
100
		" * <pre>&#x01;&#x20;&#x21;&#x40;&#x41;&#233;</pre>\n" + 
100
		" * <pre>&#x01;&#x20;&#x21;&#x40;&#x41;&#233;</pre>\n" +
101
		" */\n" + 
101
		" */\n" +
102
		"public class TestClass {}\n";
102
		"public class TestClass {}\n";
103
	formatSource(source,
103
	formatSource(source,
104
		"/**\n" + 
104
		"/**\n" +
105
		" * &#x01;&#x20;&#x21;&#x40;&#x41;&#233;\n" + 
105
		" * &#x01;&#x20;&#x21;&#x40;&#x41;&#233;\n" +
106
		" * \n" + 
106
		" * \n" +
107
		" * <pre>\n" + 
107
		" * <pre>\n" +
108
		" * &#x01;&#x20;&#x21;&#x40;&#x41;&#233;\n" + 
108
		" * &#x01;&#x20;&#x21;&#x40;&#x41;&#233;\n" +
109
		" * </pre>\n" + 
109
		" * </pre>\n" +
110
		" */\n" + 
110
		" */\n" +
111
		"public class TestClass {\n" + 
111
		"public class TestClass {\n" +
112
		"}\n"
112
		"}\n"
113
	);
113
	);
114
}
114
}
Lines 122-139 Link Here
122
	this.formatterPrefs.comment_format_block_comment = false;
122
	this.formatterPrefs.comment_format_block_comment = false;
123
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB;
123
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB;
124
	String source =
124
	String source =
125
		"public class Test {\n" + 
125
		"public class Test {\n" +
126
		"\n" + 
126
		"\n" +
127
		"    int x = 0; /*\n" + 
127
		"    int x = 0; /*\n" +
128
		"    * XXXX\n" + 
128
		"    * XXXX\n" +
129
		"    */\n" + 
129
		"    */\n" +
130
		"}";
130
		"}";
131
	formatSource(source,
131
	formatSource(source,
132
		"public class Test {\n" + 
132
		"public class Test {\n" +
133
		"\n" + 
133
		"\n" +
134
		"	int x = 0; /*\n" + 
134
		"	int x = 0; /*\n" +
135
		"				* XXXX\n" + 
135
		"				* XXXX\n" +
136
		"				*/\n" + 
136
		"				*/\n" +
137
		"}"
137
		"}"
138
	);
138
	);
139
}
139
}
Lines 141-158 Link Here
141
	this.formatterPrefs.comment_format_block_comment = false;
141
	this.formatterPrefs.comment_format_block_comment = false;
142
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB;
142
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB;
143
	String source =
143
	String source =
144
		"public class Test {\n" + 
144
		"public class Test {\n" +
145
		"\n" + 
145
		"\n" +
146
		"    int x = 10; /*\n" + 
146
		"    int x = 10; /*\n" +
147
		"    * XXXX\n" + 
147
		"    * XXXX\n" +
148
		"    */\n" + 
148
		"    */\n" +
149
		"}";
149
		"}";
150
	formatSource(source,
150
	formatSource(source,
151
		"public class Test {\n" + 
151
		"public class Test {\n" +
152
		"\n" + 
152
		"\n" +
153
		"	int x = 10; /*\n" + 
153
		"	int x = 10; /*\n" +
154
		"				* XXXX\n" + 
154
		"				* XXXX\n" +
155
		"				*/\n" + 
155
		"				*/\n" +
156
		"}"
156
		"}"
157
	);
157
	);
158
}
158
}
Lines 160-177 Link Here
160
	this.formatterPrefs.comment_format_block_comment = false;
160
	this.formatterPrefs.comment_format_block_comment = false;
161
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB;
161
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB;
162
	String source =
162
	String source =
163
		"public class Test {\n" + 
163
		"public class Test {\n" +
164
		"\n" + 
164
		"\n" +
165
		"    int x = 100; /*\n" + 
165
		"    int x = 100; /*\n" +
166
		"    * XXXX\n" + 
166
		"    * XXXX\n" +
167
		"    */\n" + 
167
		"    */\n" +
168
		"}";
168
		"}";
169
	formatSource(source,
169
	formatSource(source,
170
		"public class Test {\n" + 
170
		"public class Test {\n" +
171
		"\n" + 
171
		"\n" +
172
		"	int x = 100; /*\n" + 
172
		"	int x = 100; /*\n" +
173
		"					* XXXX\n" + 
173
		"					* XXXX\n" +
174
		"					*/\n" + 
174
		"					*/\n" +
175
		"}"
175
		"}"
176
	);
176
	);
177
}
177
}
Lines 179-196 Link Here
179
	this.formatterPrefs.comment_format_block_comment = false;
179
	this.formatterPrefs.comment_format_block_comment = false;
180
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB;
180
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB;
181
	String source =
181
	String source =
182
		"public class Test {\n" + 
182
		"public class Test {\n" +
183
		"\n" + 
183
		"\n" +
184
		"    int x = 0; /*\n" + 
184
		"    int x = 0; /*\n" +
185
		"                      * XXXX\n" + 
185
		"                      * XXXX\n" +
186
		"                        */\n" + 
186
		"                        */\n" +
187
		"}";
187
		"}";
188
	formatSource(source,
188
	formatSource(source,
189
		"public class Test {\n" + 
189
		"public class Test {\n" +
190
		"\n" + 
190
		"\n" +
191
		"	int x = 0; /*\n" + 
191
		"	int x = 0; /*\n" +
192
		"				       * XXXX\n" + 
192
		"				       * XXXX\n" +
193
		"				         */\n" + 
193
		"				         */\n" +
194
		"}"
194
		"}"
195
	);
195
	);
196
}
196
}
Lines 198-217 Link Here
198
	this.formatterPrefs.comment_format_block_comment = false;
198
	this.formatterPrefs.comment_format_block_comment = false;
199
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB;
199
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB;
200
	String source =
200
	String source =
201
		"public class Test {\n" + 
201
		"public class Test {\n" +
202
		"\n" + 
202
		"\n" +
203
		"        /*\n" + 
203
		"        /*\n" +
204
		"             * XXXX\n" + 
204
		"             * XXXX\n" +
205
		"               */\n" + 
205
		"               */\n" +
206
		"    int x = 0;\n" + 
206
		"    int x = 0;\n" +
207
		"}";
207
		"}";
208
	formatSource(source,
208
	formatSource(source,
209
		"public class Test {\n" + 
209
		"public class Test {\n" +
210
		"\n" + 
210
		"\n" +
211
		"	/*\n" + 
211
		"	/*\n" +
212
		"	     * XXXX\n" + 
212
		"	     * XXXX\n" +
213
		"	       */\n" + 
213
		"	       */\n" +
214
		"	int x = 0;\n" + 
214
		"	int x = 0;\n" +
215
		"}"
215
		"}"
216
	);
216
	);
217
}
217
}
Lines 219-238 Link Here
219
	this.formatterPrefs.comment_format_block_comment = false;
219
	this.formatterPrefs.comment_format_block_comment = false;
220
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB;
220
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.TAB;
221
	String source =
221
	String source =
222
		"public class Test {\n" + 
222
		"public class Test {\n" +
223
		"\n" + 
223
		"\n" +
224
		"            /*\n" + 
224
		"            /*\n" +
225
		"         * XXXX\n" + 
225
		"         * XXXX\n" +
226
		"       */\n" + 
226
		"       */\n" +
227
		"    int x = 0;\n" + 
227
		"    int x = 0;\n" +
228
		"}";
228
		"}";
229
	formatSource(source,
229
	formatSource(source,
230
		"public class Test {\n" + 
230
		"public class Test {\n" +
231
		"\n" + 
231
		"\n" +
232
		"	/*\n" + 
232
		"	/*\n" +
233
		"	* XXXX\n" + 
233
		"	* XXXX\n" +
234
		"	*/\n" + 
234
		"	*/\n" +
235
		"	int x = 0;\n" + 
235
		"	int x = 0;\n" +
236
		"}"
236
		"}"
237
	);
237
	);
238
}
238
}
Lines 240-257 Link Here
240
	this.formatterPrefs.comment_format_block_comment = false;
240
	this.formatterPrefs.comment_format_block_comment = false;
241
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE;
241
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE;
242
	String source =
242
	String source =
243
		"public class Test {\n" + 
243
		"public class Test {\n" +
244
		"\n" + 
244
		"\n" +
245
		"    int x = 0; /*\n" + 
245
		"    int x = 0; /*\n" +
246
		"    * XXXX\n" + 
246
		"    * XXXX\n" +
247
		"    */\n" + 
247
		"    */\n" +
248
		"}";
248
		"}";
249
	formatSource(source,
249
	formatSource(source,
250
		"public class Test {\n" + 
250
		"public class Test {\n" +
251
		"\n" + 
251
		"\n" +
252
		"    int x = 0; /*\n" + 
252
		"    int x = 0; /*\n" +
253
		"               * XXXX\n" + 
253
		"               * XXXX\n" +
254
		"               */\n" + 
254
		"               */\n" +
255
		"}"
255
		"}"
256
	);
256
	);
257
}
257
}
Lines 259-276 Link Here
259
	this.formatterPrefs.comment_format_block_comment = false;
259
	this.formatterPrefs.comment_format_block_comment = false;
260
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE;
260
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE;
261
	String source =
261
	String source =
262
		"public class Test {\n" + 
262
		"public class Test {\n" +
263
		"\n" + 
263
		"\n" +
264
		"    int x = 10; /*\n" + 
264
		"    int x = 10; /*\n" +
265
		"    * XXXX\n" + 
265
		"    * XXXX\n" +
266
		"    */\n" + 
266
		"    */\n" +
267
		"}";
267
		"}";
268
	formatSource(source,
268
	formatSource(source,
269
		"public class Test {\n" + 
269
		"public class Test {\n" +
270
		"\n" + 
270
		"\n" +
271
		"    int x = 10; /*\n" + 
271
		"    int x = 10; /*\n" +
272
		"                * XXXX\n" + 
272
		"                * XXXX\n" +
273
		"                */\n" + 
273
		"                */\n" +
274
		"}"
274
		"}"
275
	);
275
	);
276
}
276
}
Lines 278-295 Link Here
278
	this.formatterPrefs.comment_format_block_comment = false;
278
	this.formatterPrefs.comment_format_block_comment = false;
279
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE;
279
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE;
280
	String source =
280
	String source =
281
		"public class Test {\n" + 
281
		"public class Test {\n" +
282
		"\n" + 
282
		"\n" +
283
		"    int x = 100; /*\n" + 
283
		"    int x = 100; /*\n" +
284
		"    * XXXX\n" + 
284
		"    * XXXX\n" +
285
		"    */\n" + 
285
		"    */\n" +
286
		"}";
286
		"}";
287
	formatSource(source,
287
	formatSource(source,
288
		"public class Test {\n" + 
288
		"public class Test {\n" +
289
		"\n" + 
289
		"\n" +
290
		"    int x = 100; /*\n" + 
290
		"    int x = 100; /*\n" +
291
		"                 * XXXX\n" + 
291
		"                 * XXXX\n" +
292
		"                 */\n" + 
292
		"                 */\n" +
293
		"}"
293
		"}"
294
	);
294
	);
295
}
295
}
Lines 297-314 Link Here
297
	this.formatterPrefs.comment_format_block_comment = false;
297
	this.formatterPrefs.comment_format_block_comment = false;
298
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE;
298
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE;
299
	String source =
299
	String source =
300
		"public class Test {\n" + 
300
		"public class Test {\n" +
301
		"\n" + 
301
		"\n" +
302
		"    int x = 0; /*\n" + 
302
		"    int x = 0; /*\n" +
303
		"                      * XXXX\n" + 
303
		"                      * XXXX\n" +
304
		"                        */\n" + 
304
		"                        */\n" +
305
		"}";
305
		"}";
306
	formatSource(source,
306
	formatSource(source,
307
		"public class Test {\n" + 
307
		"public class Test {\n" +
308
		"\n" + 
308
		"\n" +
309
		"    int x = 0; /*\n" + 
309
		"    int x = 0; /*\n" +
310
		"                      * XXXX\n" + 
310
		"                      * XXXX\n" +
311
		"                        */\n" + 
311
		"                        */\n" +
312
		"}"
312
		"}"
313
	);
313
	);
314
}
314
}
Lines 316-335 Link Here
316
	this.formatterPrefs.comment_format_block_comment = false;
316
	this.formatterPrefs.comment_format_block_comment = false;
317
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE;
317
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE;
318
	String source =
318
	String source =
319
		"public class Test {\n" + 
319
		"public class Test {\n" +
320
		"\n" + 
320
		"\n" +
321
		"        /*\n" + 
321
		"        /*\n" +
322
		"             * XXXX\n" + 
322
		"             * XXXX\n" +
323
		"               */\n" + 
323
		"               */\n" +
324
		"    int x = 0;\n" + 
324
		"    int x = 0;\n" +
325
		"}";
325
		"}";
326
	formatSource(source,
326
	formatSource(source,
327
		"public class Test {\n" + 
327
		"public class Test {\n" +
328
		"\n" + 
328
		"\n" +
329
		"    /*\n" + 
329
		"    /*\n" +
330
		"         * XXXX\n" + 
330
		"         * XXXX\n" +
331
		"           */\n" + 
331
		"           */\n" +
332
		"    int x = 0;\n" + 
332
		"    int x = 0;\n" +
333
		"}"
333
		"}"
334
	);
334
	);
335
}
335
}
Lines 337-356 Link Here
337
	this.formatterPrefs.comment_format_block_comment = false;
337
	this.formatterPrefs.comment_format_block_comment = false;
338
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE;
338
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.SPACE;
339
	String source =
339
	String source =
340
		"public class Test {\n" + 
340
		"public class Test {\n" +
341
		"\n" + 
341
		"\n" +
342
		"            /*\n" + 
342
		"            /*\n" +
343
		"         * XXXX\n" + 
343
		"         * XXXX\n" +
344
		"       */\n" + 
344
		"       */\n" +
345
		"    int x = 0;\n" + 
345
		"    int x = 0;\n" +
346
		"}";
346
		"}";
347
	formatSource(source,
347
	formatSource(source,
348
		"public class Test {\n" + 
348
		"public class Test {\n" +
349
		"\n" + 
349
		"\n" +
350
		"    /*\n" + 
350
		"    /*\n" +
351
		"    * XXXX\n" + 
351
		"    * XXXX\n" +
352
		"    */\n" + 
352
		"    */\n" +
353
		"    int x = 0;\n" + 
353
		"    int x = 0;\n" +
354
		"}"
354
		"}"
355
	);
355
	);
356
}
356
}
Lines 358-375 Link Here
358
	this.formatterPrefs.comment_format_block_comment = false;
358
	this.formatterPrefs.comment_format_block_comment = false;
359
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED;
359
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED;
360
	String source =
360
	String source =
361
		"public class Test {\n" + 
361
		"public class Test {\n" +
362
		"\n" + 
362
		"\n" +
363
		"    int x = 0; /*\n" + 
363
		"    int x = 0; /*\n" +
364
		"    * XXXX\n" + 
364
		"    * XXXX\n" +
365
		"    */\n" + 
365
		"    */\n" +
366
		"}";
366
		"}";
367
	formatSource(source,
367
	formatSource(source,
368
		"public class Test {\n" + 
368
		"public class Test {\n" +
369
		"\n" + 
369
		"\n" +
370
		"	int x = 0; /*\n" + 
370
		"	int x = 0; /*\n" +
371
		"			   * XXXX\n" + 
371
		"			   * XXXX\n" +
372
		"			   */\n" + 
372
		"			   */\n" +
373
		"}"
373
		"}"
374
	);
374
	);
375
}
375
}
Lines 377-394 Link Here
377
	this.formatterPrefs.comment_format_block_comment = false;
377
	this.formatterPrefs.comment_format_block_comment = false;
378
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED;
378
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED;
379
	String source =
379
	String source =
380
		"public class Test {\n" + 
380
		"public class Test {\n" +
381
		"\n" + 
381
		"\n" +
382
		"    int x = 10; /*\n" + 
382
		"    int x = 10; /*\n" +
383
		"    * XXXX\n" + 
383
		"    * XXXX\n" +
384
		"    */\n" + 
384
		"    */\n" +
385
		"}";
385
		"}";
386
	formatSource(source,
386
	formatSource(source,
387
		"public class Test {\n" + 
387
		"public class Test {\n" +
388
		"\n" + 
388
		"\n" +
389
		"	int x = 10; /*\n" + 
389
		"	int x = 10; /*\n" +
390
		"				* XXXX\n" + 
390
		"				* XXXX\n" +
391
		"				*/\n" + 
391
		"				*/\n" +
392
		"}"
392
		"}"
393
	);
393
	);
394
}
394
}
Lines 396-413 Link Here
396
	this.formatterPrefs.comment_format_block_comment = false;
396
	this.formatterPrefs.comment_format_block_comment = false;
397
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED;
397
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED;
398
	String source =
398
	String source =
399
		"public class Test {\n" + 
399
		"public class Test {\n" +
400
		"\n" + 
400
		"\n" +
401
		"    int x = 100; /*\n" + 
401
		"    int x = 100; /*\n" +
402
		"    * XXXX\n" + 
402
		"    * XXXX\n" +
403
		"    */\n" + 
403
		"    */\n" +
404
		"}";
404
		"}";
405
	formatSource(source,
405
	formatSource(source,
406
		"public class Test {\n" + 
406
		"public class Test {\n" +
407
		"\n" + 
407
		"\n" +
408
		"	int x = 100; /*\n" + 
408
		"	int x = 100; /*\n" +
409
		"				 * XXXX\n" + 
409
		"				 * XXXX\n" +
410
		"				 */\n" + 
410
		"				 */\n" +
411
		"}"
411
		"}"
412
	);
412
	);
413
}
413
}
Lines 415-432 Link Here
415
	this.formatterPrefs.comment_format_block_comment = false;
415
	this.formatterPrefs.comment_format_block_comment = false;
416
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED;
416
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED;
417
	String source =
417
	String source =
418
		"public class Test {\n" + 
418
		"public class Test {\n" +
419
		"\n" + 
419
		"\n" +
420
		"    int x = 0; /*\n" + 
420
		"    int x = 0; /*\n" +
421
		"                      * XXXX\n" + 
421
		"                      * XXXX\n" +
422
		"                        */\n" + 
422
		"                        */\n" +
423
		"}";
423
		"}";
424
	formatSource(source,
424
	formatSource(source,
425
		"public class Test {\n" + 
425
		"public class Test {\n" +
426
		"\n" + 
426
		"\n" +
427
		"	int x = 0; /*\n" + 
427
		"	int x = 0; /*\n" +
428
		"			          * XXXX\n" + 
428
		"			          * XXXX\n" +
429
		"			            */\n" + 
429
		"			            */\n" +
430
		"}"
430
		"}"
431
	);
431
	);
432
}
432
}
Lines 434-453 Link Here
434
	this.formatterPrefs.comment_format_block_comment = false;
434
	this.formatterPrefs.comment_format_block_comment = false;
435
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED;
435
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED;
436
	String source =
436
	String source =
437
		"public class Test {\n" + 
437
		"public class Test {\n" +
438
		"\n" + 
438
		"\n" +
439
		"        /*\n" + 
439
		"        /*\n" +
440
		"             * XXXX\n" + 
440
		"             * XXXX\n" +
441
		"               */\n" + 
441
		"               */\n" +
442
		"    int x = 0;\n" + 
442
		"    int x = 0;\n" +
443
		"}";
443
		"}";
444
	formatSource(source,
444
	formatSource(source,
445
		"public class Test {\n" + 
445
		"public class Test {\n" +
446
		"\n" + 
446
		"\n" +
447
		"	/*\n" + 
447
		"	/*\n" +
448
		"	     * XXXX\n" + 
448
		"	     * XXXX\n" +
449
		"	       */\n" + 
449
		"	       */\n" +
450
		"	int x = 0;\n" + 
450
		"	int x = 0;\n" +
451
		"}"
451
		"}"
452
	);
452
	);
453
}
453
}
Lines 455-474 Link Here
455
	this.formatterPrefs.comment_format_block_comment = false;
455
	this.formatterPrefs.comment_format_block_comment = false;
456
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED;
456
	this.formatterPrefs.tab_char = DefaultCodeFormatterOptions.MIXED;
457
	String source =
457
	String source =
458
		"public class Test {\n" + 
458
		"public class Test {\n" +
459
		"\n" + 
459
		"\n" +
460
		"            /*\n" + 
460
		"            /*\n" +
461
		"         * XXXX\n" + 
461
		"         * XXXX\n" +
462
		"       */\n" + 
462
		"       */\n" +
463
		"    int x = 0;\n" + 
463
		"    int x = 0;\n" +
464
		"}";
464
		"}";
465
	formatSource(source,
465
	formatSource(source,
466
		"public class Test {\n" + 
466
		"public class Test {\n" +
467
		"\n" + 
467
		"\n" +
468
		"	/*\n" + 
468
		"	/*\n" +
469
		"	* XXXX\n" + 
469
		"	* XXXX\n" +
470
		"	*/\n" + 
470
		"	*/\n" +
471
		"	int x = 0;\n" + 
471
		"	int x = 0;\n" +
472
		"}"
472
		"}"
473
	);
473
	);
474
}
474
}
Lines 482-505 Link Here
482
public void _testBug204091() {
482
public void _testBug204091() {
483
	String source =
483
	String source =
484
		"public class Test {\r\n" +
484
		"public class Test {\r\n" +
485
		"	/**\r\n" + 
485
		"	/**\r\n" +
486
		"	 * Don't format this:\r\n" + 
486
		"	 * Don't format this:\r\n" +
487
		"	 *    it has been formatted by the user!\r\n" + 
487
		"	 *    it has been formatted by the user!\r\n" +
488
		"	 * \r\n" + 
488
		"	 * \r\n" +
489
		"	 * [#@param    param   format   this comment    #]\r\n" + 
489
		"	 * [#@param    param   format   this comment    #]\r\n" +
490
		"	 */\r\n" + 
490
		"	 */\r\n" +
491
		"	public void foo() {\r\n" +
491
		"	public void foo() {\r\n" +
492
		"	}\r\n" +
492
		"	}\r\n" +
493
		"}";
493
		"}";
494
	formatSource(source,
494
	formatSource(source,
495
		"public class Test {\r\n" +
495
		"public class Test {\r\n" +
496
		"	/**\r\n" + 
496
		"	/**\r\n" +
497
		"	 * Don't format this:\r\n" + 
497
		"	 * Don't format this:\r\n" +
498
		"	 *    it has been formatted by the user!\r\n" + 
498
		"	 *    it has been formatted by the user!\r\n" +
499
		"	 * \r\n" + 
499
		"	 * \r\n" +
500
		"	 * @param param\n" + 
500
		"	 * @param param\n" +
501
		"	 *            format this comment\n" + 
501
		"	 *            format this comment\n" +
502
		"	 */\r\n" + 
502
		"	 */\r\n" +
503
		"	public void foo() {\r\n" +
503
		"	public void foo() {\r\n" +
504
		"	}\r\n" +
504
		"	}\r\n" +
505
		"}"
505
		"}"
Lines 513-689 Link Here
513
 */
513
 */
514
public void testBug217108a() {
514
public void testBug217108a() {
515
	String source =
515
	String source =
516
		"public class Test {\n" + 
516
		"public class Test {\n" +
517
		"\n" + 
517
		"\n" +
518
		"    /* a */\n" + 
518
		"    /* a */\n" +
519
		"    // b\n" + 
519
		"    // b\n" +
520
		"\n" + 
520
		"\n" +
521
		"    int i;\n" + 
521
		"    int i;\n" +
522
		"\n" + 
522
		"\n" +
523
		"}\n";
523
		"}\n";
524
	formatSource(source,
524
	formatSource(source,
525
		"public class Test {\n" + 
525
		"public class Test {\n" +
526
		"\n" + 
526
		"\n" +
527
		"	/* a */\n" + 
527
		"	/* a */\n" +
528
		"	// b\n" + 
528
		"	// b\n" +
529
		"\n" + 
529
		"\n" +
530
		"	int i;\n" + 
530
		"	int i;\n" +
531
		"\n" + 
531
		"\n" +
532
		"}\n"
532
		"}\n"
533
	);
533
	);
534
}
534
}
535
public void testBug217108b() {
535
public void testBug217108b() {
536
	String source =
536
	String source =
537
		"public class Test {\n" + 
537
		"public class Test {\n" +
538
		"\n" + 
538
		"\n" +
539
		"    /* a */\n" + 
539
		"    /* a */\n" +
540
		"\n" + 
540
		"\n" +
541
		"    // b\n" + 
541
		"    // b\n" +
542
		"\n" + 
542
		"\n" +
543
		"    int i;\n" + 
543
		"    int i;\n" +
544
		"\n" + 
544
		"\n" +
545
		"}\n";
545
		"}\n";
546
	formatSource(source,
546
	formatSource(source,
547
		"public class Test {\n" + 
547
		"public class Test {\n" +
548
		"\n" + 
548
		"\n" +
549
		"	/* a */\n" + 
549
		"	/* a */\n" +
550
		"\n" + 
550
		"\n" +
551
		"	// b\n" + 
551
		"	// b\n" +
552
		"\n" + 
552
		"\n" +
553
		"	int i;\n" + 
553
		"	int i;\n" +
554
		"\n" + 
554
		"\n" +
555
		"}\n"
555
		"}\n"
556
	);
556
	);
557
}
557
}
558
public void testBug217108c() {
558
public void testBug217108c() {
559
	String source =
559
	String source =
560
		"public class Test {\n" + 
560
		"public class Test {\n" +
561
		"\n" + 
561
		"\n" +
562
		"    // b\n" + 
562
		"    // b\n" +
563
		"    /* a */\n" + 
563
		"    /* a */\n" +
564
		"\n" + 
564
		"\n" +
565
		"    int i;\n" + 
565
		"    int i;\n" +
566
		"\n" + 
566
		"\n" +
567
		"}\n";
567
		"}\n";
568
	formatSource(source,
568
	formatSource(source,
569
		"public class Test {\n" + 
569
		"public class Test {\n" +
570
		"\n" + 
570
		"\n" +
571
		"	// b\n" + 
571
		"	// b\n" +
572
		"	/* a */\n" + 
572
		"	/* a */\n" +
573
		"\n" + 
573
		"\n" +
574
		"	int i;\n" + 
574
		"	int i;\n" +
575
		"\n" + 
575
		"\n" +
576
		"}\n"
576
		"}\n"
577
	);
577
	);
578
}
578
}
579
public void testBug217108d() {
579
public void testBug217108d() {
580
	String source =
580
	String source =
581
		"public class Test {\n" + 
581
		"public class Test {\n" +
582
		"\n" + 
582
		"\n" +
583
		"    // b\n" + 
583
		"    // b\n" +
584
		"\n" + 
584
		"\n" +
585
		"    /* a */\n" + 
585
		"    /* a */\n" +
586
		"\n" + 
586
		"\n" +
587
		"    int i;\n" + 
587
		"    int i;\n" +
588
		"\n" + 
588
		"\n" +
589
		"}\n";
589
		"}\n";
590
	formatSource(source,
590
	formatSource(source,
591
		"public class Test {\n" + 
591
		"public class Test {\n" +
592
		"\n" + 
592
		"\n" +
593
		"	// b\n" + 
593
		"	// b\n" +
594
		"\n" + 
594
		"\n" +
595
		"	/* a */\n" + 
595
		"	/* a */\n" +
596
		"\n" + 
596
		"\n" +
597
		"	int i;\n" + 
597
		"	int i;\n" +
598
		"\n" + 
598
		"\n" +
599
		"}\n"
599
		"}\n"
600
	);
600
	);
601
}
601
}
602
public void testBug217108e() {
602
public void testBug217108e() {
603
	String source =
603
	String source =
604
		"public class Test {\n" + 
604
		"public class Test {\n" +
605
		"\n" + 
605
		"\n" +
606
		"    // a\n" + 
606
		"    // a\n" +
607
		"\n" + 
607
		"\n" +
608
		"    // b\n" + 
608
		"    // b\n" +
609
		"\n" + 
609
		"\n" +
610
		"    int i;\n" + 
610
		"    int i;\n" +
611
		"\n" + 
611
		"\n" +
612
		"}\n";
612
		"}\n";
613
	formatSource(source,
613
	formatSource(source,
614
		"public class Test {\n" + 
614
		"public class Test {\n" +
615
		"\n" + 
615
		"\n" +
616
		"	// a\n" + 
616
		"	// a\n" +
617
		"\n" + 
617
		"\n" +
618
		"	// b\n" + 
618
		"	// b\n" +
619
		"\n" + 
619
		"\n" +
620
		"	int i;\n" + 
620
		"	int i;\n" +
621
		"\n" + 
621
		"\n" +
622
		"}\n"
622
		"}\n"
623
	);
623
	);
624
}
624
}
625
public void testBug217108f() {
625
public void testBug217108f() {
626
	String source =
626
	String source =
627
		"public class Test {\n" + 
627
		"public class Test {\n" +
628
		"\n" + 
628
		"\n" +
629
		"    // a\n" + 
629
		"    // a\n" +
630
		"    // b\n" + 
630
		"    // b\n" +
631
		"\n" + 
631
		"\n" +
632
		"    int i;\n" + 
632
		"    int i;\n" +
633
		"\n" + 
633
		"\n" +
634
		"}\n";
634
		"}\n";
635
	formatSource(source,
635
	formatSource(source,
636
		"public class Test {\n" + 
636
		"public class Test {\n" +
637
		"\n" + 
637
		"\n" +
638
		"	// a\n" + 
638
		"	// a\n" +
639
		"	// b\n" + 
639
		"	// b\n" +
640
		"\n" + 
640
		"\n" +
641
		"	int i;\n" + 
641
		"	int i;\n" +
642
		"\n" + 
642
		"\n" +
643
		"}\n"
643
		"}\n"
644
	);
644
	);
645
}
645
}
646
public void testBug217108g() {
646
public void testBug217108g() {
647
	String source =
647
	String source =
648
		"public class Test {\n" + 
648
		"public class Test {\n" +
649
		"\n" + 
649
		"\n" +
650
		"    /** a */\n" + 
650
		"    /** a */\n" +
651
		"    // b\n" + 
651
		"    // b\n" +
652
		"\n" + 
652
		"\n" +
653
		"    int i;\n" + 
653
		"    int i;\n" +
654
		"\n" + 
654
		"\n" +
655
		"}\n";
655
		"}\n";
656
	formatSource(source,
656
	formatSource(source,
657
		"public class Test {\n" + 
657
		"public class Test {\n" +
658
		"\n" + 
658
		"\n" +
659
		"	/** a */\n" + 
659
		"	/** a */\n" +
660
		"	// b\n" + 
660
		"	// b\n" +
661
		"\n" + 
661
		"\n" +
662
		"	int i;\n" + 
662
		"	int i;\n" +
663
		"\n" + 
663
		"\n" +
664
		"}\n"
664
		"}\n"
665
	);
665
	);
666
}
666
}
667
public void testBug217108h() {
667
public void testBug217108h() {
668
	String source =
668
	String source =
669
		"public class Test {\n" + 
669
		"public class Test {\n" +
670
		"\n" + 
670
		"\n" +
671
		"    /** a */\n" + 
671
		"    /** a */\n" +
672
		"\n" + 
672
		"\n" +
673
		"    // b\n" + 
673
		"    // b\n" +
674
		"\n" + 
674
		"\n" +
675
		"    int i;\n" + 
675
		"    int i;\n" +
676
		"\n" + 
676
		"\n" +
677
		"}\n";
677
		"}\n";
678
	formatSource(source,
678
	formatSource(source,
679
		"public class Test {\n" + 
679
		"public class Test {\n" +
680
		"\n" + 
680
		"\n" +
681
		"	/** a */\n" + 
681
		"	/** a */\n" +
682
		"\n" + 
682
		"\n" +
683
		"	// b\n" + 
683
		"	// b\n" +
684
		"\n" + 
684
		"\n" +
685
		"	int i;\n" + 
685
		"	int i;\n" +
686
		"\n" + 
686
		"\n" +
687
		"}\n"
687
		"}\n"
688
	);
688
	);
689
}
689
}
Lines 1808-2063 Link Here
1808
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=234583"
1808
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=234583"
1809
 */
1809
 */
1810
public void testBug234583a() throws JavaModelException {
1810
public void testBug234583a() throws JavaModelException {
1811
	String source = 
1811
	String source =
1812
		"public class X {\n" + 
1812
		"public class X {\n" +
1813
		"[#                        int i= 1;               #]\n" + 
1813
		"[#                        int i= 1;               #]\n" +
1814
		"}\n";
1814
		"}\n";
1815
	formatSource(source,
1815
	formatSource(source,
1816
		"public class X {\n" + 
1816
		"public class X {\n" +
1817
		"	int i = 1;\n" + 
1817
		"	int i = 1;\n" +
1818
		"}\n"
1818
		"}\n"
1819
	);
1819
	);
1820
}
1820
}
1821
public void testBug234583b() throws JavaModelException {
1821
public void testBug234583b() throws JavaModelException {
1822
	String source = 
1822
	String source =
1823
		"public class X {      \n" + 
1823
		"public class X {      \n" +
1824
		"\n" + 
1824
		"\n" +
1825
		"\n" + 
1825
		"\n" +
1826
		"\n" + 
1826
		"\n" +
1827
		"[#                        int i= 1;               #]\n" + 
1827
		"[#                        int i= 1;               #]\n" +
1828
		"\n" + 
1828
		"\n" +
1829
		"\n" + 
1829
		"\n" +
1830
		"\n" + 
1830
		"\n" +
1831
		"\n" + 
1831
		"\n" +
1832
		"     }\n";
1832
		"     }\n";
1833
	formatSource(source,
1833
	formatSource(source,
1834
		"public class X {      \n" + 
1834
		"public class X {      \n" +
1835
		"\n" + 
1835
		"\n" +
1836
		"\n" + 
1836
		"\n" +
1837
		"\n" + 
1837
		"\n" +
1838
		"	int i = 1;\n" + 
1838
		"	int i = 1;\n" +
1839
		"\n" + 
1839
		"\n" +
1840
		"\n" + 
1840
		"\n" +
1841
		"\n" + 
1841
		"\n" +
1842
		"\n" + 
1842
		"\n" +
1843
		"     }\n"
1843
		"     }\n"
1844
	);
1844
	);
1845
}
1845
}
1846
public void testBug234583c() throws JavaModelException {
1846
public void testBug234583c() throws JavaModelException {
1847
	String source = 
1847
	String source =
1848
		"public class X {      \n" + 
1848
		"public class X {      \n" +
1849
		"\n" + 
1849
		"\n" +
1850
		"\n" + 
1850
		"\n" +
1851
		"\n" + 
1851
		"\n" +
1852
		"[#                        int i= 1;               \n" + 
1852
		"[#                        int i= 1;               \n" +
1853
		"#]\n" + 
1853
		"#]\n" +
1854
		"\n" + 
1854
		"\n" +
1855
		"\n" + 
1855
		"\n" +
1856
		"\n" + 
1856
		"\n" +
1857
		"     }\n";
1857
		"     }\n";
1858
	formatSource(source,
1858
	formatSource(source,
1859
		"public class X {      \n" + 
1859
		"public class X {      \n" +
1860
		"\n" + 
1860
		"\n" +
1861
		"\n" + 
1861
		"\n" +
1862
		"\n" + 
1862
		"\n" +
1863
		"	int i = 1;\n" + 
1863
		"	int i = 1;\n" +
1864
		"\n" + 
1864
		"\n" +
1865
		"\n" + 
1865
		"\n" +
1866
		"\n" + 
1866
		"\n" +
1867
		"     }\n"
1867
		"     }\n"
1868
	);
1868
	);
1869
}
1869
}
1870
public void testBug234583d() throws JavaModelException {
1870
public void testBug234583d() throws JavaModelException {
1871
	String source = 
1871
	String source =
1872
		"public class X {      \n" + 
1872
		"public class X {      \n" +
1873
		"\n" + 
1873
		"\n" +
1874
		"\n" + 
1874
		"\n" +
1875
		"[#\n" + 
1875
		"[#\n" +
1876
		"                        int i= 1;               \n" + 
1876
		"                        int i= 1;               \n" +
1877
		"\n" + 
1877
		"\n" +
1878
		"#]\n" + 
1878
		"#]\n" +
1879
		"\n" + 
1879
		"\n" +
1880
		"\n" + 
1880
		"\n" +
1881
		"     }\n";
1881
		"     }\n";
1882
	formatSource(source,
1882
	formatSource(source,
1883
		"public class X {      \n" + 
1883
		"public class X {      \n" +
1884
		"\n" + 
1884
		"\n" +
1885
		"\n" + 
1885
		"\n" +
1886
		"	int i = 1;\n" + 
1886
		"	int i = 1;\n" +
1887
		"\n" + 
1887
		"\n" +
1888
		"\n" + 
1888
		"\n" +
1889
		"     }\n"
1889
		"     }\n"
1890
	);
1890
	);
1891
}
1891
}
1892
public void testBug234583e() throws JavaModelException {
1892
public void testBug234583e() throws JavaModelException {
1893
	String source = 
1893
	String source =
1894
		"public class X {      \n" + 
1894
		"public class X {      \n" +
1895
		"\n" + 
1895
		"\n" +
1896
		"[#\n" + 
1896
		"[#\n" +
1897
		"\n" + 
1897
		"\n" +
1898
		"                        int i= 1;               \n" + 
1898
		"                        int i= 1;               \n" +
1899
		"\n" + 
1899
		"\n" +
1900
		"\n" + 
1900
		"\n" +
1901
		"#]\n" + 
1901
		"#]\n" +
1902
		"\n" + 
1902
		"\n" +
1903
		"     }\n";
1903
		"     }\n";
1904
	formatSource(source,
1904
	formatSource(source,
1905
		"public class X {      \n" + 
1905
		"public class X {      \n" +
1906
		"\n" + 
1906
		"\n" +
1907
		"	int i = 1;\n" + 
1907
		"	int i = 1;\n" +
1908
		"\n" + 
1908
		"\n" +
1909
		"     }\n"
1909
		"     }\n"
1910
	);
1910
	);
1911
}
1911
}
1912
public void testBug234583f() throws JavaModelException {
1912
public void testBug234583f() throws JavaModelException {
1913
	String source = 
1913
	String source =
1914
		"public class X {      \n" + 
1914
		"public class X {      \n" +
1915
		"[#\n" + 
1915
		"[#\n" +
1916
		"\n" + 
1916
		"\n" +
1917
		"\n" + 
1917
		"\n" +
1918
		"                        int i= 1;               \n" + 
1918
		"                        int i= 1;               \n" +
1919
		"\n" + 
1919
		"\n" +
1920
		"\n" + 
1920
		"\n" +
1921
		"\n" + 
1921
		"\n" +
1922
		"#]\n" + 
1922
		"#]\n" +
1923
		"     }\n";
1923
		"     }\n";
1924
	formatSource(source,
1924
	formatSource(source,
1925
		"public class X {      \n" + 
1925
		"public class X {      \n" +
1926
		"\n" + 
1926
		"\n" +
1927
		"	int i = 1;\n" + 
1927
		"	int i = 1;\n" +
1928
		"\n" + 
1928
		"\n" +
1929
		"     }\n"
1929
		"     }\n"
1930
	);
1930
	);
1931
}
1931
}
1932
public void testBug234583g() throws JavaModelException {
1932
public void testBug234583g() throws JavaModelException {
1933
	String source = 
1933
	String source =
1934
		"public class X {      [#\n" + 
1934
		"public class X {      [#\n" +
1935
		"\n" + 
1935
		"\n" +
1936
		"\n" + 
1936
		"\n" +
1937
		"\n" + 
1937
		"\n" +
1938
		"                        int i= 1;               \n" + 
1938
		"                        int i= 1;               \n" +
1939
		"\n" + 
1939
		"\n" +
1940
		"\n" + 
1940
		"\n" +
1941
		"\n" + 
1941
		"\n" +
1942
		"\n" + 
1942
		"\n" +
1943
		"#]     }\n";
1943
		"#]     }\n";
1944
	formatSource(source,
1944
	formatSource(source,
1945
		"public class X {      \n" + 
1945
		"public class X {      \n" +
1946
		"\n" + 
1946
		"\n" +
1947
		"	int i = 1;\n" + 
1947
		"	int i = 1;\n" +
1948
		"\n" + 
1948
		"\n" +
1949
		"     }\n"
1949
		"     }\n"
1950
	);
1950
	);
1951
}
1951
}
1952
public void testBug234583h() throws JavaModelException {
1952
public void testBug234583h() throws JavaModelException {
1953
	String source = 
1953
	String source =
1954
		"public class X {   [#   \n" + 
1954
		"public class X {   [#   \n" +
1955
		"\n" + 
1955
		"\n" +
1956
		"\n" + 
1956
		"\n" +
1957
		"\n" + 
1957
		"\n" +
1958
		"                        int i= 1;               \n" + 
1958
		"                        int i= 1;               \n" +
1959
		"\n" + 
1959
		"\n" +
1960
		"\n" + 
1960
		"\n" +
1961
		"\n" + 
1961
		"\n" +
1962
		"\n" + 
1962
		"\n" +
1963
		"   #]  }\n";
1963
		"   #]  }\n";
1964
	formatSource(source,
1964
	formatSource(source,
1965
		"public class X {   \n" + 
1965
		"public class X {   \n" +
1966
		"\n" + 
1966
		"\n" +
1967
		"	int i = 1;\n" + 
1967
		"	int i = 1;\n" +
1968
		"\n" + 
1968
		"\n" +
1969
		"  }\n"
1969
		"  }\n"
1970
	);
1970
	);
1971
}
1971
}
1972
public void testBug234583i() throws JavaModelException {
1972
public void testBug234583i() throws JavaModelException {
1973
	String source = 
1973
	String source =
1974
		"public class X {[#      \n" + 
1974
		"public class X {[#      \n" +
1975
		"\n" + 
1975
		"\n" +
1976
		"\n" + 
1976
		"\n" +
1977
		"\n" + 
1977
		"\n" +
1978
		"                        int i= 1;               \n" + 
1978
		"                        int i= 1;               \n" +
1979
		"\n" + 
1979
		"\n" +
1980
		"\n" + 
1980
		"\n" +
1981
		"\n" + 
1981
		"\n" +
1982
		"\n" + 
1982
		"\n" +
1983
		"     #]}\n";
1983
		"     #]}\n";
1984
	formatSource(source,
1984
	formatSource(source,
1985
		"public class X {\n" + 
1985
		"public class X {\n" +
1986
		"\n" + 
1986
		"\n" +
1987
		"	int i = 1;\n" + 
1987
		"	int i = 1;\n" +
1988
		"\n" + 
1988
		"\n" +
1989
		"}\n"
1989
		"}\n"
1990
	);
1990
	);
1991
}
1991
}
1992
// duplicate https://bugs.eclipse.org/bugs/show_bug.cgi?id=239447
1992
// duplicate https://bugs.eclipse.org/bugs/show_bug.cgi?id=239447
1993
public void testBug234583_Bug239447() throws JavaModelException {
1993
public void testBug234583_Bug239447() throws JavaModelException {
1994
	String source = 
1994
	String source =
1995
		"public class Bug239447 {\n" + 
1995
		"public class Bug239447 {\n" +
1996
		"	private static final String CONTENT = \"test.ObjectB {\\n\"\n" + 
1996
		"	private static final String CONTENT = \"test.ObjectB {\\n\"\n" +
1997
		"[#			     + \"     multiEle = { name=\\\"Foo\\\" }\\n\"#]\n" + 
1997
		"[#			     + \"     multiEle = { name=\\\"Foo\\\" }\\n\"#]\n" +
1998
		"			+ \"     multiEle = :x { name=\\\"Bar\\\" }\\n\" + \"   singleEle = x;\\n\"\n" + 
1998
		"			+ \"     multiEle = :x { name=\\\"Bar\\\" }\\n\" + \"   singleEle = x;\\n\"\n" +
1999
		"			+ \"}\";\n" + 
1999
		"			+ \"}\";\n" +
2000
		"\n" + 
2000
		"\n" +
2001
		"}\n";
2001
		"}\n";
2002
	formatSource(source,
2002
	formatSource(source,
2003
		"public class Bug239447 {\n" + 
2003
		"public class Bug239447 {\n" +
2004
		"	private static final String CONTENT = \"test.ObjectB {\\n\"\n" + 
2004
		"	private static final String CONTENT = \"test.ObjectB {\\n\"\n" +
2005
		"			+ \"     multiEle = { name=\\\"Foo\\\" }\\n\"\n" + 
2005
		"			+ \"     multiEle = { name=\\\"Foo\\\" }\\n\"\n" +
2006
		"			+ \"     multiEle = :x { name=\\\"Bar\\\" }\\n\" + \"   singleEle = x;\\n\"\n" + 
2006
		"			+ \"     multiEle = :x { name=\\\"Bar\\\" }\\n\" + \"   singleEle = x;\\n\"\n" +
2007
		"			+ \"}\";\n" + 
2007
		"			+ \"}\";\n" +
2008
		"\n" + 
2008
		"\n" +
2009
		"}\n"
2009
		"}\n"
2010
	);
2010
	);
2011
}
2011
}
2012
// duplicate https://bugs.eclipse.org/bugs/show_bug.cgi?id=237592
2012
// duplicate https://bugs.eclipse.org/bugs/show_bug.cgi?id=237592
2013
public void testBug234583_Bug237592() throws JavaModelException {
2013
public void testBug234583_Bug237592() throws JavaModelException {
2014
	String source = 
2014
	String source =
2015
		"package test;\n" + 
2015
		"package test;\n" +
2016
		"\n" + 
2016
		"\n" +
2017
		"public class Test {\n" + 
2017
		"public class Test {\n" +
2018
		"\n" + 
2018
		"\n" +
2019
		"	void foo() {\n" + 
2019
		"	void foo() {\n" +
2020
		"	}\n" + 
2020
		"	}\n" +
2021
		"\n" + 
2021
		"\n" +
2022
		"[#	  #]\n" + 
2022
		"[#	  #]\n" +
2023
		"	\n" + 
2023
		"	\n" +
2024
		"	\n" + 
2024
		"	\n" +
2025
		"	\n" + 
2025
		"	\n" +
2026
		"	\n" + 
2026
		"	\n" +
2027
		"	\n" + 
2027
		"	\n" +
2028
		"[#	 #]\n" + 
2028
		"[#	 #]\n" +
2029
		"	\n" + 
2029
		"	\n" +
2030
		"	\n" + 
2030
		"	\n" +
2031
		"	\n" + 
2031
		"	\n" +
2032
		"	\n" + 
2032
		"	\n" +
2033
		"	\n" + 
2033
		"	\n" +
2034
		"	void bar() {\n" + 
2034
		"	void bar() {\n" +
2035
		"	}\n" + 
2035
		"	}\n" +
2036
		"\n" + 
2036
		"\n" +
2037
		"}\n";
2037
		"}\n";
2038
	formatSource(source,
2038
	formatSource(source,
2039
		"package test;\n" + 
2039
		"package test;\n" +
2040
		"\n" + 
2040
		"\n" +
2041
		"public class Test {\n" + 
2041
		"public class Test {\n" +
2042
		"\n" + 
2042
		"\n" +
2043
		"	void foo() {\n" + 
2043
		"	void foo() {\n" +
2044
		"	}\n" + 
2044
		"	}\n" +
2045
		"\n" + 
2045
		"\n" +
2046
		"\n" + 
2046
		"\n" +
2047
		"	\n" + 
2047
		"	\n" +
2048
		"	\n" + 
2048
		"	\n" +
2049
		"	\n" + 
2049
		"	\n" +
2050
		"	\n" + 
2050
		"	\n" +
2051
		"	\n" + 
2051
		"	\n" +
2052
		"	 \n" + 
2052
		"	 \n" +
2053
		"	\n" + 
2053
		"	\n" +
2054
		"	\n" + 
2054
		"	\n" +
2055
		"	\n" + 
2055
		"	\n" +
2056
		"	\n" + 
2056
		"	\n" +
2057
		"	\n" + 
2057
		"	\n" +
2058
		"	void bar() {\n" + 
2058
		"	void bar() {\n" +
2059
		"	}\n" + 
2059
		"	}\n" +
2060
		"\n" + 
2060
		"\n" +
2061
		"}\n"
2061
		"}\n"
2062
	);
2062
	);
2063
}
2063
}
Lines 2393-2615 Link Here
2393
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=237453"
2393
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=237453"
2394
 */
2394
 */
2395
public void testBug237453a() throws JavaModelException {
2395
public void testBug237453a() throws JavaModelException {
2396
	String source = 
2396
	String source =
2397
		"package test1;\n" + 
2397
		"package test1;\n" +
2398
		"\n" + 
2398
		"\n" +
2399
		"public class E1 {\n" + 
2399
		"public class E1 {\n" +
2400
		" 	void foo() {\n" + 
2400
		" 	void foo() {\n" +
2401
		"	}\n" + 
2401
		"	}\n" +
2402
		" 	[#\n" + 
2402
		" 	[#\n" +
2403
		"	#]\n" + 
2403
		"	#]\n" +
2404
		" 	void bar() {\n" + 
2404
		" 	void bar() {\n" +
2405
		"	}\n" + 
2405
		"	}\n" +
2406
		"}";
2406
		"}";
2407
	formatSource(source,
2407
	formatSource(source,
2408
		"package test1;\n" + 
2408
		"package test1;\n" +
2409
		"\n" + 
2409
		"\n" +
2410
		"public class E1 {\n" + 
2410
		"public class E1 {\n" +
2411
		" 	void foo() {\n" + 
2411
		" 	void foo() {\n" +
2412
		"	}\n" + 
2412
		"	}\n" +
2413
		" 	\n" + 
2413
		" 	\n" +
2414
		" 	void bar() {\n" + 
2414
		" 	void bar() {\n" +
2415
		"	}\n" + 
2415
		"	}\n" +
2416
		"}"
2416
		"}"
2417
	);
2417
	);
2418
}
2418
}
2419
public void testBug237453b() throws JavaModelException {
2419
public void testBug237453b() throws JavaModelException {
2420
	String source = 
2420
	String source =
2421
		"package test1;\n" + 
2421
		"package test1;\n" +
2422
		"\n" + 
2422
		"\n" +
2423
		"public class E1 {\n" + 
2423
		"public class E1 {\n" +
2424
		" 	void foo() {\n" + 
2424
		" 	void foo() {\n" +
2425
		"	}\n" + 
2425
		"	}\n" +
2426
		" 	\n" + 
2426
		" 	\n" +
2427
		"[#	#]\n" + 
2427
		"[#	#]\n" +
2428
		" 	void bar() {\n" + 
2428
		" 	void bar() {\n" +
2429
		"	}\n" + 
2429
		"	}\n" +
2430
		"}";
2430
		"}";
2431
	formatSource(source,
2431
	formatSource(source,
2432
		"package test1;\n" + 
2432
		"package test1;\n" +
2433
		"\n" + 
2433
		"\n" +
2434
		"public class E1 {\n" + 
2434
		"public class E1 {\n" +
2435
		" 	void foo() {\n" + 
2435
		" 	void foo() {\n" +
2436
		"	}\n" + 
2436
		"	}\n" +
2437
		" 	\n" + 
2437
		" 	\n" +
2438
		"\n" + 
2438
		"\n" +
2439
		" 	void bar() {\n" + 
2439
		" 	void bar() {\n" +
2440
		"	}\n" + 
2440
		"	}\n" +
2441
		"}"
2441
		"}"
2442
	);
2442
	);
2443
}
2443
}
2444
public void testBug237453c() throws JavaModelException {
2444
public void testBug237453c() throws JavaModelException {
2445
	String source = 
2445
	String source =
2446
		"package test1;\n" + 
2446
		"package test1;\n" +
2447
		"\n" + 
2447
		"\n" +
2448
		"public class E1 {\n" + 
2448
		"public class E1 {\n" +
2449
		" 	void foo() {\n" + 
2449
		" 	void foo() {\n" +
2450
		"	}\n" + 
2450
		"	}\n" +
2451
		" 	\n" + 
2451
		" 	\n" +
2452
		"[#	\n" + 
2452
		"[#	\n" +
2453
		"#] 	void bar() {\n" + 
2453
		"#] 	void bar() {\n" +
2454
		"	}\n" + 
2454
		"	}\n" +
2455
		"}";
2455
		"}";
2456
	formatSource(source,
2456
	formatSource(source,
2457
		"package test1;\n" + 
2457
		"package test1;\n" +
2458
		"\n" + 
2458
		"\n" +
2459
		"public class E1 {\n" + 
2459
		"public class E1 {\n" +
2460
		" 	void foo() {\n" + 
2460
		" 	void foo() {\n" +
2461
		"	}\n" + 
2461
		"	}\n" +
2462
		" 	\n" + 
2462
		" 	\n" +
2463
		" 	void bar() {\n" + 
2463
		" 	void bar() {\n" +
2464
		"	}\n" + 
2464
		"	}\n" +
2465
		"}"
2465
		"}"
2466
	);
2466
	);
2467
}
2467
}
2468
public void testBug237453d() throws JavaModelException {
2468
public void testBug237453d() throws JavaModelException {
2469
	String source = 
2469
	String source =
2470
		"package test1;\n" + 
2470
		"package test1;\n" +
2471
		"\n" + 
2471
		"\n" +
2472
		"public class E1 {\n" + 
2472
		"public class E1 {\n" +
2473
		" 	void foo() {\n" + 
2473
		" 	void foo() {\n" +
2474
		"	}\n" + 
2474
		"	}\n" +
2475
		" 	\n" + 
2475
		" 	\n" +
2476
		"[#	\n" + 
2476
		"[#	\n" +
2477
		" #]	void bar() {\n" + 
2477
		" #]	void bar() {\n" +
2478
		"	}\n" + 
2478
		"	}\n" +
2479
		"}";
2479
		"}";
2480
	formatSource(source,
2480
	formatSource(source,
2481
		"package test1;\n" + 
2481
		"package test1;\n" +
2482
		"\n" + 
2482
		"\n" +
2483
		"public class E1 {\n" + 
2483
		"public class E1 {\n" +
2484
		" 	void foo() {\n" + 
2484
		" 	void foo() {\n" +
2485
		"	}\n" + 
2485
		"	}\n" +
2486
		" 	\n" + 
2486
		" 	\n" +
2487
		"	void bar() {\n" + 
2487
		"	void bar() {\n" +
2488
		"	}\n" + 
2488
		"	}\n" +
2489
		"}"
2489
		"}"
2490
	);
2490
	);
2491
}
2491
}
2492
public void testBug237453e() throws JavaModelException {
2492
public void testBug237453e() throws JavaModelException {
2493
	String source = 
2493
	String source =
2494
		"package test1;\n" + 
2494
		"package test1;\n" +
2495
		"\n" + 
2495
		"\n" +
2496
		"public class E1 {\n" + 
2496
		"public class E1 {\n" +
2497
		" 	void foo() {\n" + 
2497
		" 	void foo() {\n" +
2498
		"	}\n" + 
2498
		"	}\n" +
2499
		" 	\n" + 
2499
		" 	\n" +
2500
		"[#	\n" + 
2500
		"[#	\n" +
2501
		" 	#]void bar() {\n" + 
2501
		" 	#]void bar() {\n" +
2502
		"	}\n" + 
2502
		"	}\n" +
2503
		"}";
2503
		"}";
2504
	formatSource(source,
2504
	formatSource(source,
2505
		"package test1;\n" + 
2505
		"package test1;\n" +
2506
		"\n" + 
2506
		"\n" +
2507
		"public class E1 {\n" + 
2507
		"public class E1 {\n" +
2508
		" 	void foo() {\n" + 
2508
		" 	void foo() {\n" +
2509
		"	}\n" + 
2509
		"	}\n" +
2510
		" 	\n" + 
2510
		" 	\n" +
2511
		"	void bar() {\n" + 
2511
		"	void bar() {\n" +
2512
		"	}\n" + 
2512
		"	}\n" +
2513
		"}"
2513
		"}"
2514
	);
2514
	);
2515
}
2515
}
2516
public void testBug237453f() throws JavaModelException {
2516
public void testBug237453f() throws JavaModelException {
2517
	String source = 
2517
	String source =
2518
		"package test1;\n" + 
2518
		"package test1;\n" +
2519
		"\n" + 
2519
		"\n" +
2520
		"public class E1 {\n" + 
2520
		"public class E1 {\n" +
2521
		" 	void foo() {\n" + 
2521
		" 	void foo() {\n" +
2522
		"	}\n" + 
2522
		"	}\n" +
2523
		" 	\n" + 
2523
		" 	\n" +
2524
		"	\n" + 
2524
		"	\n" +
2525
		"[# #]	void bar() {\n" + 
2525
		"[# #]	void bar() {\n" +
2526
		"	}\n" + 
2526
		"	}\n" +
2527
		"}";
2527
		"}";
2528
	formatSource(source,
2528
	formatSource(source,
2529
		"package test1;\n" + 
2529
		"package test1;\n" +
2530
		"\n" + 
2530
		"\n" +
2531
		"public class E1 {\n" + 
2531
		"public class E1 {\n" +
2532
		" 	void foo() {\n" + 
2532
		" 	void foo() {\n" +
2533
		"	}\n" + 
2533
		"	}\n" +
2534
		" 	\n" + 
2534
		" 	\n" +
2535
		"	\n" + 
2535
		"	\n" +
2536
		"	void bar() {\n" + 
2536
		"	void bar() {\n" +
2537
		"	}\n" + 
2537
		"	}\n" +
2538
		"}"
2538
		"}"
2539
	);
2539
	);
2540
}
2540
}
2541
public void testBug237453g() throws JavaModelException {
2541
public void testBug237453g() throws JavaModelException {
2542
	String source = 
2542
	String source =
2543
		"package test1;\n" + 
2543
		"package test1;\n" +
2544
		"\n" + 
2544
		"\n" +
2545
		"public class E1 {\n" + 
2545
		"public class E1 {\n" +
2546
		" 	void foo() {\n" + 
2546
		" 	void foo() {\n" +
2547
		"	}\n" + 
2547
		"	}\n" +
2548
		" 	\n" + 
2548
		" 	\n" +
2549
		"	\n" + 
2549
		"	\n" +
2550
		"[# #] void bar() {\n" + 
2550
		"[# #] void bar() {\n" +
2551
		"	}\n" + 
2551
		"	}\n" +
2552
		"}";
2552
		"}";
2553
	formatSource(source,
2553
	formatSource(source,
2554
		"package test1;\n" + 
2554
		"package test1;\n" +
2555
		"\n" + 
2555
		"\n" +
2556
		"public class E1 {\n" + 
2556
		"public class E1 {\n" +
2557
		" 	void foo() {\n" + 
2557
		" 	void foo() {\n" +
2558
		"	}\n" + 
2558
		"	}\n" +
2559
		" 	\n" + 
2559
		" 	\n" +
2560
		"	\n" + 
2560
		"	\n" +
2561
		" void bar() {\n" + 
2561
		" void bar() {\n" +
2562
		"	}\n" + 
2562
		"	}\n" +
2563
		"}"
2563
		"}"
2564
	);
2564
	);
2565
}
2565
}
2566
public void testBug237453h() throws JavaModelException {
2566
public void testBug237453h() throws JavaModelException {
2567
	String source = 
2567
	String source =
2568
		"package test1;\n" + 
2568
		"package test1;\n" +
2569
		"\n" + 
2569
		"\n" +
2570
		"public class E1 {\n" + 
2570
		"public class E1 {\n" +
2571
		" 	void foo() {\n" + 
2571
		" 	void foo() {\n" +
2572
		"	}\n" + 
2572
		"	}\n" +
2573
		" 	\n" + 
2573
		" 	\n" +
2574
		"	\n" + 
2574
		"	\n" +
2575
		"[# 	#]void bar() {\n" + 
2575
		"[# 	#]void bar() {\n" +
2576
		"	}\n" + 
2576
		"	}\n" +
2577
		"}";
2577
		"}";
2578
	formatSource(source,
2578
	formatSource(source,
2579
		"package test1;\n" + 
2579
		"package test1;\n" +
2580
		"\n" + 
2580
		"\n" +
2581
		"public class E1 {\n" + 
2581
		"public class E1 {\n" +
2582
		" 	void foo() {\n" + 
2582
		" 	void foo() {\n" +
2583
		"	}\n" + 
2583
		"	}\n" +
2584
		" 	\n" + 
2584
		" 	\n" +
2585
		"	\n" + 
2585
		"	\n" +
2586
		"	void bar() {\n" + 
2586
		"	void bar() {\n" +
2587
		"	}\n" + 
2587
		"	}\n" +
2588
		"}"
2588
		"}"
2589
	);
2589
	);
2590
}
2590
}
2591
public void testBug237453i() throws JavaModelException {
2591
public void testBug237453i() throws JavaModelException {
2592
	String source = 
2592
	String source =
2593
		"package test1;\n" + 
2593
		"package test1;\n" +
2594
		"\n" + 
2594
		"\n" +
2595
		"public class E1 {\n" + 
2595
		"public class E1 {\n" +
2596
		" 	void foo() {\n" + 
2596
		" 	void foo() {\n" +
2597
		"	}\n" + 
2597
		"	}\n" +
2598
		" 	\n" + 
2598
		" 	\n" +
2599
		"	\n" + 
2599
		"	\n" +
2600
		"[#  #]void bar() {\n" + 
2600
		"[#  #]void bar() {\n" +
2601
		"	}\n" + 
2601
		"	}\n" +
2602
		"}";
2602
		"}";
2603
	formatSource(source,
2603
	formatSource(source,
2604
		"package test1;\n" + 
2604
		"package test1;\n" +
2605
		"\n" + 
2605
		"\n" +
2606
		"public class E1 {\n" + 
2606
		"public class E1 {\n" +
2607
		" 	void foo() {\n" + 
2607
		" 	void foo() {\n" +
2608
		"	}\n" + 
2608
		"	}\n" +
2609
		" 	\n" + 
2609
		" 	\n" +
2610
		"	\n" + 
2610
		"	\n" +
2611
		"	void bar() {\n" + 
2611
		"	void bar() {\n" +
2612
		"	}\n" + 
2612
		"	}\n" +
2613
		"}"
2613
		"}"
2614
	);
2614
	);
2615
}
2615
}
Lines 2657-2806 Link Here
2657
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=238210"
2657
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=238210"
2658
 */
2658
 */
2659
public void testBug238210() throws JavaModelException {
2659
public void testBug238210() throws JavaModelException {
2660
	String source = 
2660
	String source =
2661
		"/**\n" + 
2661
		"/**\n" +
2662
		" * LineCommentTestCase\n" + 
2662
		" * LineCommentTestCase\n" +
2663
		" * \n" + 
2663
		" * \n" +
2664
		" * Formatting this compilation unit with line comment enabled and comment line width set to 100 or\n" + 
2664
		" * Formatting this compilation unit with line comment enabled and comment line width set to 100 or\n" +
2665
		" * lower will result in both protected region comments to be wrapped although they do not contain\n" + 
2665
		" * lower will result in both protected region comments to be wrapped although they do not contain\n" +
2666
		" * any whitespace (excluding leading whitespace which should be / is being ignored altogether)\n" + 
2666
		" * any whitespace (excluding leading whitespace which should be / is being ignored altogether)\n" +
2667
		" * \n" + 
2667
		" * \n" +
2668
		" * @author Axel Faust, PRODYNA AG\n" + 
2668
		" * @author Axel Faust, PRODYNA AG\n" +
2669
		" */\n" + 
2669
		" */\n" +
2670
		"public class LineCommentTestCase {\n" + 
2670
		"public class LineCommentTestCase {\n" +
2671
		"\n" + 
2671
		"\n" +
2672
		"    public void someGeneratedMethod() {\n" + 
2672
		"    public void someGeneratedMethod() {\n" +
2673
		"        //protected-region-start_[id=_14_0_1_3dd20592_1202209856234_914658_24183_someGeneratedMethod]\n" + 
2673
		"        //protected-region-start_[id=_14_0_1_3dd20592_1202209856234_914658_24183_someGeneratedMethod]\n" +
2674
		"        // some manually written code\n" + 
2674
		"        // some manually written code\n" +
2675
		"        // protected-region-end_[id=_14_0_1_3dd20592_1202209856234_914658_24183_someGeneratedMethod]\n" + 
2675
		"        // protected-region-end_[id=_14_0_1_3dd20592_1202209856234_914658_24183_someGeneratedMethod]\n" +
2676
		"    }\n" + 
2676
		"    }\n" +
2677
		"}\n";
2677
		"}\n";
2678
	formatSource(source,
2678
	formatSource(source,
2679
		"/**\n" + 
2679
		"/**\n" +
2680
		" * LineCommentTestCase\n" + 
2680
		" * LineCommentTestCase\n" +
2681
		" * \n" + 
2681
		" * \n" +
2682
		" * Formatting this compilation unit with line comment enabled and comment line\n" + 
2682
		" * Formatting this compilation unit with line comment enabled and comment line\n" +
2683
		" * width set to 100 or lower will result in both protected region comments to be\n" + 
2683
		" * width set to 100 or lower will result in both protected region comments to be\n" +
2684
		" * wrapped although they do not contain any whitespace (excluding leading\n" + 
2684
		" * wrapped although they do not contain any whitespace (excluding leading\n" +
2685
		" * whitespace which should be / is being ignored altogether)\n" + 
2685
		" * whitespace which should be / is being ignored altogether)\n" +
2686
		" * \n" + 
2686
		" * \n" +
2687
		" * @author Axel Faust, PRODYNA AG\n" + 
2687
		" * @author Axel Faust, PRODYNA AG\n" +
2688
		" */\n" + 
2688
		" */\n" +
2689
		"public class LineCommentTestCase {\n" + 
2689
		"public class LineCommentTestCase {\n" +
2690
		"\n" + 
2690
		"\n" +
2691
		"	public void someGeneratedMethod() {\n" + 
2691
		"	public void someGeneratedMethod() {\n" +
2692
		"		// protected-region-start_[id=_14_0_1_3dd20592_1202209856234_914658_24183_someGeneratedMethod]\n" + 
2692
		"		// protected-region-start_[id=_14_0_1_3dd20592_1202209856234_914658_24183_someGeneratedMethod]\n" +
2693
		"		// some manually written code\n" + 
2693
		"		// some manually written code\n" +
2694
		"		// protected-region-end_[id=_14_0_1_3dd20592_1202209856234_914658_24183_someGeneratedMethod]\n" + 
2694
		"		// protected-region-end_[id=_14_0_1_3dd20592_1202209856234_914658_24183_someGeneratedMethod]\n" +
2695
		"	}\n" + 
2695
		"	}\n" +
2696
		"}\n"
2696
		"}\n"
2697
	);
2697
	);
2698
}
2698
}
2699
// possible side effects detected while running massive tests
2699
// possible side effects detected while running massive tests
2700
public void testBug238210_X01() throws JavaModelException {
2700
public void testBug238210_X01() throws JavaModelException {
2701
	String source = 
2701
	String source =
2702
		"package eclipse30;\n" + 
2702
		"package eclipse30;\n" +
2703
		"\n" + 
2703
		"\n" +
2704
		"public class X01 {\n" + 
2704
		"public class X01 {\n" +
2705
		"\n" + 
2705
		"\n" +
2706
		"	void foo() {\n" + 
2706
		"	void foo() {\n" +
2707
		"		\n" + 
2707
		"		\n" +
2708
		"		binding = new LocalVariableBinding(this, tb, modifiers, false); // argument decl, but local var  (where isArgument = false)\n" + 
2708
		"		binding = new LocalVariableBinding(this, tb, modifiers, false); // argument decl, but local var  (where isArgument = false)\n" +
2709
		"	}\n" + 
2709
		"	}\n" +
2710
		"\n" + 
2710
		"\n" +
2711
		"	public class LocalVariableBinding {\n" + 
2711
		"	public class LocalVariableBinding {\n" +
2712
		"\n" + 
2712
		"\n" +
2713
		"		public LocalVariableBinding(X01 x01, Object tb, Object modifiers,\n" + 
2713
		"		public LocalVariableBinding(X01 x01, Object tb, Object modifiers,\n" +
2714
		"				boolean b) {\n" + 
2714
		"				boolean b) {\n" +
2715
		"		}\n" + 
2715
		"		}\n" +
2716
		"\n" + 
2716
		"\n" +
2717
		"	}\n" + 
2717
		"	}\n" +
2718
		"\n" + 
2718
		"\n" +
2719
		"	Object modifiers;\n" + 
2719
		"	Object modifiers;\n" +
2720
		"	Object tb;\n" + 
2720
		"	Object tb;\n" +
2721
		"	LocalVariableBinding binding;\n" + 
2721
		"	LocalVariableBinding binding;\n" +
2722
		"}\n";
2722
		"}\n";
2723
	formatSource(source,
2723
	formatSource(source,
2724
		"package eclipse30;\n" + 
2724
		"package eclipse30;\n" +
2725
		"\n" + 
2725
		"\n" +
2726
		"public class X01 {\n" + 
2726
		"public class X01 {\n" +
2727
		"\n" + 
2727
		"\n" +
2728
		"	void foo() {\n" + 
2728
		"	void foo() {\n" +
2729
		"\n" + 
2729
		"\n" +
2730
		"		binding = new LocalVariableBinding(this, tb, modifiers, false); // argument\n" + 
2730
		"		binding = new LocalVariableBinding(this, tb, modifiers, false); // argument\n" +
2731
		"																		// decl,\n" + 
2731
		"																		// decl,\n" +
2732
		"																		// but\n" + 
2732
		"																		// but\n" +
2733
		"																		// local\n" + 
2733
		"																		// local\n" +
2734
		"																		// var\n" + 
2734
		"																		// var\n" +
2735
		"																		// (where\n" + 
2735
		"																		// (where\n" +
2736
		"																		// isArgument\n" + 
2736
		"																		// isArgument\n" +
2737
		"																		// =\n" + 
2737
		"																		// =\n" +
2738
		"																		// false)\n" + 
2738
		"																		// false)\n" +
2739
		"	}\n" + 
2739
		"	}\n" +
2740
		"\n" + 
2740
		"\n" +
2741
		"	public class LocalVariableBinding {\n" + 
2741
		"	public class LocalVariableBinding {\n" +
2742
		"\n" + 
2742
		"\n" +
2743
		"		public LocalVariableBinding(X01 x01, Object tb, Object modifiers,\n" + 
2743
		"		public LocalVariableBinding(X01 x01, Object tb, Object modifiers,\n" +
2744
		"				boolean b) {\n" + 
2744
		"				boolean b) {\n" +
2745
		"		}\n" + 
2745
		"		}\n" +
2746
		"\n" + 
2746
		"\n" +
2747
		"	}\n" + 
2747
		"	}\n" +
2748
		"\n" + 
2748
		"\n" +
2749
		"	Object modifiers;\n" + 
2749
		"	Object modifiers;\n" +
2750
		"	Object tb;\n" + 
2750
		"	Object tb;\n" +
2751
		"	LocalVariableBinding binding;\n" + 
2751
		"	LocalVariableBinding binding;\n" +
2752
		"}\n",
2752
		"}\n",
2753
		false /*do not formatting twice*/
2753
		false /*do not formatting twice*/
2754
	);
2754
	);
2755
}
2755
}
2756
public void testBug238210_X02() throws JavaModelException {
2756
public void testBug238210_X02() throws JavaModelException {
2757
	String source = 
2757
	String source =
2758
		"package eclipse30;\n" + 
2758
		"package eclipse30;\n" +
2759
		"\n" + 
2759
		"\n" +
2760
		"public class X02 {\n" + 
2760
		"public class X02 {\n" +
2761
		"	//private static short[] randomArray = {213, 231, 37, 85, 211, 29, 161, 175, 187, 3, 147, 246, 170, 30, 202, 183, 242, 47, 254, 189, 25, 248, 193, 2};\n" + 
2761
		"	//private static short[] randomArray = {213, 231, 37, 85, 211, 29, 161, 175, 187, 3, 147, 246, 170, 30, 202, 183, 242, 47, 254, 189, 25, 248, 193, 2};\n" +
2762
		"}\n";
2762
		"}\n";
2763
	formatSource(source,
2763
	formatSource(source,
2764
		"package eclipse30;\n" + 
2764
		"package eclipse30;\n" +
2765
		"\n" + 
2765
		"\n" +
2766
		"public class X02 {\n" + 
2766
		"public class X02 {\n" +
2767
		"	// private static short[] randomArray = {213, 231, 37, 85, 211, 29, 161,\n" + 
2767
		"	// private static short[] randomArray = {213, 231, 37, 85, 211, 29, 161,\n" +
2768
		"	// 175, 187, 3, 147, 246, 170, 30, 202, 183, 242, 47, 254, 189, 25, 248,\n" + 
2768
		"	// 175, 187, 3, 147, 246, 170, 30, 202, 183, 242, 47, 254, 189, 25, 248,\n" +
2769
		"	// 193, 2};\n" + 
2769
		"	// 193, 2};\n" +
2770
		"}\n"
2770
		"}\n"
2771
	);
2771
	);
2772
}
2772
}
2773
public void testBug238210_X03() throws JavaModelException {
2773
public void testBug238210_X03() throws JavaModelException {
2774
	String source = 
2774
	String source =
2775
		"package eclipse30;\n" + 
2775
		"package eclipse30;\n" +
2776
		"\n" + 
2776
		"\n" +
2777
		"public class X03 {\n" + 
2777
		"public class X03 {\n" +
2778
		"\n" + 
2778
		"\n" +
2779
		"	\n" + 
2779
		"	\n" +
2780
		"	/**\n" + 
2780
		"	/**\n" +
2781
		"	 * @see org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint#handleBreakpointEvent(com.sun.jdi.event.Event, org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget, org.eclipse.jdt.internal.debug.core.model.JDIThread)\n" + 
2781
		"	 * @see org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint#handleBreakpointEvent(com.sun.jdi.event.Event, org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget, org.eclipse.jdt.internal.debug.core.model.JDIThread)\n" +
2782
		"	 * \n" + 
2782
		"	 * \n" +
2783
		"	 * (From referenced JavaDoc:\n" + 
2783
		"	 * (From referenced JavaDoc:\n" +
2784
		"	 * 	Returns whethers the thread should be resumed\n" + 
2784
		"	 * 	Returns whethers the thread should be resumed\n" +
2785
		"	 */\n" + 
2785
		"	 */\n" +
2786
		"	void foo() {\n" + 
2786
		"	void foo() {\n" +
2787
		"	}\n" + 
2787
		"	}\n" +
2788
		"}\n";
2788
		"}\n";
2789
	formatSource(source,
2789
	formatSource(source,
2790
		"package eclipse30;\n" + 
2790
		"package eclipse30;\n" +
2791
		"\n" + 
2791
		"\n" +
2792
		"public class X03 {\n" + 
2792
		"public class X03 {\n" +
2793
		"\n" + 
2793
		"\n" +
2794
		"	/**\n" + 
2794
		"	/**\n" +
2795
		"	 * @see org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint#handleBreakpointEvent(com.sun.jdi.event.Event,\n" + 
2795
		"	 * @see org.eclipse.jdt.internal.debug.core.breakpoints.JavaBreakpoint#handleBreakpointEvent(com.sun.jdi.event.Event,\n" +
2796
		"	 *      org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget,\n" + 
2796
		"	 *      org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget,\n" +
2797
		"	 *      org.eclipse.jdt.internal.debug.core.model.JDIThread)\n" + 
2797
		"	 *      org.eclipse.jdt.internal.debug.core.model.JDIThread)\n" +
2798
		"	 * \n" + 
2798
		"	 * \n" +
2799
		"	 *      (From referenced JavaDoc: Returns whethers the thread should be\n" + 
2799
		"	 *      (From referenced JavaDoc: Returns whethers the thread should be\n" +
2800
		"	 *      resumed\n" + 
2800
		"	 *      resumed\n" +
2801
		"	 */\n" + 
2801
		"	 */\n" +
2802
		"	void foo() {\n" + 
2802
		"	void foo() {\n" +
2803
		"	}\n" + 
2803
		"	}\n" +
2804
		"}\n"
2804
		"}\n"
2805
	);
2805
	);
2806
}
2806
}
Lines 2811-2840 Link Here
2811
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=238853"
2811
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=238853"
2812
 */
2812
 */
2813
public void testBug238853() throws JavaModelException {
2813
public void testBug238853() throws JavaModelException {
2814
	String source = 
2814
	String source =
2815
		"public class Test {\n" + 
2815
		"public class Test {\n" +
2816
		"\n" + 
2816
		"\n" +
2817
		"/**\n" + 
2817
		"/**\n" +
2818
		" * This is a test comment. \n" + 
2818
		" * This is a test comment. \n" +
2819
		" * <p /> \n" + 
2819
		" * <p /> \n" +
2820
		" * Another comment. <br /> \n" + 
2820
		" * Another comment. <br /> \n" +
2821
		" * Another comment.\n" + 
2821
		" * Another comment.\n" +
2822
		" */\n" + 
2822
		" */\n" +
2823
		"public void testMethod1()\n" + 
2823
		"public void testMethod1()\n" +
2824
		"{\n" + 
2824
		"{\n" +
2825
		"}\n" + 
2825
		"}\n" +
2826
		"}\n";
2826
		"}\n";
2827
	formatSource(source,
2827
	formatSource(source,
2828
		"public class Test {\n" + 
2828
		"public class Test {\n" +
2829
		"\n" + 
2829
		"\n" +
2830
		"	/**\n" + 
2830
		"	/**\n" +
2831
		"	 * This is a test comment.\n" + 
2831
		"	 * This is a test comment.\n" +
2832
		"	 * <p />\n" + 
2832
		"	 * <p />\n" +
2833
		"	 * Another comment. <br />\n" + 
2833
		"	 * Another comment. <br />\n" +
2834
		"	 * Another comment.\n" + 
2834
		"	 * Another comment.\n" +
2835
		"	 */\n" + 
2835
		"	 */\n" +
2836
		"	public void testMethod1() {\n" + 
2836
		"	public void testMethod1() {\n" +
2837
		"	}\n" + 
2837
		"	}\n" +
2838
		"}\n"
2838
		"}\n"
2839
	);
2839
	);
2840
}
2840
}
Lines 2845-2910 Link Here
2845
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=238920"
2845
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=238920"
2846
 */
2846
 */
2847
public void testBug238920() throws JavaModelException {
2847
public void testBug238920() throws JavaModelException {
2848
	String source = 
2848
	String source =
2849
		"public class X01 {\n" + 
2849
		"public class X01 {\n" +
2850
		"/**\n" + 
2850
		"/**\n" +
2851
		" * @category test\n" + 
2851
		" * @category test\n" +
2852
		" */\n" + 
2852
		" */\n" +
2853
		"void foo() {\n" + 
2853
		"void foo() {\n" +
2854
		"}\n" + 
2854
		"}\n" +
2855
		"}\n";
2855
		"}\n";
2856
	formatSource(source,
2856
	formatSource(source,
2857
		"public class X01 {\n" + 
2857
		"public class X01 {\n" +
2858
		"	/**\n" + 
2858
		"	/**\n" +
2859
		"	 * @category test\n" + 
2859
		"	 * @category test\n" +
2860
		"	 */\n" + 
2860
		"	 */\n" +
2861
		"	void foo() {\n" + 
2861
		"	void foo() {\n" +
2862
		"	}\n" + 
2862
		"	}\n" +
2863
		"}\n"
2863
		"}\n"
2864
	);
2864
	);
2865
}
2865
}
2866
public void testBug238920b() throws JavaModelException {
2866
public void testBug238920b() throws JavaModelException {
2867
	String source = 
2867
	String source =
2868
		"public class X02 {\n" + 
2868
		"public class X02 {\n" +
2869
		"/**\n" + 
2869
		"/**\n" +
2870
		" * Test for bug 238920\n" + 
2870
		" * Test for bug 238920\n" +
2871
		" * @category test\n" + 
2871
		" * @category test\n" +
2872
		" */\n" + 
2872
		" */\n" +
2873
		"void foo() {\n" + 
2873
		"void foo() {\n" +
2874
		"}\n" + 
2874
		"}\n" +
2875
		"}\n";
2875
		"}\n";
2876
	formatSource(source,
2876
	formatSource(source,
2877
		"public class X02 {\n" + 
2877
		"public class X02 {\n" +
2878
		"	/**\n" + 
2878
		"	/**\n" +
2879
		"	 * Test for bug 238920\n" + 
2879
		"	 * Test for bug 238920\n" +
2880
		"	 * \n" + 
2880
		"	 * \n" +
2881
		"	 * @category test\n" + 
2881
		"	 * @category test\n" +
2882
		"	 */\n" + 
2882
		"	 */\n" +
2883
		"	void foo() {\n" + 
2883
		"	void foo() {\n" +
2884
		"	}\n" + 
2884
		"	}\n" +
2885
		"}\n"
2885
		"}\n"
2886
	);
2886
	);
2887
}
2887
}
2888
public void testBug238920c() throws JavaModelException {
2888
public void testBug238920c() throws JavaModelException {
2889
	String source = 
2889
	String source =
2890
		"public class X03 {\n" + 
2890
		"public class X03 {\n" +
2891
		"/**\n" + 
2891
		"/**\n" +
2892
		" * @category test\n" + 
2892
		" * @category test\n" +
2893
		" * @return zero\n" + 
2893
		" * @return zero\n" +
2894
		" */\n" + 
2894
		" */\n" +
2895
		"int foo() {\n" + 
2895
		"int foo() {\n" +
2896
		"	return 0;\n" + 
2896
		"	return 0;\n" +
2897
		"}\n" + 
2897
		"}\n" +
2898
		"}\n";
2898
		"}\n";
2899
	formatSource(source,
2899
	formatSource(source,
2900
		"public class X03 {\n" + 
2900
		"public class X03 {\n" +
2901
		"	/**\n" + 
2901
		"	/**\n" +
2902
		"	 * @category test\n" + 
2902
		"	 * @category test\n" +
2903
		"	 * @return zero\n" + 
2903
		"	 * @return zero\n" +
2904
		"	 */\n" + 
2904
		"	 */\n" +
2905
		"	int foo() {\n" + 
2905
		"	int foo() {\n" +
2906
		"		return 0;\n" + 
2906
		"		return 0;\n" +
2907
		"	}\n" + 
2907
		"	}\n" +
2908
		"}\n"
2908
		"}\n"
2909
	);
2909
	);
2910
}
2910
}
Lines 2915-3242 Link Here
2915
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=239130"
2915
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=239130"
2916
 */
2916
 */
2917
public void testBug239130_default() throws JavaModelException {
2917
public void testBug239130_default() throws JavaModelException {
2918
	String source = 
2918
	String source =
2919
		"public class X {\n" + 
2919
		"public class X {\n" +
2920
		"\n" + 
2920
		"\n" +
2921
		"	/**\n" + 
2921
		"	/**\n" +
2922
		"	 * @see java.lang.String\n" + 
2922
		"	 * @see java.lang.String\n" +
2923
		"	 * \n" + 
2923
		"	 * \n" +
2924
		"	 * Formatter should keep empty line above\n" + 
2924
		"	 * Formatter should keep empty line above\n" +
2925
		"	 */\n" + 
2925
		"	 */\n" +
2926
		"	void foo() {\n" + 
2926
		"	void foo() {\n" +
2927
		"	}\n" + 
2927
		"	}\n" +
2928
		"}\n";
2928
		"}\n";
2929
	formatSource(source,
2929
	formatSource(source,
2930
		"public class X {\n" + 
2930
		"public class X {\n" +
2931
		"\n" + 
2931
		"\n" +
2932
		"	/**\n" + 
2932
		"	/**\n" +
2933
		"	 * @see java.lang.String\n" + 
2933
		"	 * @see java.lang.String\n" +
2934
		"	 * \n" + 
2934
		"	 * \n" +
2935
		"	 *      Formatter should keep empty line above\n" + 
2935
		"	 *      Formatter should keep empty line above\n" +
2936
		"	 */\n" + 
2936
		"	 */\n" +
2937
		"	void foo() {\n" + 
2937
		"	void foo() {\n" +
2938
		"	}\n" + 
2938
		"	}\n" +
2939
		"}\n"
2939
		"}\n"
2940
	);
2940
	);
2941
}
2941
}
2942
public void testBug239130_clearBlankLines() throws JavaModelException {
2942
public void testBug239130_clearBlankLines() throws JavaModelException {
2943
	this.formatterPrefs.comment_clear_blank_lines_in_javadoc_comment = true;
2943
	this.formatterPrefs.comment_clear_blank_lines_in_javadoc_comment = true;
2944
	String source = 
2944
	String source =
2945
		"public class X {\n" + 
2945
		"public class X {\n" +
2946
		"\n" + 
2946
		"\n" +
2947
		"	/**\n" + 
2947
		"	/**\n" +
2948
		"	 * @see java.lang.String\n" + 
2948
		"	 * @see java.lang.String\n" +
2949
		"	 * \n" + 
2949
		"	 * \n" +
2950
		"	 * Formatter should keep empty line above\n" + 
2950
		"	 * Formatter should keep empty line above\n" +
2951
		"	 */\n" + 
2951
		"	 */\n" +
2952
		"	void foo() {\n" + 
2952
		"	void foo() {\n" +
2953
		"	}\n" + 
2953
		"	}\n" +
2954
		"}\n";
2954
		"}\n";
2955
	formatSource(source,
2955
	formatSource(source,
2956
		"public class X {\n" + 
2956
		"public class X {\n" +
2957
		"\n" + 
2957
		"\n" +
2958
		"	/**\n" + 
2958
		"	/**\n" +
2959
		"	 * @see java.lang.String Formatter should keep empty line above\n" + 
2959
		"	 * @see java.lang.String Formatter should keep empty line above\n" +
2960
		"	 */\n" + 
2960
		"	 */\n" +
2961
		"	void foo() {\n" + 
2961
		"	void foo() {\n" +
2962
		"	}\n" + 
2962
		"	}\n" +
2963
		"}\n"
2963
		"}\n"
2964
	);
2964
	);
2965
}
2965
}
2966
public void testBug239130_preserveLineBreaks() throws JavaModelException {
2966
public void testBug239130_preserveLineBreaks() throws JavaModelException {
2967
	this.formatterPrefs.join_lines_in_comments = false;
2967
	this.formatterPrefs.join_lines_in_comments = false;
2968
	String source = 
2968
	String source =
2969
		"public class X {\n" + 
2969
		"public class X {\n" +
2970
		"\n" + 
2970
		"\n" +
2971
		"	/**\n" + 
2971
		"	/**\n" +
2972
		"	 * @see java.lang.String\n" + 
2972
		"	 * @see java.lang.String\n" +
2973
		"	 * \n" + 
2973
		"	 * \n" +
2974
		"	 * Formatter should keep empty line above\n" + 
2974
		"	 * Formatter should keep empty line above\n" +
2975
		"	 */\n" + 
2975
		"	 */\n" +
2976
		"	void foo() {\n" + 
2976
		"	void foo() {\n" +
2977
		"	}\n" + 
2977
		"	}\n" +
2978
		"}\n";
2978
		"}\n";
2979
	formatSource(source,
2979
	formatSource(source,
2980
		"public class X {\n" + 
2980
		"public class X {\n" +
2981
		"\n" + 
2981
		"\n" +
2982
		"	/**\n" + 
2982
		"	/**\n" +
2983
		"	 * @see java.lang.String\n" + 
2983
		"	 * @see java.lang.String\n" +
2984
		"	 * \n" + 
2984
		"	 * \n" +
2985
		"	 *      Formatter should keep empty line above\n" + 
2985
		"	 *      Formatter should keep empty line above\n" +
2986
		"	 */\n" + 
2986
		"	 */\n" +
2987
		"	void foo() {\n" + 
2987
		"	void foo() {\n" +
2988
		"	}\n" + 
2988
		"	}\n" +
2989
		"}\n"
2989
		"}\n"
2990
	);
2990
	);
2991
}
2991
}
2992
public void testBug239130_clearBlankLines_preserveLineBreaks() throws JavaModelException {
2992
public void testBug239130_clearBlankLines_preserveLineBreaks() throws JavaModelException {
2993
	this.formatterPrefs.join_lines_in_comments = false;
2993
	this.formatterPrefs.join_lines_in_comments = false;
2994
	this.formatterPrefs.comment_clear_blank_lines_in_javadoc_comment = true;
2994
	this.formatterPrefs.comment_clear_blank_lines_in_javadoc_comment = true;
2995
	String source = 
2995
	String source =
2996
		"public class X {\n" + 
2996
		"public class X {\n" +
2997
		"\n" + 
2997
		"\n" +
2998
		"	/**\n" + 
2998
		"	/**\n" +
2999
		"	 * @see java.lang.String\n" + 
2999
		"	 * @see java.lang.String\n" +
3000
		"	 * \n" + 
3000
		"	 * \n" +
3001
		"	 * Formatter should keep empty line above\n" + 
3001
		"	 * Formatter should keep empty line above\n" +
3002
		"	 */\n" + 
3002
		"	 */\n" +
3003
		"	void foo() {\n" + 
3003
		"	void foo() {\n" +
3004
		"	}\n" + 
3004
		"	}\n" +
3005
		"}\n";
3005
		"}\n";
3006
	formatSource(source,
3006
	formatSource(source,
3007
		"public class X {\n" + 
3007
		"public class X {\n" +
3008
		"\n" + 
3008
		"\n" +
3009
		"	/**\n" + 
3009
		"	/**\n" +
3010
		"	 * @see java.lang.String\n" + 
3010
		"	 * @see java.lang.String\n" +
3011
		"	 *      Formatter should keep empty line above\n" + 
3011
		"	 *      Formatter should keep empty line above\n" +
3012
		"	 */\n" + 
3012
		"	 */\n" +
3013
		"	void foo() {\n" + 
3013
		"	void foo() {\n" +
3014
		"	}\n" + 
3014
		"	}\n" +
3015
		"}\n"
3015
		"}\n"
3016
	);
3016
	);
3017
}
3017
}
3018
// duplicate bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=196124
3018
// duplicate bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=196124
3019
public void testBug239130_196124_default() throws JavaModelException {
3019
public void testBug239130_196124_default() throws JavaModelException {
3020
	String source = 
3020
	String source =
3021
		"public class X {\n" + 
3021
		"public class X {\n" +
3022
		"\n" + 
3022
		"\n" +
3023
		"        /**\n" + 
3023
		"        /**\n" +
3024
		"         * The foo method.\n" + 
3024
		"         * The foo method.\n" +
3025
		"         * foo is a substitute for bar.\n" + 
3025
		"         * foo is a substitute for bar.\n" +
3026
		"         * \n" + 
3026
		"         * \n" +
3027
		"         * @param param1 The first parameter\n" + 
3027
		"         * @param param1 The first parameter\n" +
3028
		"         * @param param2\n" + 
3028
		"         * @param param2\n" +
3029
		"         *            The second parameter.\n" + 
3029
		"         *            The second parameter.\n" +
3030
		"         *            If <b>null</b>the first parameter is used\n" + 
3030
		"         *            If <b>null</b>the first parameter is used\n" +
3031
		"         */\n" + 
3031
		"         */\n" +
3032
		"        public void foo(Object param1, Object param2) {\n" + 
3032
		"        public void foo(Object param1, Object param2) {\n" +
3033
		"        }\n" + 
3033
		"        }\n" +
3034
		"}\n";
3034
		"}\n";
3035
	formatSource(source,
3035
	formatSource(source,
3036
		"public class X {\n" + 
3036
		"public class X {\n" +
3037
		"\n" + 
3037
		"\n" +
3038
		"	/**\n" + 
3038
		"	/**\n" +
3039
		"	 * The foo method. foo is a substitute for bar.\n" + 
3039
		"	 * The foo method. foo is a substitute for bar.\n" +
3040
		"	 * \n" + 
3040
		"	 * \n" +
3041
		"	 * @param param1\n" + 
3041
		"	 * @param param1\n" +
3042
		"	 *            The first parameter\n" + 
3042
		"	 *            The first parameter\n" +
3043
		"	 * @param param2\n" + 
3043
		"	 * @param param2\n" +
3044
		"	 *            The second parameter. If <b>null</b>the first parameter is\n" + 
3044
		"	 *            The second parameter. If <b>null</b>the first parameter is\n" +
3045
		"	 *            used\n" + 
3045
		"	 *            used\n" +
3046
		"	 */\n" + 
3046
		"	 */\n" +
3047
		"	public void foo(Object param1, Object param2) {\n" + 
3047
		"	public void foo(Object param1, Object param2) {\n" +
3048
		"	}\n" + 
3048
		"	}\n" +
3049
		"}\n"
3049
		"}\n"
3050
	);
3050
	);
3051
}
3051
}
3052
public void testBug239130_196124() throws JavaModelException {
3052
public void testBug239130_196124() throws JavaModelException {
3053
	this.formatterPrefs.join_lines_in_comments = false;
3053
	this.formatterPrefs.join_lines_in_comments = false;
3054
	String source = 
3054
	String source =
3055
		"public class X {\n" + 
3055
		"public class X {\n" +
3056
		"\n" + 
3056
		"\n" +
3057
		"        /**\n" + 
3057
		"        /**\n" +
3058
		"         * The foo method.\n" + 
3058
		"         * The foo method.\n" +
3059
		"         * foo is a substitute for bar.\n" + 
3059
		"         * foo is a substitute for bar.\n" +
3060
		"         * \n" + 
3060
		"         * \n" +
3061
		"         * @param param1 The first parameter\n" + 
3061
		"         * @param param1 The first parameter\n" +
3062
		"         * @param param2\n" + 
3062
		"         * @param param2\n" +
3063
		"         *            The second parameter.\n" + 
3063
		"         *            The second parameter.\n" +
3064
		"         *            If <b>null</b>the first parameter is used\n" + 
3064
		"         *            If <b>null</b>the first parameter is used\n" +
3065
		"         */\n" + 
3065
		"         */\n" +
3066
		"        public void foo(Object param1, Object param2) {\n" + 
3066
		"        public void foo(Object param1, Object param2) {\n" +
3067
		"        }\n" + 
3067
		"        }\n" +
3068
		"}\n";
3068
		"}\n";
3069
	formatSource(source,
3069
	formatSource(source,
3070
		"public class X {\n" + 
3070
		"public class X {\n" +
3071
		"\n" + 
3071
		"\n" +
3072
		"	/**\n" + 
3072
		"	/**\n" +
3073
		"	 * The foo method.\n" +
3073
		"	 * The foo method.\n" +
3074
		"	 * foo is a substitute for bar.\n" + 
3074
		"	 * foo is a substitute for bar.\n" +
3075
		"	 * \n" + 
3075
		"	 * \n" +
3076
		"	 * @param param1\n" + 
3076
		"	 * @param param1\n" +
3077
		"	 *            The first parameter\n" + 
3077
		"	 *            The first parameter\n" +
3078
		"	 * @param param2\n" + 
3078
		"	 * @param param2\n" +
3079
		"	 *            The second parameter.\n" + 
3079
		"	 *            The second parameter.\n" +
3080
		"	 *            If <b>null</b>the first parameter is used\n" + 
3080
		"	 *            If <b>null</b>the first parameter is used\n" +
3081
		"	 */\n" + 
3081
		"	 */\n" +
3082
		"	public void foo(Object param1, Object param2) {\n" + 
3082
		"	public void foo(Object param1, Object param2) {\n" +
3083
		"	}\n" + 
3083
		"	}\n" +
3084
		"}\n"
3084
		"}\n"
3085
	);
3085
	);
3086
}
3086
}
3087
// duplicate bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=96696
3087
// duplicate bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=96696
3088
public void testBug239130_96696_block_default() throws JavaModelException {
3088
public void testBug239130_96696_block_default() throws JavaModelException {
3089
	String source = 
3089
	String source =
3090
		"public class Test {\n" + 
3090
		"public class Test {\n" +
3091
		"\n" + 
3091
		"\n" +
3092
		"	/*\n" + 
3092
		"	/*\n" +
3093
		"	 * Conceptually, all viewers perform two primary tasks:\n" + 
3093
		"	 * Conceptually, all viewers perform two primary tasks:\n" +
3094
		"	 * \n" + 
3094
		"	 * \n" +
3095
		"	 * - They help adapt your domain objects into viewable entities\n" + 
3095
		"	 * - They help adapt your domain objects into viewable entities\n" +
3096
		"	 * \n" + 
3096
		"	 * \n" +
3097
		"	 * - They provide notifications when the viewable entities are selected or\n" + 
3097
		"	 * - They provide notifications when the viewable entities are selected or\n" +
3098
		"	 * changed through the UI\n" + 
3098
		"	 * changed through the UI\n" +
3099
		"	 */\n" + 
3099
		"	 */\n" +
3100
		"	public void foo() {\n" + 
3100
		"	public void foo() {\n" +
3101
		"	}\n" + 
3101
		"	}\n" +
3102
		"}\n";
3102
		"}\n";
3103
	formatSource(source, source);
3103
	formatSource(source, source);
3104
}
3104
}
3105
public void testBug239130_96696_block_clearBlankLines() throws JavaModelException {
3105
public void testBug239130_96696_block_clearBlankLines() throws JavaModelException {
3106
	this.formatterPrefs.join_wrapped_lines = false;
3106
	this.formatterPrefs.join_wrapped_lines = false;
3107
	this.formatterPrefs.comment_clear_blank_lines_in_block_comment = true;
3107
	this.formatterPrefs.comment_clear_blank_lines_in_block_comment = true;
3108
	String source = 
3108
	String source =
3109
		"public class Test {\n" + 
3109
		"public class Test {\n" +
3110
		"\n" + 
3110
		"\n" +
3111
		"	/*\n" + 
3111
		"	/*\n" +
3112
		"	 * Conceptually, all viewers perform two primary tasks:\n" + 
3112
		"	 * Conceptually, all viewers perform two primary tasks:\n" +
3113
		"	 * \n" + 
3113
		"	 * \n" +
3114
		"	 * - They help adapt your domain objects into viewable entities\n" + 
3114
		"	 * - They help adapt your domain objects into viewable entities\n" +
3115
		"	 * \n" + 
3115
		"	 * \n" +
3116
		"	 * - They provide notifications when the viewable entities are selected or\n" + 
3116
		"	 * - They provide notifications when the viewable entities are selected or\n" +
3117
		"	 * changed through the UI\n" + 
3117
		"	 * changed through the UI\n" +
3118
		"	 */\n" + 
3118
		"	 */\n" +
3119
		"	public void foo() {\n" + 
3119
		"	public void foo() {\n" +
3120
		"	}\n" + 
3120
		"	}\n" +
3121
		"}\n";
3121
		"}\n";
3122
	formatSource(source,
3122
	formatSource(source,
3123
		"public class Test {\n" + 
3123
		"public class Test {\n" +
3124
		"\n" + 
3124
		"\n" +
3125
		"	/*\n" + 
3125
		"	/*\n" +
3126
		"	 * Conceptually, all viewers perform two primary tasks: - They help adapt\n" + 
3126
		"	 * Conceptually, all viewers perform two primary tasks: - They help adapt\n" +
3127
		"	 * your domain objects into viewable entities - They provide notifications\n" + 
3127
		"	 * your domain objects into viewable entities - They provide notifications\n" +
3128
		"	 * when the viewable entities are selected or changed through the UI\n" + 
3128
		"	 * when the viewable entities are selected or changed through the UI\n" +
3129
		"	 */\n" + 
3129
		"	 */\n" +
3130
		"	public void foo() {\n" + 
3130
		"	public void foo() {\n" +
3131
		"	}\n" + 
3131
		"	}\n" +
3132
		"}\n"
3132
		"}\n"
3133
	);
3133
	);
3134
}
3134
}
3135
public void testBug239130_96696_block_clearBlankLines_preserveLineBreaks() throws JavaModelException {
3135
public void testBug239130_96696_block_clearBlankLines_preserveLineBreaks() throws JavaModelException {
3136
	this.formatterPrefs.join_lines_in_comments = false;
3136
	this.formatterPrefs.join_lines_in_comments = false;
3137
	this.formatterPrefs.comment_clear_blank_lines_in_block_comment = true;
3137
	this.formatterPrefs.comment_clear_blank_lines_in_block_comment = true;
3138
	String source = 
3138
	String source =
3139
		"public class Test {\n" + 
3139
		"public class Test {\n" +
3140
		"\n" + 
3140
		"\n" +
3141
		"	/*\n" + 
3141
		"	/*\n" +
3142
		"	 * Conceptually, all viewers perform two primary tasks:\n" + 
3142
		"	 * Conceptually, all viewers perform two primary tasks:\n" +
3143
		"	 * \n" + 
3143
		"	 * \n" +
3144
		"	 * - They help adapt your domain objects into viewable entities\n" + 
3144
		"	 * - They help adapt your domain objects into viewable entities\n" +
3145
		"	 * \n" + 
3145
		"	 * \n" +
3146
		"	 * - They provide notifications when the viewable entities are selected or\n" + 
3146
		"	 * - They provide notifications when the viewable entities are selected or\n" +
3147
		"	 * changed through the UI\n" + 
3147
		"	 * changed through the UI\n" +
3148
		"	 */\n" + 
3148
		"	 */\n" +
3149
		"	public void foo() {\n" + 
3149
		"	public void foo() {\n" +
3150
		"	}\n" + 
3150
		"	}\n" +
3151
		"}\n";
3151
		"}\n";
3152
	formatSource(source,
3152
	formatSource(source,
3153
		"public class Test {\n" + 
3153
		"public class Test {\n" +
3154
		"\n" + 
3154
		"\n" +
3155
		"	/*\n" + 
3155
		"	/*\n" +
3156
		"	 * Conceptually, all viewers perform two primary tasks:\n" + 
3156
		"	 * Conceptually, all viewers perform two primary tasks:\n" +
3157
		"	 * - They help adapt your domain objects into viewable entities\n" + 
3157
		"	 * - They help adapt your domain objects into viewable entities\n" +
3158
		"	 * - They provide notifications when the viewable entities are selected or\n" + 
3158
		"	 * - They provide notifications when the viewable entities are selected or\n" +
3159
		"	 * changed through the UI\n" + 
3159
		"	 * changed through the UI\n" +
3160
		"	 */\n" + 
3160
		"	 */\n" +
3161
		"	public void foo() {\n" + 
3161
		"	public void foo() {\n" +
3162
		"	}\n" + 
3162
		"	}\n" +
3163
		"}\n"
3163
		"}\n"
3164
	);
3164
	);
3165
}
3165
}
3166
public void testBug239130_96696_javadoc_default() throws JavaModelException {
3166
public void testBug239130_96696_javadoc_default() throws JavaModelException {
3167
	String source = 
3167
	String source =
3168
		"public class Test {\n" + 
3168
		"public class Test {\n" +
3169
		"\n" + 
3169
		"\n" +
3170
		"	/**\n" + 
3170
		"	/**\n" +
3171
		"	 * Conceptually, all viewers perform two primary tasks:\n" + 
3171
		"	 * Conceptually, all viewers perform two primary tasks:\n" +
3172
		"	 * \n" + 
3172
		"	 * \n" +
3173
		"	 * - They help adapt your domain objects into viewable entities\n" + 
3173
		"	 * - They help adapt your domain objects into viewable entities\n" +
3174
		"	 * \n" + 
3174
		"	 * \n" +
3175
		"	 * - They provide notifications when the viewable entities are selected or\n" + 
3175
		"	 * - They provide notifications when the viewable entities are selected or\n" +
3176
		"	 * changed through the UI\n" + 
3176
		"	 * changed through the UI\n" +
3177
		"	 */\n" + 
3177
		"	 */\n" +
3178
		"	public void foo() {\n" + 
3178
		"	public void foo() {\n" +
3179
		"	}\n" + 
3179
		"	}\n" +
3180
		"}\n";
3180
		"}\n";
3181
	formatSource(source, source);
3181
	formatSource(source, source);
3182
}
3182
}
3183
public void testBug239130_96696_javadoc_clearBlankLines() throws JavaModelException {
3183
public void testBug239130_96696_javadoc_clearBlankLines() throws JavaModelException {
3184
	this.formatterPrefs.comment_clear_blank_lines_in_javadoc_comment = true;
3184
	this.formatterPrefs.comment_clear_blank_lines_in_javadoc_comment = true;
3185
	String source = 
3185
	String source =
3186
		"public class Test {\n" + 
3186
		"public class Test {\n" +
3187
		"\n" + 
3187
		"\n" +
3188
		"	/**\n" + 
3188
		"	/**\n" +
3189
		"	 * Conceptually, all viewers perform two primary tasks:\n" + 
3189
		"	 * Conceptually, all viewers perform two primary tasks:\n" +
3190
		"	 * \n" + 
3190
		"	 * \n" +
3191
		"	 * - They help adapt your domain objects into viewable entities\n" + 
3191
		"	 * - They help adapt your domain objects into viewable entities\n" +
3192
		"	 * \n" + 
3192
		"	 * \n" +
3193
		"	 * - They provide notifications when the viewable entities are selected or\n" + 
3193
		"	 * - They provide notifications when the viewable entities are selected or\n" +
3194
		"	 * changed through the UI\n" + 
3194
		"	 * changed through the UI\n" +
3195
		"	 */\n" + 
3195
		"	 */\n" +
3196
		"	public void foo() {\n" + 
3196
		"	public void foo() {\n" +
3197
		"	}\n" + 
3197
		"	}\n" +
3198
		"}\n";
3198
		"}\n";
3199
	formatSource(source,
3199
	formatSource(source,
3200
		"public class Test {\n" + 
3200
		"public class Test {\n" +
3201
		"\n" + 
3201
		"\n" +
3202
		"	/**\n" + 
3202
		"	/**\n" +
3203
		"	 * Conceptually, all viewers perform two primary tasks: - They help adapt\n" + 
3203
		"	 * Conceptually, all viewers perform two primary tasks: - They help adapt\n" +
3204
		"	 * your domain objects into viewable entities - They provide notifications\n" + 
3204
		"	 * your domain objects into viewable entities - They provide notifications\n" +
3205
		"	 * when the viewable entities are selected or changed through the UI\n" + 
3205
		"	 * when the viewable entities are selected or changed through the UI\n" +
3206
		"	 */\n" + 
3206
		"	 */\n" +
3207
		"	public void foo() {\n" + 
3207
		"	public void foo() {\n" +
3208
		"	}\n" + 
3208
		"	}\n" +
3209
		"}\n"
3209
		"}\n"
3210
	);
3210
	);
3211
}
3211
}
3212
public void testBug239130_96696_javadoc_clearBlankLines_preserveLineBreaks() throws JavaModelException {
3212
public void testBug239130_96696_javadoc_clearBlankLines_preserveLineBreaks() throws JavaModelException {
3213
	this.formatterPrefs.join_lines_in_comments = false;
3213
	this.formatterPrefs.join_lines_in_comments = false;
3214
	this.formatterPrefs.comment_clear_blank_lines_in_javadoc_comment = true;
3214
	this.formatterPrefs.comment_clear_blank_lines_in_javadoc_comment = true;
3215
	String source = 
3215
	String source =
3216
		"public class Test {\n" + 
3216
		"public class Test {\n" +
3217
		"\n" + 
3217
		"\n" +
3218
		"	/**\n" + 
3218
		"	/**\n" +
3219
		"	 * Conceptually, all viewers perform two primary tasks:\n" + 
3219
		"	 * Conceptually, all viewers perform two primary tasks:\n" +
3220
		"	 * \n" + 
3220
		"	 * \n" +
3221
		"	 * - They help adapt your domain objects into viewable entities\n" + 
3221
		"	 * - They help adapt your domain objects into viewable entities\n" +
3222
		"	 * \n" + 
3222
		"	 * \n" +
3223
		"	 * - They provide notifications when the viewable entities are selected or\n" + 
3223
		"	 * - They provide notifications when the viewable entities are selected or\n" +
3224
		"	 * changed through the UI\n" + 
3224
		"	 * changed through the UI\n" +
3225
		"	 */\n" + 
3225
		"	 */\n" +
3226
		"	public void foo() {\n" + 
3226
		"	public void foo() {\n" +
3227
		"	}\n" + 
3227
		"	}\n" +
3228
		"}\n";
3228
		"}\n";
3229
	formatSource(source,
3229
	formatSource(source,
3230
		"public class Test {\n" + 
3230
		"public class Test {\n" +
3231
		"\n" + 
3231
		"\n" +
3232
		"	/**\n" + 
3232
		"	/**\n" +
3233
		"	 * Conceptually, all viewers perform two primary tasks:\n" + 
3233
		"	 * Conceptually, all viewers perform two primary tasks:\n" +
3234
		"	 * - They help adapt your domain objects into viewable entities\n" + 
3234
		"	 * - They help adapt your domain objects into viewable entities\n" +
3235
		"	 * - They provide notifications when the viewable entities are selected or\n" + 
3235
		"	 * - They provide notifications when the viewable entities are selected or\n" +
3236
		"	 * changed through the UI\n" + 
3236
		"	 * changed through the UI\n" +
3237
		"	 */\n" + 
3237
		"	 */\n" +
3238
		"	public void foo() {\n" + 
3238
		"	public void foo() {\n" +
3239
		"	}\n" + 
3239
		"	}\n" +
3240
		"}\n"
3240
		"}\n"
3241
	);
3241
	);
3242
}
3242
}
Lines 3247-3329 Link Here
3247
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=239719"
3247
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=239719"
3248
 */
3248
 */
3249
public void testBug239719() throws JavaModelException {
3249
public void testBug239719() throws JavaModelException {
3250
	String source = 
3250
	String source =
3251
		"/**\n" + 
3251
		"/**\n" +
3252
		" * <pre>\n" + 
3252
		" * <pre>\n" +
3253
		" *  public class Test implements Runnable\n" + 
3253
		" *  public class Test implements Runnable\n" +
3254
		" *  {\n" + 
3254
		" *  {\n" +
3255
		" *    @Override\n" + 
3255
		" *    @Override\n" +
3256
		" *    public void run()\n" + 
3256
		" *    public void run()\n" +
3257
		" *    { \n" + 
3257
		" *    { \n" +
3258
		" *      // Hello really bad Ganymede formatter !!!\n" + 
3258
		" *      // Hello really bad Ganymede formatter !!!\n" +
3259
		" *      // Shit happens when somebody tries to change a running system\n" + 
3259
		" *      // Shit happens when somebody tries to change a running system\n" +
3260
		" *      System.out.println(\"Press Shift+Ctrl+F to format\");\n" + 
3260
		" *      System.out.println(\"Press Shift+Ctrl+F to format\");\n" +
3261
		" *    }\n" + 
3261
		" *    }\n" +
3262
		" *  }</pre>\n" + 
3262
		" *  }</pre>\n" +
3263
		" */\n" + 
3263
		" */\n" +
3264
		" public class Test \n" + 
3264
		" public class Test \n" +
3265
		" {\n" + 
3265
		" {\n" +
3266
		" }\n";
3266
		" }\n";
3267
	formatSource(source,
3267
	formatSource(source,
3268
		"/**\n" + 
3268
		"/**\n" +
3269
		" * <pre>\n" + 
3269
		" * <pre>\n" +
3270
		" * public class Test implements Runnable {\n" + 
3270
		" * public class Test implements Runnable {\n" +
3271
		" * 	&#064;Override\n" + 
3271
		" * 	&#064;Override\n" +
3272
		" * 	public void run() {\n" + 
3272
		" * 	public void run() {\n" +
3273
		" * 		// Hello really bad Ganymede formatter !!!\n" + 
3273
		" * 		// Hello really bad Ganymede formatter !!!\n" +
3274
		" * 		// Shit happens when somebody tries to change a running system\n" + 
3274
		" * 		// Shit happens when somebody tries to change a running system\n" +
3275
		" * 		System.out.println(&quot;Press Shift+Ctrl+F to format&quot;);\n" + 
3275
		" * 		System.out.println(&quot;Press Shift+Ctrl+F to format&quot;);\n" +
3276
		" * 	}\n" + 
3276
		" * 	}\n" +
3277
		" * }\n" + 
3277
		" * }\n" +
3278
		" * </pre>\n" + 
3278
		" * </pre>\n" +
3279
		" */\n" + 
3279
		" */\n" +
3280
		"public class Test {\n" + 
3280
		"public class Test {\n" +
3281
		"}\n"
3281
		"}\n"
3282
	);
3282
	);
3283
}
3283
}
3284
public void testBug239719b() throws JavaModelException {
3284
public void testBug239719b() throws JavaModelException {
3285
	String source = 
3285
	String source =
3286
		"public class X01 {\n" + 
3286
		"public class X01 {\n" +
3287
		"	\n" + 
3287
		"	\n" +
3288
		"	private int fLength;\n" + 
3288
		"	private int fLength;\n" +
3289
		"	private int fOffset;\n" + 
3289
		"	private int fOffset;\n" +
3290
		"\n" + 
3290
		"\n" +
3291
		"	/**\n" + 
3291
		"	/**\n" +
3292
		"	 * Returns the inclusive end position of this edit. The inclusive end\n" + 
3292
		"	 * Returns the inclusive end position of this edit. The inclusive end\n" +
3293
		"	 * position denotes the last character of the region manipulated by\n" + 
3293
		"	 * position denotes the last character of the region manipulated by\n" +
3294
		"	 * this edit. The returned value is the result of the following\n" + 
3294
		"	 * this edit. The returned value is the result of the following\n" +
3295
		"	 * calculation:\n" + 
3295
		"	 * calculation:\n" +
3296
		"	 * <pre>\n" + 
3296
		"	 * <pre>\n" +
3297
		"	 *   getOffset() + getLength() - 1;\n" + 
3297
		"	 *   getOffset() + getLength() - 1;\n" +
3298
		"	 * <pre>\n" + 
3298
		"	 * <pre>\n" +
3299
		"	 * \n" + 
3299
		"	 * \n" +
3300
		"	 * @return the inclusive end position\n" + 
3300
		"	 * @return the inclusive end position\n" +
3301
		"	 */\n" + 
3301
		"	 */\n" +
3302
		"	public final int getInclusiveEnd() {\n" + 
3302
		"	public final int getInclusiveEnd() {\n" +
3303
		"		return fOffset + fLength - 1;\n" + 
3303
		"		return fOffset + fLength - 1;\n" +
3304
		"	}\n" + 
3304
		"	}\n" +
3305
		"}\n";
3305
		"}\n";
3306
	formatSource(source,
3306
	formatSource(source,
3307
		"public class X01 {\n" + 
3307
		"public class X01 {\n" +
3308
		"\n" + 
3308
		"\n" +
3309
		"	private int fLength;\n" + 
3309
		"	private int fLength;\n" +
3310
		"	private int fOffset;\n" + 
3310
		"	private int fOffset;\n" +
3311
		"\n" + 
3311
		"\n" +
3312
		"	/**\n" + 
3312
		"	/**\n" +
3313
		"	 * Returns the inclusive end position of this edit. The inclusive end\n" + 
3313
		"	 * Returns the inclusive end position of this edit. The inclusive end\n" +
3314
		"	 * position denotes the last character of the region manipulated by this\n" + 
3314
		"	 * position denotes the last character of the region manipulated by this\n" +
3315
		"	 * edit. The returned value is the result of the following calculation:\n" + 
3315
		"	 * edit. The returned value is the result of the following calculation:\n" +
3316
		"	 * \n" + 
3316
		"	 * \n" +
3317
		"	 * <pre>\n" + 
3317
		"	 * <pre>\n" +
3318
		"	 * getOffset() + getLength() - 1;\n" + 
3318
		"	 * getOffset() + getLength() - 1;\n" +
3319
		"	 * \n" + 
3319
		"	 * \n" +
3320
		"	 * <pre>\n" + 
3320
		"	 * <pre>\n" +
3321
		"	 * \n" + 
3321
		"	 * \n" +
3322
		"	 * @return the inclusive end position\n" + 
3322
		"	 * @return the inclusive end position\n" +
3323
		"	 */\n" + 
3323
		"	 */\n" +
3324
		"	public final int getInclusiveEnd() {\n" + 
3324
		"	public final int getInclusiveEnd() {\n" +
3325
		"		return fOffset + fLength - 1;\n" + 
3325
		"		return fOffset + fLength - 1;\n" +
3326
		"	}\n" + 
3326
		"	}\n" +
3327
		"}\n"
3327
		"}\n"
3328
	);
3328
	);
3329
}
3329
}
Lines 3334-3419 Link Here
3334
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=239941"
3334
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=239941"
3335
 */
3335
 */
3336
public void testBug239941() throws JavaModelException {
3336
public void testBug239941() throws JavaModelException {
3337
	String source = 
3337
	String source =
3338
		"public class X01 {\n" + 
3338
		"public class X01 {\n" +
3339
		"\n" + 
3339
		"\n" +
3340
		"	/**\n" + 
3340
		"	/**\n" +
3341
		"	 * <pre>\n" + 
3341
		"	 * <pre>\n" +
3342
		"	 * Unclosed pre tag\n" + 
3342
		"	 * Unclosed pre tag\n" +
3343
		"	 */\n" + 
3343
		"	 */\n" +
3344
		"	int foo;\n" + 
3344
		"	int foo;\n" +
3345
		"\n" + 
3345
		"\n" +
3346
		"    /**\n" + 
3346
		"    /**\n" +
3347
		"     * Gets the signers of this class.\n" + 
3347
		"     * Gets the signers of this class.\n" +
3348
		"     *\n" + 
3348
		"     *\n" +
3349
		"     * @return  the signers of this class, or null if there are no signers.  In\n" + 
3349
		"     * @return  the signers of this class, or null if there are no signers.  In\n" +
3350
		"     * 		particular, this method returns null if this object represents\n" + 
3350
		"     * 		particular, this method returns null if this object represents\n" +
3351
		"     * 		a primitive type or void.\n" + 
3351
		"     * 		a primitive type or void.\n" +
3352
		"     * @since 	JDK1.1\n" + 
3352
		"     * @since 	JDK1.1\n" +
3353
		"     */\n" + 
3353
		"     */\n" +
3354
		"    public native Object[] getSigners();\n" + 
3354
		"    public native Object[] getSigners();\n" +
3355
		"}\n";
3355
		"}\n";
3356
	formatSource(source,
3356
	formatSource(source,
3357
		"public class X01 {\n" + 
3357
		"public class X01 {\n" +
3358
		"\n" + 
3358
		"\n" +
3359
		"	/**\n" + 
3359
		"	/**\n" +
3360
		"	 * <pre>\n" + 
3360
		"	 * <pre>\n" +
3361
		"	 * Unclosed pre tag\n" + 
3361
		"	 * Unclosed pre tag\n" +
3362
		"	 */\n" + 
3362
		"	 */\n" +
3363
		"	int foo;\n" + 
3363
		"	int foo;\n" +
3364
		"\n" + 
3364
		"\n" +
3365
		"	/**\n" + 
3365
		"	/**\n" +
3366
		"	 * Gets the signers of this class.\n" + 
3366
		"	 * Gets the signers of this class.\n" +
3367
		"	 * \n" + 
3367
		"	 * \n" +
3368
		"	 * @return the signers of this class, or null if there are no signers. In\n" + 
3368
		"	 * @return the signers of this class, or null if there are no signers. In\n" +
3369
		"	 *         particular, this method returns null if this object represents a\n" + 
3369
		"	 *         particular, this method returns null if this object represents a\n" +
3370
		"	 *         primitive type or void.\n" + 
3370
		"	 *         primitive type or void.\n" +
3371
		"	 * @since JDK1.1\n" + 
3371
		"	 * @since JDK1.1\n" +
3372
		"	 */\n" + 
3372
		"	 */\n" +
3373
		"	public native Object[] getSigners();\n" + 
3373
		"	public native Object[] getSigners();\n" +
3374
		"}\n"
3374
		"}\n"
3375
	);
3375
	);
3376
}
3376
}
3377
3377
3378
/**
3378
/**
3379
 * @bug 240686: [formatter] Formatter do unexpected things
3379
 * @bug 240686: [formatter] Formatter do unexpected things
3380
 * @test Ensure that open brace are well taken into account just after the HTML tag opening
3380
 * @test Ensure that open brace are well taken into account just after the HTML tag opening
3381
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=240686"
3381
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=240686"
3382
 */
3382
 */
3383
public void testBug240686() throws JavaModelException {
3383
public void testBug240686() throws JavaModelException {
3384
	String source = 
3384
	String source =
3385
		"public class Test {\n" + 
3385
		"public class Test {\n" +
3386
		"\n" + 
3386
		"\n" +
3387
		"/** \n" + 
3387
		"/** \n" +
3388
		" * <pre>{ }</pre>\n" + 
3388
		" * <pre>{ }</pre>\n" +
3389
		" * \n" + 
3389
		" * \n" +
3390
		" * <table>\n" + 
3390
		" * <table>\n" +
3391
		" * <tr>{ \"1\",\n" + 
3391
		" * <tr>{ \"1\",\n" +
3392
		" * \"2\"}\n" + 
3392
		" * \"2\"}\n" +
3393
		" * </tr>\n" + 
3393
		" * </tr>\n" +
3394
		" * </table>\n" + 
3394
		" * </table>\n" +
3395
		" */\n" + 
3395
		" */\n" +
3396
		"void foo() {}\n" + 
3396
		"void foo() {}\n" +
3397
		"}\n";
3397
		"}\n";
3398
	// output is different than 3.3 one: <tr> is considered as new line tag
3398
	// output is different than 3.3 one: <tr> is considered as new line tag
3399
	// hence the text inside the tag is put on a new line
3399
	// hence the text inside the tag is put on a new line
3400
	formatSource(source,
3400
	formatSource(source,
3401
		"public class Test {\n" + 
3401
		"public class Test {\n" +
3402
		"\n" + 
3402
		"\n" +
3403
		"	/**\n" + 
3403
		"	/**\n" +
3404
		"	 * <pre>\n" + 
3404
		"	 * <pre>\n" +
3405
		"	 * {}\n" + 
3405
		"	 * {}\n" +
3406
		"	 * </pre>\n" + 
3406
		"	 * </pre>\n" +
3407
		"	 * \n" + 
3407
		"	 * \n" +
3408
		"	 * <table>\n" + 
3408
		"	 * <table>\n" +
3409
		"	 * <tr>\n" + 
3409
		"	 * <tr>\n" +
3410
		"	 * { \"1\", \"2\"}\n" + 
3410
		"	 * { \"1\", \"2\"}\n" +
3411
		"	 * </tr>\n" + 
3411
		"	 * </tr>\n" +
3412
		"	 * </table>\n" + 
3412
		"	 * </table>\n" +
3413
		"	 */\n" + 
3413
		"	 */\n" +
3414
		"	void foo() {\n" + 
3414
		"	void foo() {\n" +
3415
		"	}\n" + 
3415
		"	}\n" +
3416
		"}\n"
3416
		"}\n"
3417
	);
3417
	);
3418
}
3418
}
3419
3419
Lines 3424-3454 Link Here
3424
 */
3424
 */
3425
public void testBug241345() throws JavaModelException {
3425
public void testBug241345() throws JavaModelException {
3426
	this.formatterPrefs.comment_format_html = false;
3426
	this.formatterPrefs.comment_format_html = false;
3427
	String source = 
3427
	String source =
3428
		"/**\n" + 
3428
		"/**\n" +
3429
		" * <p>Should not format HTML paragraph</p>\n" + 
3429
		" * <p>Should not format HTML paragraph</p>\n" +
3430
		" */\n" + 
3430
		" */\n" +
3431
		"public interface Test {\n" + 
3431
		"public interface Test {\n" +
3432
		"	/**\n" + 
3432
		"	/**\n" +
3433
		"	 * \n" + 
3433
		"	 * \n" +
3434
		"	 * These possibilities include: <ul><li>Formatting of header\n" + 
3434
		"	 * These possibilities include: <ul><li>Formatting of header\n" +
3435
		"	 * comments.</li><li>Formatting of Javadoc tags</li></ul>\n" + 
3435
		"	 * comments.</li><li>Formatting of Javadoc tags</li></ul>\n" +
3436
		"	 */\n" + 
3436
		"	 */\n" +
3437
		"	int bar();\n" + 
3437
		"	int bar();\n" +
3438
		"\n" + 
3438
		"\n" +
3439
		"}\n";
3439
		"}\n";
3440
	formatSource(source,
3440
	formatSource(source,
3441
		"/**\n" + 
3441
		"/**\n" +
3442
		" * <p>Should not format HTML paragraph</p>\n" + 
3442
		" * <p>Should not format HTML paragraph</p>\n" +
3443
		" */\n" + 
3443
		" */\n" +
3444
		"public interface Test {\n" + 
3444
		"public interface Test {\n" +
3445
		"	/**\n" + 
3445
		"	/**\n" +
3446
		"	 * \n" + 
3446
		"	 * \n" +
3447
		"	 * These possibilities include: <ul><li>Formatting of header\n" + 
3447
		"	 * These possibilities include: <ul><li>Formatting of header\n" +
3448
		"	 * comments.</li><li>Formatting of Javadoc tags</li></ul>\n" + 
3448
		"	 * comments.</li><li>Formatting of Javadoc tags</li></ul>\n" +
3449
		"	 */\n" + 
3449
		"	 */\n" +
3450
		"	int bar();\n" + 
3450
		"	int bar();\n" +
3451
		"\n" + 
3451
		"\n" +
3452
		"}\n"
3452
		"}\n"
3453
	);
3453
	);
3454
}
3454
}
Lines 3459-3487 Link Here
3459
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=241687"
3459
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=241687"
3460
 */
3460
 */
3461
public void testBug241687() throws JavaModelException {
3461
public void testBug241687() throws JavaModelException {
3462
	String source = 
3462
	String source =
3463
		"public interface Test {\n" + 
3463
		"public interface Test {\n" +
3464
		"\n" + 
3464
		"\n" +
3465
		"/*---------------------\n" + 
3465
		"/*---------------------\n" +
3466
		" * END OF SETS AND GETS\n" + 
3466
		" * END OF SETS AND GETS\n" +
3467
		" * test test test test test test test\n" + 
3467
		" * test test test test test test test\n" +
3468
		"test test test test test test \n" + 
3468
		"test test test test test test \n" +
3469
		" * \n" + 
3469
		" * \n" +
3470
		"*\n" + 
3470
		"*\n" +
3471
		" *---------------------*/\n" + 
3471
		" *---------------------*/\n" +
3472
		"void foo();\n" + 
3472
		"void foo();\n" +
3473
		"}\n";
3473
		"}\n";
3474
	formatSource(source,
3474
	formatSource(source,
3475
		"public interface Test {\n" + 
3475
		"public interface Test {\n" +
3476
		"\n" + 
3476
		"\n" +
3477
		"	/*---------------------\n" + 
3477
		"	/*---------------------\n" +
3478
		"	 * END OF SETS AND GETS\n" + 
3478
		"	 * END OF SETS AND GETS\n" +
3479
		"	 * test test test test test test test\n" + 
3479
		"	 * test test test test test test test\n" +
3480
		"	 test test test test test test \n" + 
3480
		"	 test test test test test test \n" +
3481
		"	 * \n" + 
3481
		"	 * \n" +
3482
		"	 *\n" + 
3482
		"	 *\n" +
3483
		"	 *---------------------*/\n" + 
3483
		"	 *---------------------*/\n" +
3484
		"	void foo();\n" + 
3484
		"	void foo();\n" +
3485
		"}\n"
3485
		"}\n"
3486
	);
3486
	);
3487
}
3487
}
Lines 3492-3745 Link Here
3492
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=256799"
3492
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=256799"
3493
 */
3493
 */
3494
public void testBug256799_Line01() throws JavaModelException {
3494
public void testBug256799_Line01() throws JavaModelException {
3495
	String source = 
3495
	String source =
3496
		"public class X01 {\n" + 
3496
		"public class X01 {\n" +
3497
		"	int foo(int value) {\n" + 
3497
		"	int foo(int value) {\n" +
3498
		"		int test = 0;\n" + 
3498
		"		int test = 0;\n" +
3499
		"		switch (value) {\n" + 
3499
		"		switch (value) {\n" +
3500
		"		case 1:\n" + 
3500
		"		case 1:\n" +
3501
		"			test = value;\n" + 
3501
		"			test = value;\n" +
3502
		"			//$FALL-THROUGH$\n" + 
3502
		"			//$FALL-THROUGH$\n" +
3503
		"		case 2:\n" + 
3503
		"		case 2:\n" +
3504
		"			test = value;\n" + 
3504
		"			test = value;\n" +
3505
		"			// $FALL-THROUGH$\n" + 
3505
		"			// $FALL-THROUGH$\n" +
3506
		"		case 3:\n" + 
3506
		"		case 3:\n" +
3507
		"			test = value;\n" + 
3507
		"			test = value;\n" +
3508
		"			//    	   $FALL-THROUGH$\n" + 
3508
		"			//    	   $FALL-THROUGH$\n" +
3509
		"		case 4:\n" + 
3509
		"		case 4:\n" +
3510
		"			test = value;\n" + 
3510
		"			test = value;\n" +
3511
		"			//		$FALL-THROUGH$                  \n" + 
3511
		"			//		$FALL-THROUGH$                  \n" +
3512
		"		default:\n" + 
3512
		"		default:\n" +
3513
		"			test = -1;\n" + 
3513
		"			test = -1;\n" +
3514
		"			break;\n" + 
3514
		"			break;\n" +
3515
		"		}\n" + 
3515
		"		}\n" +
3516
		"		return test;\n" + 
3516
		"		return test;\n" +
3517
		"	}\n" + 
3517
		"	}\n" +
3518
		"}\n";
3518
		"}\n";
3519
	formatSource(source,
3519
	formatSource(source,
3520
		"public class X01 {\n" + 
3520
		"public class X01 {\n" +
3521
		"	int foo(int value) {\n" + 
3521
		"	int foo(int value) {\n" +
3522
		"		int test = 0;\n" + 
3522
		"		int test = 0;\n" +
3523
		"		switch (value) {\n" + 
3523
		"		switch (value) {\n" +
3524
		"		case 1:\n" + 
3524
		"		case 1:\n" +
3525
		"			test = value;\n" + 
3525
		"			test = value;\n" +
3526
		"			//$FALL-THROUGH$\n" + 
3526
		"			//$FALL-THROUGH$\n" +
3527
		"		case 2:\n" + 
3527
		"		case 2:\n" +
3528
		"			test = value;\n" + 
3528
		"			test = value;\n" +
3529
		"			// $FALL-THROUGH$\n" + 
3529
		"			// $FALL-THROUGH$\n" +
3530
		"		case 3:\n" + 
3530
		"		case 3:\n" +
3531
		"			test = value;\n" + 
3531
		"			test = value;\n" +
3532
		"			// $FALL-THROUGH$\n" + 
3532
		"			// $FALL-THROUGH$\n" +
3533
		"		case 4:\n" + 
3533
		"		case 4:\n" +
3534
		"			test = value;\n" + 
3534
		"			test = value;\n" +
3535
		"			// $FALL-THROUGH$\n" + 
3535
		"			// $FALL-THROUGH$\n" +
3536
		"		default:\n" + 
3536
		"		default:\n" +
3537
		"			test = -1;\n" + 
3537
		"			test = -1;\n" +
3538
		"			break;\n" + 
3538
		"			break;\n" +
3539
		"		}\n" + 
3539
		"		}\n" +
3540
		"		return test;\n" + 
3540
		"		return test;\n" +
3541
		"	}\n" + 
3541
		"	}\n" +
3542
		"}\n"
3542
		"}\n"
3543
	);
3543
	);
3544
}
3544
}
3545
public void testBug256799_Line02() throws JavaModelException {
3545
public void testBug256799_Line02() throws JavaModelException {
3546
	String source = 
3546
	String source =
3547
		"public class X01 {\n" + 
3547
		"public class X01 {\n" +
3548
		"	int foo(int value) {\n" + 
3548
		"	int foo(int value) {\n" +
3549
		"		int test = 0;\n" + 
3549
		"		int test = 0;\n" +
3550
		"		switch (value) {\n" + 
3550
		"		switch (value) {\n" +
3551
		"		case 1:\n" + 
3551
		"		case 1:\n" +
3552
		"			test = value;\n" + 
3552
		"			test = value;\n" +
3553
		"			//$FALL-THROUGH$     with	text   	   after        \n" + 
3553
		"			//$FALL-THROUGH$     with	text   	   after        \n" +
3554
		"		case 2:\n" + 
3554
		"		case 2:\n" +
3555
		"			test = value;\n" + 
3555
		"			test = value;\n" +
3556
		"			// $FALL-THROUGH$		with	text   	   after        		\n" + 
3556
		"			// $FALL-THROUGH$		with	text   	   after        		\n" +
3557
		"		case 3:\n" + 
3557
		"		case 3:\n" +
3558
		"			test = value;\n" + 
3558
		"			test = value;\n" +
3559
		"			//    	   $FALL-THROUGH$  		   with	text   	   after	        \n" + 
3559
		"			//    	   $FALL-THROUGH$  		   with	text   	   after	        \n" +
3560
		"		case 4:\n" + 
3560
		"		case 4:\n" +
3561
		"			test = value;\n" + 
3561
		"			test = value;\n" +
3562
		"			//		$FALL-THROUGH$		             		with	text   	   after			\n" + 
3562
		"			//		$FALL-THROUGH$		             		with	text   	   after			\n" +
3563
		"		default:\n" + 
3563
		"		default:\n" +
3564
		"			test = -1;\n" + 
3564
		"			test = -1;\n" +
3565
		"			break;\n" + 
3565
		"			break;\n" +
3566
		"		}\n" + 
3566
		"		}\n" +
3567
		"		return test;\n" + 
3567
		"		return test;\n" +
3568
		"	}\n" + 
3568
		"	}\n" +
3569
		"}\n";
3569
		"}\n";
3570
	formatSource(source,
3570
	formatSource(source,
3571
		"public class X01 {\n" + 
3571
		"public class X01 {\n" +
3572
		"	int foo(int value) {\n" + 
3572
		"	int foo(int value) {\n" +
3573
		"		int test = 0;\n" + 
3573
		"		int test = 0;\n" +
3574
		"		switch (value) {\n" + 
3574
		"		switch (value) {\n" +
3575
		"		case 1:\n" + 
3575
		"		case 1:\n" +
3576
		"			test = value;\n" + 
3576
		"			test = value;\n" +
3577
		"			//$FALL-THROUGH$ with text after\n" + 
3577
		"			//$FALL-THROUGH$ with text after\n" +
3578
		"		case 2:\n" + 
3578
		"		case 2:\n" +
3579
		"			test = value;\n" + 
3579
		"			test = value;\n" +
3580
		"			// $FALL-THROUGH$ with text after\n" + 
3580
		"			// $FALL-THROUGH$ with text after\n" +
3581
		"		case 3:\n" + 
3581
		"		case 3:\n" +
3582
		"			test = value;\n" + 
3582
		"			test = value;\n" +
3583
		"			// $FALL-THROUGH$ with text after\n" + 
3583
		"			// $FALL-THROUGH$ with text after\n" +
3584
		"		case 4:\n" + 
3584
		"		case 4:\n" +
3585
		"			test = value;\n" + 
3585
		"			test = value;\n" +
3586
		"			// $FALL-THROUGH$ with text after\n" + 
3586
		"			// $FALL-THROUGH$ with text after\n" +
3587
		"		default:\n" + 
3587
		"		default:\n" +
3588
		"			test = -1;\n" + 
3588
		"			test = -1;\n" +
3589
		"			break;\n" + 
3589
		"			break;\n" +
3590
		"		}\n" + 
3590
		"		}\n" +
3591
		"		return test;\n" + 
3591
		"		return test;\n" +
3592
		"	}\n" + 
3592
		"	}\n" +
3593
		"}\n"
3593
		"}\n"
3594
	);
3594
	);
3595
}
3595
}
3596
public void testBug256799_Block01() throws JavaModelException {
3596
public void testBug256799_Block01() throws JavaModelException {
3597
	String source = 
3597
	String source =
3598
		"public class X01 {\n" + 
3598
		"public class X01 {\n" +
3599
		"	int foo(int value) {\n" + 
3599
		"	int foo(int value) {\n" +
3600
		"		int test = 0;\n" + 
3600
		"		int test = 0;\n" +
3601
		"		switch (value) {\n" + 
3601
		"		switch (value) {\n" +
3602
		"		case 1:\n" + 
3602
		"		case 1:\n" +
3603
		"			test = value;\n" + 
3603
		"			test = value;\n" +
3604
		"			/*$FALL-THROUGH$*/\n" + 
3604
		"			/*$FALL-THROUGH$*/\n" +
3605
		"		case 2:\n" + 
3605
		"		case 2:\n" +
3606
		"			test = value;\n" + 
3606
		"			test = value;\n" +
3607
		"			/* $FALL-THROUGH$*/\n" + 
3607
		"			/* $FALL-THROUGH$*/\n" +
3608
		"		case 3:\n" + 
3608
		"		case 3:\n" +
3609
		"			test = value;\n" + 
3609
		"			test = value;\n" +
3610
		"			/*$FALL-THROUGH$ */\n" + 
3610
		"			/*$FALL-THROUGH$ */\n" +
3611
		"		case 4:\n" + 
3611
		"		case 4:\n" +
3612
		"			test = value;\n" + 
3612
		"			test = value;\n" +
3613
		"			/* $FALL-THROUGH$ */\n" + 
3613
		"			/* $FALL-THROUGH$ */\n" +
3614
		"		case 5:\n" + 
3614
		"		case 5:\n" +
3615
		"			test = value;\n" + 
3615
		"			test = value;\n" +
3616
		"			/*    	   $FALL-THROUGH$*/\n" + 
3616
		"			/*    	   $FALL-THROUGH$*/\n" +
3617
		"		case 6:\n" + 
3617
		"		case 6:\n" +
3618
		"			test = value;\n" + 
3618
		"			test = value;\n" +
3619
		"			/*		$FALL-THROUGH$                  */\n" + 
3619
		"			/*		$FALL-THROUGH$                  */\n" +
3620
		"		case 7:\n" + 
3620
		"		case 7:\n" +
3621
		"			test = value;\n" + 
3621
		"			test = value;\n" +
3622
		"			/*$FALL-THROUGH$			*/\n" + 
3622
		"			/*$FALL-THROUGH$			*/\n" +
3623
		"		case 8:\n" + 
3623
		"		case 8:\n" +
3624
		"			test = value;\n" + 
3624
		"			test = value;\n" +
3625
		"			/*		     		     $FALL-THROUGH$	    	    	*/\n" + 
3625
		"			/*		     		     $FALL-THROUGH$	    	    	*/\n" +
3626
		"		default:\n" + 
3626
		"		default:\n" +
3627
		"			test = -1;\n" + 
3627
		"			test = -1;\n" +
3628
		"			break;\n" + 
3628
		"			break;\n" +
3629
		"		}\n" + 
3629
		"		}\n" +
3630
		"		return test;\n" + 
3630
		"		return test;\n" +
3631
		"	}\n" + 
3631
		"	}\n" +
3632
		"}\n";
3632
		"}\n";
3633
	formatSource(source,
3633
	formatSource(source,
3634
		"public class X01 {\n" + 
3634
		"public class X01 {\n" +
3635
		"	int foo(int value) {\n" + 
3635
		"	int foo(int value) {\n" +
3636
		"		int test = 0;\n" + 
3636
		"		int test = 0;\n" +
3637
		"		switch (value) {\n" + 
3637
		"		switch (value) {\n" +
3638
		"		case 1:\n" + 
3638
		"		case 1:\n" +
3639
		"			test = value;\n" + 
3639
		"			test = value;\n" +
3640
		"			/* $FALL-THROUGH$ */\n" + 
3640
		"			/* $FALL-THROUGH$ */\n" +
3641
		"		case 2:\n" + 
3641
		"		case 2:\n" +
3642
		"			test = value;\n" + 
3642
		"			test = value;\n" +
3643
		"			/* $FALL-THROUGH$ */\n" + 
3643
		"			/* $FALL-THROUGH$ */\n" +
3644
		"		case 3:\n" + 
3644
		"		case 3:\n" +
3645
		"			test = value;\n" + 
3645
		"			test = value;\n" +
3646
		"			/* $FALL-THROUGH$ */\n" + 
3646
		"			/* $FALL-THROUGH$ */\n" +
3647
		"		case 4:\n" + 
3647
		"		case 4:\n" +
3648
		"			test = value;\n" + 
3648
		"			test = value;\n" +
3649
		"			/* $FALL-THROUGH$ */\n" + 
3649
		"			/* $FALL-THROUGH$ */\n" +
3650
		"		case 5:\n" + 
3650
		"		case 5:\n" +
3651
		"			test = value;\n" + 
3651
		"			test = value;\n" +
3652
		"			/* $FALL-THROUGH$ */\n" + 
3652
		"			/* $FALL-THROUGH$ */\n" +
3653
		"		case 6:\n" + 
3653
		"		case 6:\n" +
3654
		"			test = value;\n" + 
3654
		"			test = value;\n" +
3655
		"			/* $FALL-THROUGH$ */\n" + 
3655
		"			/* $FALL-THROUGH$ */\n" +
3656
		"		case 7:\n" + 
3656
		"		case 7:\n" +
3657
		"			test = value;\n" + 
3657
		"			test = value;\n" +
3658
		"			/* $FALL-THROUGH$ */\n" + 
3658
		"			/* $FALL-THROUGH$ */\n" +
3659
		"		case 8:\n" + 
3659
		"		case 8:\n" +
3660
		"			test = value;\n" + 
3660
		"			test = value;\n" +
3661
		"			/* $FALL-THROUGH$ */\n" + 
3661
		"			/* $FALL-THROUGH$ */\n" +
3662
		"		default:\n" + 
3662
		"		default:\n" +
3663
		"			test = -1;\n" + 
3663
		"			test = -1;\n" +
3664
		"			break;\n" + 
3664
		"			break;\n" +
3665
		"		}\n" + 
3665
		"		}\n" +
3666
		"		return test;\n" + 
3666
		"		return test;\n" +
3667
		"	}\n" + 
3667
		"	}\n" +
3668
		"}\n"
3668
		"}\n"
3669
	);
3669
	);
3670
}
3670
}
3671
public void testBug256799_Block02() throws JavaModelException {
3671
public void testBug256799_Block02() throws JavaModelException {
3672
	String source = 
3672
	String source =
3673
		"public class X01 {\n" + 
3673
		"public class X01 {\n" +
3674
		"	int foo(int value) {\n" + 
3674
		"	int foo(int value) {\n" +
3675
		"		int test = 0;\n" + 
3675
		"		int test = 0;\n" +
3676
		"		switch (value) {\n" + 
3676
		"		switch (value) {\n" +
3677
		"		case 1:\n" + 
3677
		"		case 1:\n" +
3678
		"			test = value;\n" + 
3678
		"			test = value;\n" +
3679
		"			/*$FALL-THROUGH$with    text    after*/\n" + 
3679
		"			/*$FALL-THROUGH$with    text    after*/\n" +
3680
		"		case 2:\n" + 
3680
		"		case 2:\n" +
3681
		"			test = value;\n" + 
3681
		"			test = value;\n" +
3682
		"			/* $FALL-THROUGH$with  		  text	after*/\n" + 
3682
		"			/* $FALL-THROUGH$with  		  text	after*/\n" +
3683
		"		case 3:\n" + 
3683
		"		case 3:\n" +
3684
		"			test = value;\n" + 
3684
		"			test = value;\n" +
3685
		"			/*$FALL-THROUGH$    with	   	text   	after	    */\n" + 
3685
		"			/*$FALL-THROUGH$    with	   	text   	after	    */\n" +
3686
		"		case 4:\n" + 
3686
		"		case 4:\n" +
3687
		"			test = value;\n" + 
3687
		"			test = value;\n" +
3688
		"			/* $FALL-THROUGH$     with	   	text   	after	    */\n" + 
3688
		"			/* $FALL-THROUGH$     with	   	text   	after	    */\n" +
3689
		"		case 5:\n" + 
3689
		"		case 5:\n" +
3690
		"			test = value;\n" + 
3690
		"			test = value;\n" +
3691
		"			/*    	   $FALL-THROUGH$	with  		  text	after*/\n" + 
3691
		"			/*    	   $FALL-THROUGH$	with  		  text	after*/\n" +
3692
		"		case 6:\n" + 
3692
		"		case 6:\n" +
3693
		"			test = value;\n" + 
3693
		"			test = value;\n" +
3694
		"			/*		$FALL-THROUGH$         	with  		  text	after        */\n" + 
3694
		"			/*		$FALL-THROUGH$         	with  		  text	after        */\n" +
3695
		"		case 7:\n" + 
3695
		"		case 7:\n" +
3696
		"			test = value;\n" + 
3696
		"			test = value;\n" +
3697
		"			/*$FALL-THROUGH$			with  		  text	after	*/\n" + 
3697
		"			/*$FALL-THROUGH$			with  		  text	after	*/\n" +
3698
		"		case 8:\n" + 
3698
		"		case 8:\n" +
3699
		"			test = value;\n" + 
3699
		"			test = value;\n" +
3700
		"			/*		     		     $FALL-THROUGH$	    		with  		  text	after    	*/\n" + 
3700
		"			/*		     		     $FALL-THROUGH$	    		with  		  text	after    	*/\n" +
3701
		"		default:\n" + 
3701
		"		default:\n" +
3702
		"			test = -1;\n" + 
3702
		"			test = -1;\n" +
3703
		"			break;\n" + 
3703
		"			break;\n" +
3704
		"		}\n" + 
3704
		"		}\n" +
3705
		"		return test;\n" + 
3705
		"		return test;\n" +
3706
		"	}\n" + 
3706
		"	}\n" +
3707
		"}\n";
3707
		"}\n";
3708
	formatSource(source,
3708
	formatSource(source,
3709
		"public class X01 {\n" + 
3709
		"public class X01 {\n" +
3710
		"	int foo(int value) {\n" + 
3710
		"	int foo(int value) {\n" +
3711
		"		int test = 0;\n" + 
3711
		"		int test = 0;\n" +
3712
		"		switch (value) {\n" + 
3712
		"		switch (value) {\n" +
3713
		"		case 1:\n" + 
3713
		"		case 1:\n" +
3714
		"			test = value;\n" + 
3714
		"			test = value;\n" +
3715
		"			/* $FALL-THROUGH$with text after */\n" + 
3715
		"			/* $FALL-THROUGH$with text after */\n" +
3716
		"		case 2:\n" + 
3716
		"		case 2:\n" +
3717
		"			test = value;\n" + 
3717
		"			test = value;\n" +
3718
		"			/* $FALL-THROUGH$with text after */\n" + 
3718
		"			/* $FALL-THROUGH$with text after */\n" +
3719
		"		case 3:\n" + 
3719
		"		case 3:\n" +
3720
		"			test = value;\n" + 
3720
		"			test = value;\n" +
3721
		"			/* $FALL-THROUGH$ with text after */\n" + 
3721
		"			/* $FALL-THROUGH$ with text after */\n" +
3722
		"		case 4:\n" + 
3722
		"		case 4:\n" +
3723
		"			test = value;\n" + 
3723
		"			test = value;\n" +
3724
		"			/* $FALL-THROUGH$ with text after */\n" + 
3724
		"			/* $FALL-THROUGH$ with text after */\n" +
3725
		"		case 5:\n" + 
3725
		"		case 5:\n" +
3726
		"			test = value;\n" + 
3726
		"			test = value;\n" +
3727
		"			/* $FALL-THROUGH$ with text after */\n" + 
3727
		"			/* $FALL-THROUGH$ with text after */\n" +
3728
		"		case 6:\n" + 
3728
		"		case 6:\n" +
3729
		"			test = value;\n" + 
3729
		"			test = value;\n" +
3730
		"			/* $FALL-THROUGH$ with text after */\n" + 
3730
		"			/* $FALL-THROUGH$ with text after */\n" +
3731
		"		case 7:\n" + 
3731
		"		case 7:\n" +
3732
		"			test = value;\n" + 
3732
		"			test = value;\n" +
3733
		"			/* $FALL-THROUGH$ with text after */\n" + 
3733
		"			/* $FALL-THROUGH$ with text after */\n" +
3734
		"		case 8:\n" + 
3734
		"		case 8:\n" +
3735
		"			test = value;\n" + 
3735
		"			test = value;\n" +
3736
		"			/* $FALL-THROUGH$ with text after */\n" + 
3736
		"			/* $FALL-THROUGH$ with text after */\n" +
3737
		"		default:\n" + 
3737
		"		default:\n" +
3738
		"			test = -1;\n" + 
3738
		"			test = -1;\n" +
3739
		"			break;\n" + 
3739
		"			break;\n" +
3740
		"		}\n" + 
3740
		"		}\n" +
3741
		"		return test;\n" + 
3741
		"		return test;\n" +
3742
		"	}\n" + 
3742
		"	}\n" +
3743
		"}\n"
3743
		"}\n"
3744
	);
3744
	);
3745
}
3745
}
Lines 3754-3785 Link Here
3754
	this.formatterPrefs.comment_format_block_comment = false;
3754
	this.formatterPrefs.comment_format_block_comment = false;
3755
	this.formatterPrefs.comment_format_line_comment = false;
3755
	this.formatterPrefs.comment_format_line_comment = false;
3756
	this.formatterPrefs.comment_format_header = true;
3756
	this.formatterPrefs.comment_format_header = true;
3757
	String source = 
3757
	String source =
3758
		"/**\n" + 
3758
		"/**\n" +
3759
		" * Test for\n" + 
3759
		" * Test for\n" +
3760
		" * bug 254998\n" + 
3760
		" * bug 254998\n" +
3761
		" */\n" + 
3761
		" */\n" +
3762
		"package javadoc;\n" + 
3762
		"package javadoc;\n" +
3763
		"\n" + 
3763
		"\n" +
3764
		"/**\n" + 
3764
		"/**\n" +
3765
		" * Test for\n" + 
3765
		" * Test for\n" +
3766
		" * bug 254998\n" + 
3766
		" * bug 254998\n" +
3767
		" */\n" + 
3767
		" */\n" +
3768
		"public class Test {\n" + 
3768
		"public class Test {\n" +
3769
		"\n" + 
3769
		"\n" +
3770
		"}\n";
3770
		"}\n";
3771
	formatSource(source,
3771
	formatSource(source,
3772
		"/**\n" + 
3772
		"/**\n" +
3773
		" * Test for bug 254998\n" + 
3773
		" * Test for bug 254998\n" +
3774
		" */\n" + 
3774
		" */\n" +
3775
		"package javadoc;\n" + 
3775
		"package javadoc;\n" +
3776
		"\n" + 
3776
		"\n" +
3777
		"/**\n" + 
3777
		"/**\n" +
3778
		" * Test for\n" + 
3778
		" * Test for\n" +
3779
		" * bug 254998\n" + 
3779
		" * bug 254998\n" +
3780
		" */\n" + 
3780
		" */\n" +
3781
		"public class Test {\n" + 
3781
		"public class Test {\n" +
3782
		"\n" + 
3782
		"\n" +
3783
		"}\n"
3783
		"}\n"
3784
	);
3784
	);
3785
}
3785
}
Lines 3788-3824 Link Here
3788
	this.formatterPrefs.comment_format_block_comment = false;
3788
	this.formatterPrefs.comment_format_block_comment = false;
3789
	this.formatterPrefs.comment_format_line_comment = false;
3789
	this.formatterPrefs.comment_format_line_comment = false;
3790
	this.formatterPrefs.comment_format_header = true;
3790
	this.formatterPrefs.comment_format_header = true;
3791
	String source = 
3791
	String source =
3792
		"/*\n" + 
3792
		"/*\n" +
3793
		" * Test for\n" + 
3793
		" * Test for\n" +
3794
		" * bug 254998\n" + 
3794
		" * bug 254998\n" +
3795
		" */\n" + 
3795
		" */\n" +
3796
		"package block;\n" + 
3796
		"package block;\n" +
3797
		"\n" + 
3797
		"\n" +
3798
		"/*\n" + 
3798
		"/*\n" +
3799
		" * Test for\n" + 
3799
		" * Test for\n" +
3800
		" * bug 254998\n" + 
3800
		" * bug 254998\n" +
3801
		" */\n" + 
3801
		" */\n" +
3802
		"public class Test {\n" + 
3802
		"public class Test {\n" +
3803
		"/*\n" + 
3803
		"/*\n" +
3804
		" * Test for\n" + 
3804
		" * Test for\n" +
3805
		" * bug 254998\n" + 
3805
		" * bug 254998\n" +
3806
		" */\n" + 
3806
		" */\n" +
3807
		"}\n";
3807
		"}\n";
3808
	formatSource(source,
3808
	formatSource(source,
3809
		"/*\n" + 
3809
		"/*\n" +
3810
		" * Test for bug 254998\n" + 
3810
		" * Test for bug 254998\n" +
3811
		" */\n" + 
3811
		" */\n" +
3812
		"package block;\n" + 
3812
		"package block;\n" +
3813
		"\n" + 
3813
		"\n" +
3814
		"/*\n" + 
3814
		"/*\n" +
3815
		" * Test for bug 254998\n" + 
3815
		" * Test for bug 254998\n" +
3816
		" */\n" + 
3816
		" */\n" +
3817
		"public class Test {\n" + 
3817
		"public class Test {\n" +
3818
		"	/*\n" + 
3818
		"	/*\n" +
3819
		"	 * Test for\n" + 
3819
		"	 * Test for\n" +
3820
		"	 * bug 254998\n" + 
3820
		"	 * bug 254998\n" +
3821
		"	 */\n" + 
3821
		"	 */\n" +
3822
		"}\n"
3822
		"}\n"
3823
	);
3823
	);
3824
}
3824
}
Lines 3827-3847 Link Here
3827
	this.formatterPrefs.comment_format_block_comment = false;
3827
	this.formatterPrefs.comment_format_block_comment = false;
3828
	this.formatterPrefs.comment_format_line_comment = false;
3828
	this.formatterPrefs.comment_format_line_comment = false;
3829
	this.formatterPrefs.comment_format_header = true;
3829
	this.formatterPrefs.comment_format_header = true;
3830
	String source = 
3830
	String source =
3831
		"//		Test		for		bug		254998\n" + 
3831
		"//		Test		for		bug		254998\n" +
3832
		"package line;\n" + 
3832
		"package line;\n" +
3833
		"\n" + 
3833
		"\n" +
3834
		"//		Test		for		bug		254998\n" + 
3834
		"//		Test		for		bug		254998\n" +
3835
		"public class Test {\n" + 
3835
		"public class Test {\n" +
3836
		"//		Test		for		bug		254998\n" + 
3836
		"//		Test		for		bug		254998\n" +
3837
		"}\n";
3837
		"}\n";
3838
	formatSource(source,
3838
	formatSource(source,
3839
		"// Test for bug 254998\n" + 
3839
		"// Test for bug 254998\n" +
3840
		"package line;\n" + 
3840
		"package line;\n" +
3841
		"\n" + 
3841
		"\n" +
3842
		"// Test for bug 254998\n" + 
3842
		"// Test for bug 254998\n" +
3843
		"public class Test {\n" + 
3843
		"public class Test {\n" +
3844
		"	//		Test		for		bug		254998\n" + 
3844
		"	//		Test		for		bug		254998\n" +
3845
		"}\n"
3845
		"}\n"
3846
	);
3846
	);
3847
}
3847
}
Lines 3852-4197 Link Here
3852
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=260011"
3852
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=260011"
3853
 */
3853
 */
3854
public void testBug260011() throws JavaModelException {
3854
public void testBug260011() throws JavaModelException {
3855
	String source = 
3855
	String source =
3856
		"public class Test {\n" + 
3856
		"public class Test {\n" +
3857
		"    /**\n" + 
3857
		"    /**\n" +
3858
		"     * some comment text here\n" + 
3858
		"     * some comment text here\n" +
3859
		"     * <p style=\"font-variant:small-caps;\">\n" + 
3859
		"     * <p style=\"font-variant:small-caps;\">\n" +
3860
		"     * some text to be styled a certain way\n" + 
3860
		"     * some text to be styled a certain way\n" +
3861
		"     * </p>\n" + 
3861
		"     * </p>\n" +
3862
		"     */\n" + 
3862
		"     */\n" +
3863
		"    void foo() {}\n" + 
3863
		"    void foo() {}\n" +
3864
		"\n" + 
3864
		"\n" +
3865
		"}\n";
3865
		"}\n";
3866
	formatSource(source,
3866
	formatSource(source,
3867
		"public class Test {\n" + 
3867
		"public class Test {\n" +
3868
		"	/**\n" + 
3868
		"	/**\n" +
3869
		"	 * some comment text here\n" + 
3869
		"	 * some comment text here\n" +
3870
		"	 * <p style=\"font-variant:small-caps;\">\n" + 
3870
		"	 * <p style=\"font-variant:small-caps;\">\n" +
3871
		"	 * some text to be styled a certain way\n" + 
3871
		"	 * some text to be styled a certain way\n" +
3872
		"	 * </p>\n" + 
3872
		"	 * </p>\n" +
3873
		"	 */\n" + 
3873
		"	 */\n" +
3874
		"	void foo() {\n" + 
3874
		"	void foo() {\n" +
3875
		"	}\n" + 
3875
		"	}\n" +
3876
		"\n" + 
3876
		"\n" +
3877
		"}\n"
3877
		"}\n"
3878
	);
3878
	);
3879
}
3879
}
3880
public void testBug260011_01() throws JavaModelException {
3880
public void testBug260011_01() throws JavaModelException {
3881
	String source = 
3881
	String source =
3882
		"public class Test {\n" + 
3882
		"public class Test {\n" +
3883
		"    /**\n" + 
3883
		"    /**\n" +
3884
		"     * some comment text here\n" + 
3884
		"     * some comment text here\n" +
3885
		"     * <ul style=\"font-variant:small-caps;\"><li style=\"font-variant:small-caps;\">\n" + 
3885
		"     * <ul style=\"font-variant:small-caps;\"><li style=\"font-variant:small-caps;\">\n" +
3886
		"     * some text to be styled a certain way</li></ul>\n" + 
3886
		"     * some text to be styled a certain way</li></ul>\n" +
3887
		"     * end of comment\n" + 
3887
		"     * end of comment\n" +
3888
		"     */\n" + 
3888
		"     */\n" +
3889
		"    void foo() {}\n" + 
3889
		"    void foo() {}\n" +
3890
		"\n" + 
3890
		"\n" +
3891
		"}\n";
3891
		"}\n";
3892
	formatSource(source,
3892
	formatSource(source,
3893
		"public class Test {\n" + 
3893
		"public class Test {\n" +
3894
		"	/**\n" + 
3894
		"	/**\n" +
3895
		"	 * some comment text here\n" + 
3895
		"	 * some comment text here\n" +
3896
		"	 * <ul style=\"font-variant:small-caps;\">\n" + 
3896
		"	 * <ul style=\"font-variant:small-caps;\">\n" +
3897
		"	 * <li style=\"font-variant:small-caps;\">\n" + 
3897
		"	 * <li style=\"font-variant:small-caps;\">\n" +
3898
		"	 * some text to be styled a certain way</li>\n" + 
3898
		"	 * some text to be styled a certain way</li>\n" +
3899
		"	 * </ul>\n" + 
3899
		"	 * </ul>\n" +
3900
		"	 * end of comment\n" + 
3900
		"	 * end of comment\n" +
3901
		"	 */\n" + 
3901
		"	 */\n" +
3902
		"	void foo() {\n" + 
3902
		"	void foo() {\n" +
3903
		"	}\n" + 
3903
		"	}\n" +
3904
		"\n" + 
3904
		"\n" +
3905
		"}\n"
3905
		"}\n"
3906
	);
3906
	);
3907
}
3907
}
3908
public void testBug260011_02() throws JavaModelException {
3908
public void testBug260011_02() throws JavaModelException {
3909
	String source = 
3909
	String source =
3910
		"public class Test {\n" + 
3910
		"public class Test {\n" +
3911
		"    /**\n" + 
3911
		"    /**\n" +
3912
		"     * some comment text here\n" + 
3912
		"     * some comment text here\n" +
3913
		"     * <pre style=\"font-variant:small-caps;\">\n" + 
3913
		"     * <pre style=\"font-variant:small-caps;\">\n" +
3914
		"     *      some text\n" + 
3914
		"     *      some text\n" +
3915
		"     *           to be styled\n" + 
3915
		"     *           to be styled\n" +
3916
		"     *                 a certain way\n" + 
3916
		"     *                 a certain way\n" +
3917
		"     *      \n" + 
3917
		"     *      \n" +
3918
		"     * </pre>\n" + 
3918
		"     * </pre>\n" +
3919
		"     * end of comment\n" + 
3919
		"     * end of comment\n" +
3920
		"     */\n" + 
3920
		"     */\n" +
3921
		"    void foo() {}\n" + 
3921
		"    void foo() {}\n" +
3922
		"\n" + 
3922
		"\n" +
3923
		"}\n";
3923
		"}\n";
3924
	formatSource(source,
3924
	formatSource(source,
3925
		"public class Test {\n" + 
3925
		"public class Test {\n" +
3926
		"	/**\n" + 
3926
		"	/**\n" +
3927
		"	 * some comment text here\n" + 
3927
		"	 * some comment text here\n" +
3928
		"	 * \n" + 
3928
		"	 * \n" +
3929
		"	 * <pre style=\"font-variant:small-caps;\">\n" + 
3929
		"	 * <pre style=\"font-variant:small-caps;\">\n" +
3930
		"	 *      some text\n" + 
3930
		"	 *      some text\n" +
3931
		"	 *           to be styled\n" + 
3931
		"	 *           to be styled\n" +
3932
		"	 *                 a certain way\n" + 
3932
		"	 *                 a certain way\n" +
3933
		"	 * \n" + 
3933
		"	 * \n" +
3934
		"	 * </pre>\n" + 
3934
		"	 * </pre>\n" +
3935
		"	 * \n" + 
3935
		"	 * \n" +
3936
		"	 * end of comment\n" + 
3936
		"	 * end of comment\n" +
3937
		"	 */\n" + 
3937
		"	 */\n" +
3938
		"	void foo() {\n" + 
3938
		"	void foo() {\n" +
3939
		"	}\n" + 
3939
		"	}\n" +
3940
		"\n" + 
3940
		"\n" +
3941
		"}\n"
3941
		"}\n"
3942
	);
3942
	);
3943
}
3943
}
3944
public void testBug260011_03() throws JavaModelException {
3944
public void testBug260011_03() throws JavaModelException {
3945
	String source = 
3945
	String source =
3946
		"public class Test {\n" + 
3946
		"public class Test {\n" +
3947
		"\n" + 
3947
		"\n" +
3948
		"	/**\n" + 
3948
		"	/**\n" +
3949
		"	 * Indent char is a space char but not a line delimiters.\n" + 
3949
		"	 * Indent char is a space char but not a line delimiters.\n" +
3950
		"	 * <code>== Character.isWhitespace(ch) && ch != \'\\n\' && ch != \'\\r\'</code>\n" + 
3950
		"	 * <code>== Character.isWhitespace(ch) && ch != \'\\n\' && ch != \'\\r\'</code>\n" +
3951
		"	 */\n" + 
3951
		"	 */\n" +
3952
		"	public void foo() {\n" + 
3952
		"	public void foo() {\n" +
3953
		"	}\n" + 
3953
		"	}\n" +
3954
		"}\n";
3954
		"}\n";
3955
	formatSource(source,
3955
	formatSource(source,
3956
		"public class Test {\n" + 
3956
		"public class Test {\n" +
3957
		"\n" + 
3957
		"\n" +
3958
		"	/**\n" + 
3958
		"	/**\n" +
3959
		"	 * Indent char is a space char but not a line delimiters.\n" + 
3959
		"	 * Indent char is a space char but not a line delimiters.\n" +
3960
		"	 * <code>== Character.isWhitespace(ch) && ch != \'\\n\' && ch != \'\\r\'</code>\n" + 
3960
		"	 * <code>== Character.isWhitespace(ch) && ch != \'\\n\' && ch != \'\\r\'</code>\n" +
3961
		"	 */\n" + 
3961
		"	 */\n" +
3962
		"	public void foo() {\n" + 
3962
		"	public void foo() {\n" +
3963
		"	}\n" + 
3963
		"	}\n" +
3964
		"}\n"
3964
		"}\n"
3965
	);
3965
	);
3966
}
3966
}
3967
public void testBug260011_04() throws JavaModelException {
3967
public void testBug260011_04() throws JavaModelException {
3968
	String source = 
3968
	String source =
3969
		"public class Test {\n" + 
3969
		"public class Test {\n" +
3970
		"\n" + 
3970
		"\n" +
3971
		"	/**\n" + 
3971
		"	/**\n" +
3972
		"	 * The list of variable declaration fragments (element type: \n" + 
3972
		"	 * The list of variable declaration fragments (element type: \n" +
3973
		"	 * <code VariableDeclarationFragment</code>).  Defaults to an empty list.\n" + 
3973
		"	 * <code VariableDeclarationFragment</code>).  Defaults to an empty list.\n" +
3974
		"	 */\n" + 
3974
		"	 */\n" +
3975
		"	int field;\n" + 
3975
		"	int field;\n" +
3976
		"}\n";
3976
		"}\n";
3977
	formatSource(source,
3977
	formatSource(source,
3978
		"public class Test {\n" + 
3978
		"public class Test {\n" +
3979
		"\n" + 
3979
		"\n" +
3980
		"	/**\n" + 
3980
		"	/**\n" +
3981
		"	 * The list of variable declaration fragments (element type:\n" + 
3981
		"	 * The list of variable declaration fragments (element type:\n" +
3982
		"	 * <code VariableDeclarationFragment</code>). Defaults to an empty list.\n" + 
3982
		"	 * <code VariableDeclarationFragment</code>). Defaults to an empty list.\n" +
3983
		"	 */\n" + 
3983
		"	 */\n" +
3984
		"	int field;\n" + 
3984
		"	int field;\n" +
3985
		"}\n"
3985
		"}\n"
3986
	);
3986
	);
3987
}
3987
}
3988
public void testBug260011_05() throws JavaModelException {
3988
public void testBug260011_05() throws JavaModelException {
3989
	String source = 
3989
	String source =
3990
		"public class Test {\n" + 
3990
		"public class Test {\n" +
3991
		"\n" + 
3991
		"\n" +
3992
		"	/**\n" + 
3992
		"	/**\n" +
3993
		"	 * Compares version strings.\n" + 
3993
		"	 * Compares version strings.\n" +
3994
		"	 * \n" + 
3994
		"	 * \n" +
3995
		"	 * @return result of comparison, as integer;\n" + 
3995
		"	 * @return result of comparison, as integer;\n" +
3996
		"	 * <code><0 if left is less than right </code>\n" + 
3996
		"	 * <code><0 if left is less than right </code>\n" +
3997
		"	 * <code>0 if left is equals to right</code>\n" + 
3997
		"	 * <code>0 if left is equals to right</code>\n" +
3998
		"	 * <code>>0 if left is greater than right</code>\n" + 
3998
		"	 * <code>>0 if left is greater than right</code>\n" +
3999
		"	 */\n" + 
3999
		"	 */\n" +
4000
		"	int foo() {\n" + 
4000
		"	int foo() {\n" +
4001
		"		return 0;\n" + 
4001
		"		return 0;\n" +
4002
		"	}\n" + 
4002
		"	}\n" +
4003
		"}\n";
4003
		"}\n";
4004
	formatSource(source,
4004
	formatSource(source,
4005
		"public class Test {\n" + 
4005
		"public class Test {\n" +
4006
		"\n" + 
4006
		"\n" +
4007
		"	/**\n" + 
4007
		"	/**\n" +
4008
		"	 * Compares version strings.\n" + 
4008
		"	 * Compares version strings.\n" +
4009
		"	 * \n" + 
4009
		"	 * \n" +
4010
		"	 * @return result of comparison, as integer;\n" + 
4010
		"	 * @return result of comparison, as integer;\n" +
4011
		"	 *         <code><0 if left is less than right </code>\n" + 
4011
		"	 *         <code><0 if left is less than right </code>\n" +
4012
		"	 *         <code>0 if left is equals to right</code>\n" + 
4012
		"	 *         <code>0 if left is equals to right</code>\n" +
4013
		"	 *         <code>>0 if left is greater than right</code>\n" + 
4013
		"	 *         <code>>0 if left is greater than right</code>\n" +
4014
		"	 */\n" + 
4014
		"	 */\n" +
4015
		"	int foo() {\n" + 
4015
		"	int foo() {\n" +
4016
		"		return 0;\n" + 
4016
		"		return 0;\n" +
4017
		"	}\n" + 
4017
		"	}\n" +
4018
		"}\n"
4018
		"}\n"
4019
	);
4019
	);
4020
}
4020
}
4021
public void testBug260011_06() throws JavaModelException {
4021
public void testBug260011_06() throws JavaModelException {
4022
	String source = 
4022
	String source =
4023
		"public interface Test {\n" + 
4023
		"public interface Test {\n" +
4024
		"\n" + 
4024
		"\n" +
4025
		"	/**\n" + 
4025
		"	/**\n" +
4026
		"	 * Returns the length of this array.\n" + 
4026
		"	 * Returns the length of this array.\n" +
4027
		"	 * \n" + 
4027
		"	 * \n" +
4028
		"	 * @return the length of this array\n" + 
4028
		"	 * @return the length of this array\n" +
4029
		"	 * @exception DebugException if this method fails. Reasons include:<ul>\n" + 
4029
		"	 * @exception DebugException if this method fails. Reasons include:<ul>\n" +
4030
		"	 * <li>Failure communicating with the VM.  The DebugException\'s\n" + 
4030
		"	 * <li>Failure communicating with the VM.  The DebugException\'s\n" +
4031
		"	 * status code contains the underlying exception responsible for\n" + 
4031
		"	 * status code contains the underlying exception responsible for\n" +
4032
		"	 * the failure.</li>\n" + 
4032
		"	 * the failure.</li>\n" +
4033
		"	 * </ul\n" + 
4033
		"	 * </ul\n" +
4034
		"	 */\n" + 
4034
		"	 */\n" +
4035
		"	public int getLength();\n" + 
4035
		"	public int getLength();\n" +
4036
		"}\n";
4036
		"}\n";
4037
	formatSource(source,
4037
	formatSource(source,
4038
		"public interface Test {\n" + 
4038
		"public interface Test {\n" +
4039
		"\n" + 
4039
		"\n" +
4040
		"	/**\n" + 
4040
		"	/**\n" +
4041
		"	 * Returns the length of this array.\n" + 
4041
		"	 * Returns the length of this array.\n" +
4042
		"	 * \n" + 
4042
		"	 * \n" +
4043
		"	 * @return the length of this array\n" + 
4043
		"	 * @return the length of this array\n" +
4044
		"	 * @exception DebugException\n" + 
4044
		"	 * @exception DebugException\n" +
4045
		"	 *                if this method fails. Reasons include:\n" + 
4045
		"	 *                if this method fails. Reasons include:\n" +
4046
		"	 *                <ul>\n" + 
4046
		"	 *                <ul>\n" +
4047
		"	 *                <li>Failure communicating with the VM. The\n" + 
4047
		"	 *                <li>Failure communicating with the VM. The\n" +
4048
		"	 *                DebugException\'s status code contains the underlying\n" + 
4048
		"	 *                DebugException\'s status code contains the underlying\n" +
4049
		"	 *                exception responsible for the failure.</li>\n" + 
4049
		"	 *                exception responsible for the failure.</li>\n" +
4050
		"	 *                </ul\n" + 
4050
		"	 *                </ul\n" +
4051
		"	 */\n" + 
4051
		"	 */\n" +
4052
		"	public int getLength();\n" + 
4052
		"	public int getLength();\n" +
4053
		"}\n"
4053
		"}\n"
4054
	);
4054
	);
4055
}
4055
}
4056
public void testBug260011_07() throws JavaModelException {
4056
public void testBug260011_07() throws JavaModelException {
4057
	String source = 
4057
	String source =
4058
		"public interface Test {\n" + 
4058
		"public interface Test {\n" +
4059
		"\n" + 
4059
		"\n" +
4060
		"	\n" + 
4060
		"	\n" +
4061
		"	/**\n" + 
4061
		"	/**\n" +
4062
		"	 * Returns the change directly associated with this change element or <code\n" + 
4062
		"	 * Returns the change directly associated with this change element or <code\n" +
4063
		"	 * null</code> if the element isn\'t associated with a change.\n" + 
4063
		"	 * null</code> if the element isn\'t associated with a change.\n" +
4064
		"	 * \n" + 
4064
		"	 * \n" +
4065
		"	 * @return the change or <code>null</code>\n" + 
4065
		"	 * @return the change or <code>null</code>\n" +
4066
		"	 */\n" + 
4066
		"	 */\n" +
4067
		"	public String getChange();\n" + 
4067
		"	public String getChange();\n" +
4068
		"}\n";
4068
		"}\n";
4069
	formatSource(source,
4069
	formatSource(source,
4070
		"public interface Test {\n" + 
4070
		"public interface Test {\n" +
4071
		"\n" + 
4071
		"\n" +
4072
		"	/**\n" + 
4072
		"	/**\n" +
4073
		"	 * Returns the change directly associated with this change element or <code\n" + 
4073
		"	 * Returns the change directly associated with this change element or <code\n" +
4074
		"	 * null</code>\n" + 
4074
		"	 * null</code> if the element isn\'t associated with a change.\n" +
4075
		"	 * if the element isn\'t associated with a change.\n" + 
4075
		"	 * \n" +
4076
		"	 * \n" + 
4076
		"	 * @return the change or <code>null</code>\n" +
4077
		"	 * @return the change or <code>null</code>\n" + 
4077
		"	 */\n" +
4078
		"	 */\n" + 
4078
		"	public String getChange();\n" +
4079
		"	public String getChange();\n" + 
4080
		"}\n"
4079
		"}\n"
4081
	);
4080
	);
4082
}
4081
}
4083
public void testBug260011_08() throws JavaModelException {
4082
public void testBug260011_08() throws JavaModelException {
4084
	String source = 
4083
	String source =
4085
		"public interface Test {\n" + 
4084
		"public interface Test {\n" +
4086
		"\n" + 
4085
		"\n" +
4087
		"	/**\n" + 
4086
		"	/**\n" +
4088
		"	 * Answer the element factory for an id, or <code>null</code. if not found.\n" + 
4087
		"	 * Answer the element factory for an id, or <code>null</code. if not found.\n" +
4089
		"	 * @param targetID\n" + 
4088
		"	 * @param targetID\n" +
4090
		"	 * @return\n" + 
4089
		"	 * @return\n" +
4091
		"	 */\n" + 
4090
		"	 */\n" +
4092
		"	public int foo(String targetID);\n" + 
4091
		"	public int foo(String targetID);\n" +
4093
		"}\n";
4092
		"}\n";
4094
	formatSource(source,
4093
	formatSource(source,
4095
		"public interface Test {\n" + 
4094
		"public interface Test {\n" +
4096
		"\n" + 
4095
		"\n" +
4097
		"	/**\n" + 
4096
		"	/**\n" +
4098
		"	 * Answer the element factory for an id, or <code>null</code. if not found.\n" + 
4097
		"	 * Answer the element factory for an id, or <code>null</code. if not found.\n" +
4099
		"	 * \n" + 
4098
		"	 * \n" +
4100
		"	 * @param targetID\n" + 
4099
		"	 * @param targetID\n" +
4101
		"	 * @return\n" + 
4100
		"	 * @return\n" +
4102
		"	 */\n" + 
4101
		"	 */\n" +
4103
		"	public int foo(String targetID);\n" + 
4102
		"	public int foo(String targetID);\n" +
4104
		"}\n"
4103
		"}\n"
4105
	);
4104
	);
4106
}
4105
}
4107
public void testBug260011_09() throws JavaModelException {
4106
public void testBug260011_09() throws JavaModelException {
4108
	String source = 
4107
	String source =
4109
		"public class Test {\n" + 
4108
		"public class Test {\n" +
4110
		"\n" + 
4109
		"\n" +
4111
		"	/**\n" + 
4110
		"	/**\n" +
4112
		"     * o   Example: baseCE < a << b <<< q << c < d < e * nextCE(X,1) \n" + 
4111
		"     * o   Example: baseCE < a << b <<< q << c < d < e * nextCE(X,1) \n" +
4113
		"	 */\n" + 
4112
		"	 */\n" +
4114
		"	int field;\n" + 
4113
		"	int field;\n" +
4115
		"}\n";
4114
		"}\n";
4116
	formatSource(source,
4115
	formatSource(source,
4117
		"public class Test {\n" + 
4116
		"public class Test {\n" +
4118
		"\n" + 
4117
		"\n" +
4119
		"	/**\n" + 
4118
		"	/**\n" +
4120
		"	 * o Example: baseCE < a << b <<< q << c < d < e * nextCE(X,1)\n" + 
4119
		"	 * o Example: baseCE < a << b <<< q << c < d < e * nextCE(X,1)\n" +
4121
		"	 */\n" + 
4120
		"	 */\n" +
4122
		"	int field;\n" + 
4121
		"	int field;\n" +
4123
		"}\n"
4122
		"}\n"
4124
	);
4123
	);
4125
}
4124
}
4126
public void testBug260011_09b() throws JavaModelException {
4125
public void testBug260011_09b() throws JavaModelException {
4127
	String source = 
4126
	String source =
4128
		"public class Test {\n" + 
4127
		"public class Test {\n" +
4129
		"\n" + 
4128
		"\n" +
4130
		"	/**\n" + 
4129
		"	/**\n" +
4131
		"     * o   Example: baseCE < a < b < q < c < p < e * nextCE(X,1) \n" + 
4130
		"     * o   Example: baseCE < a < b < q < c < p < e * nextCE(X,1) \n" +
4132
		"	 */\n" + 
4131
		"	 */\n" +
4133
		"	int field;\n" + 
4132
		"	int field;\n" +
4134
		"}\n";
4133
		"}\n";
4135
	formatSource(source,
4134
	formatSource(source,
4136
		"public class Test {\n" + 
4135
		"public class Test {\n" +
4137
		"\n" + 
4136
		"\n" +
4138
		"	/**\n" + 
4137
		"	/**\n" +
4139
		"	 * o Example: baseCE < a < b < q < c < p < e * nextCE(X,1)\n" + 
4138
		"	 * o Example: baseCE < a < b < q < c < p < e * nextCE(X,1)\n" +
4140
		"	 */\n" + 
4139
		"	 */\n" +
4141
		"	int field;\n" + 
4140
		"	int field;\n" +
4142
		"}\n"
4141
		"}\n"
4143
	);
4142
	);
4144
}
4143
}
4145
public void testBug260011_10() throws JavaModelException {
4144
public void testBug260011_10() throws JavaModelException {
4146
	String source = 
4145
	String source =
4147
		"public interface Test {\n" + 
4146
		"public interface Test {\n" +
4148
		"\n" + 
4147
		"\n" +
4149
		"	/**\n" + 
4148
		"	/**\n" +
4150
		"	 * Creates and opens a dialog to edit the given template.\n" + 
4149
		"	 * Creates and opens a dialog to edit the given template.\n" +
4151
		"	 * <p\n" + 
4150
		"	 * <p\n" +
4152
		"	 * Subclasses may override this method to provide a custom dialog.</p>\n" + 
4151
		"	 * Subclasses may override this method to provide a custom dialog.</p>\n" +
4153
		"	 */\n" + 
4152
		"	 */\n" +
4154
		"	void foo();\n" + 
4153
		"	void foo();\n" +
4155
		"}\n";
4154
		"}\n";
4156
	formatSource(source,
4155
	formatSource(source,
4157
		"public interface Test {\n" + 
4156
		"public interface Test {\n" +
4158
		"\n" + 
4157
		"\n" +
4159
		"	/**\n" + 
4158
		"	/**\n" +
4160
		"	 * Creates and opens a dialog to edit the given template.\n" + 
4159
		"	 * Creates and opens a dialog to edit the given template.\n" +
4161
		"	 * <p\n" + 
4160
		"	 * <p\n" +
4162
		"	 * Subclasses may override this method to provide a custom dialog.\n" + 
4161
		"	 * Subclasses may override this method to provide a custom dialog.\n" +
4163
		"	 * </p>\n" + 
4162
		"	 * </p>\n" +
4164
		"	 */\n" + 
4163
		"	 */\n" +
4165
		"	void foo();\n" + 
4164
		"	void foo();\n" +
4166
		"}\n"
4165
		"}\n"
4167
	);
4166
	);
4168
}
4167
}
4169
public void testBug260011_11() throws JavaModelException {
4168
public void testBug260011_11() throws JavaModelException {
4170
	String source = 
4169
	String source =
4171
		"public class Test {\n" + 
4170
		"public class Test {\n" +
4172
		"\n" + 
4171
		"\n" +
4173
		"    /** \n" + 
4172
		"    /** \n" +
4174
		"     * <p>Binary property IDS_Trinary_Operator (new).</p> \n" + 
4173
		"     * <p>Binary property IDS_Trinary_Operator (new).</p> \n" +
4175
		"     * <p?For programmatic determination of Ideographic Description \n" + 
4174
		"     * <p?For programmatic determination of Ideographic Description \n" +
4176
		"     * Sequences.</p> \n" + 
4175
		"     * Sequences.</p> \n" +
4177
		"     * @stable ICU 2.6\n" + 
4176
		"     * @stable ICU 2.6\n" +
4178
		"     */ \n" + 
4177
		"     */ \n" +
4179
		"    public static final int IDS_TRINARY_OPERATOR = 19; \n" + 
4178
		"    public static final int IDS_TRINARY_OPERATOR = 19; \n" +
4180
		"}\n";
4179
		"}\n";
4181
	formatSource(source,
4180
	formatSource(source,
4182
		"public class Test {\n" + 
4181
		"public class Test {\n" +
4183
		"\n" + 
4182
		"\n" +
4184
		"	/**\n" + 
4183
		"	/**\n" +
4185
		"	 * <p>\n" + 
4184
		"	 * <p>\n" +
4186
		"	 * Binary property IDS_Trinary_Operator (new).\n" + 
4185
		"	 * Binary property IDS_Trinary_Operator (new).\n" +
4187
		"	 * </p>\n" + 
4186
		"	 * </p>\n" +
4188
		"	 * <p\n" + 
4187
		"	 * <p\n" +
4189
		"	 * ?For programmatic determination of Ideographic Description Sequences.\n" + 
4188
		"	 * ?For programmatic determination of Ideographic Description Sequences.\n" +
4190
		"	 * </p>\n" + 
4189
		"	 * </p>\n" +
4191
		"	 * \n" + 
4190
		"	 * \n" +
4192
		"	 * @stable ICU 2.6\n" + 
4191
		"	 * @stable ICU 2.6\n" +
4193
		"	 */\n" + 
4192
		"	 */\n" +
4194
		"	public static final int IDS_TRINARY_OPERATOR = 19;\n" + 
4193
		"	public static final int IDS_TRINARY_OPERATOR = 19;\n" +
4195
		"}\n"
4194
		"}\n"
4196
	);
4195
	);
4197
}
4196
}
Lines 4202-4398 Link Here
4202
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=260274"
4201
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=260274"
4203
 */
4202
 */
4204
public void testBug260274() throws JavaModelException {
4203
public void testBug260274() throws JavaModelException {
4205
	String source = 
4204
	String source =
4206
		"class X {\n" + 
4205
		"class X {\n" +
4207
		"/*\n" + 
4206
		"/*\n" +
4208
		" * The formatter should NOT remove * character\n" + 
4207
		" * The formatter should NOT remove * character\n" +
4209
		" * in block comments!\n" + 
4208
		" * in block comments!\n" +
4210
		" */\n" + 
4209
		" */\n" +
4211
		"}\n";
4210
		"}\n";
4212
	formatSource(source,
4211
	formatSource(source,
4213
		"class X {\n" + 
4212
		"class X {\n" +
4214
		"	/*\n" + 
4213
		"	/*\n" +
4215
		"	 * The formatter should NOT remove * character in block comments!\n" + 
4214
		"	 * The formatter should NOT remove * character in block comments!\n" +
4216
		"	 */\n" + 
4215
		"	 */\n" +
4217
		"}\n"
4216
		"}\n"
4218
	);
4217
	);
4219
}
4218
}
4220
public void testBug260274b() throws JavaModelException {
4219
public void testBug260274b() throws JavaModelException {
4221
	String source = 
4220
	String source =
4222
		"class X {\n" + 
4221
		"class X {\n" +
4223
		"/*\n" + 
4222
		"/*\n" +
4224
		" * The formatter should keep \'*\' characters\n" + 
4223
		" * The formatter should keep \'*\' characters\n" +
4225
		" * in block comments!\n" + 
4224
		" * in block comments!\n" +
4226
		" */\n" + 
4225
		" */\n" +
4227
		"}\n";
4226
		"}\n";
4228
	formatSource(source,
4227
	formatSource(source,
4229
		"class X {\n" + 
4228
		"class X {\n" +
4230
		"	/*\n" + 
4229
		"	/*\n" +
4231
		"	 * The formatter should keep \'*\' characters in block comments!\n" + 
4230
		"	 * The formatter should keep \'*\' characters in block comments!\n" +
4232
		"	 */\n" + 
4231
		"	 */\n" +
4233
		"}\n"
4232
		"}\n"
4234
	);
4233
	);
4235
}
4234
}
4236
public void testBug260274c() throws JavaModelException {
4235
public void testBug260274c() throws JavaModelException {
4237
	this.formatterPrefs.join_lines_in_comments = false;
4236
	this.formatterPrefs.join_lines_in_comments = false;
4238
	String source = 
4237
	String source =
4239
		"class X {\n" + 
4238
		"class X {\n" +
4240
		"/* *********************************************\n" + 
4239
		"/* *********************************************\n" +
4241
		" * Test \n" + 
4240
		" * Test \n" +
4242
		" */\n" + 
4241
		" */\n" +
4242
		"}\n";
4243
	formatSource(source,
4244
		"class X {\n" +
4245
		"	/* *********************************************\n" +
4246
		"	 * Test\n" +
4247
		"	 */\n" +
4248
		"}\n"
4249
	);
4250
}
4251
public void testBug260274d() throws JavaModelException {
4252
	String source =
4253
		"class X {\n" +
4254
		"/* *********************************************\n" +
4255
		" * Test \n" +
4256
		" */\n" +
4257
		"}\n";
4258
	formatSource(source,
4259
		"class X {\n" +
4260
		"	/* *********************************************\n" +
4261
		"	 * Test\n" +
4262
		"	 */\n" +
4263
		"}\n"
4264
	);
4265
}
4266
public void testBug260274e() throws JavaModelException {
4267
	String source =
4268
		"class X {\n" +
4269
		"/*\n" +
4270
		" * **************************************************\n" +
4271
		" * **********  Test  **********  Test  **************\n" +
4272
		" * **************************************************\n" +
4273
		" */\n" +
4274
		"}\n";
4275
	formatSource(source,
4276
		"class X {\n" +
4277
		"	/*\n" +
4278
		"	 * **************************************************\n" +
4279
		"	 * ********** Test ********** Test **************\n" +
4280
		"	 * **************************************************\n" +
4281
		"	 */\n" +
4282
		"}\n"
4283
	);
4284
}
4285
public void testBug260274f() throws JavaModelException {
4286
	String source =
4287
		"class X {\n" +
4288
		"/* *****************************************************************************\n" +
4289
		" * Action that allows changing the model providers sort order.\n" +
4290
		" */\n" +
4291
		"void foo() {\n" +
4292
		"}\n" +
4293
		"}\n";
4294
	formatSource(source,
4295
		"class X {\n" +
4296
		"	/* *****************************************************************************\n" +
4297
		"	 * Action that allows changing the model providers sort order.\n" +
4298
		"	 */\n" +
4299
		"	void foo() {\n" +
4300
		"	}\n" +
4301
		"}\n"
4302
	);
4303
}
4304
public void testBug260274g() throws JavaModelException {
4305
	String source =
4306
		"class X {\n" +
4307
		"/*\n" +
4308
		" * **********************************************************************************\n" +
4309
		" * **********************************************************************************\n" +
4310
		" * **********************************************************************************\n" +
4311
		" * The code below was added to track the view with focus\n" +
4312
		" * in order to support save actions from a view. Remove this\n" +
4313
		" * experimental code if the decision is to not allow views to \n" +
4314
		" * participate in save actions (see bug 10234) \n" +
4315
		" */\n" +
4316
		"}\n";
4317
	formatSource(source,
4318
		"class X {\n" +
4319
		"	/*\n" +
4320
		"	 * **********************************************************************************\n" +
4321
		"	 * **********************************************************************************\n" +
4322
		"	 * **********************************************************************************\n" +
4323
		"	 * The code below was added to track the view with focus in order to support\n" +
4324
		"	 * save actions from a view. Remove this experimental code if the decision\n" +
4325
		"	 * is to not allow views to participate in save actions (see bug 10234)\n" +
4326
		"	 */\n" +
4327
		"}\n"
4328
	);
4329
}
4330
public void testBug260274h() throws JavaModelException {
4331
	String source =
4332
		"class X {\n" +
4333
		"    /**\n" +
4334
		"	 * @see #spacing(Point)\n" +
4335
		"	 * * @see #spacing(int, int)\n" +
4336
		"	 */\n" +
4337
		"    public void foo() {\n" +
4338
		"    }\n" +
4339
		"}\n";
4340
	formatSource(source,
4341
		"class X {\n" +
4342
		"	/**\n" +
4343
		"	 * @see #spacing(Point) * @see #spacing(int, int)\n" +
4344
		"	 */\n" +
4345
		"	public void foo() {\n" +
4346
		"	}\n" +
4347
		"}\n"
4348
	);
4349
}
4350
4351
/**
4352
 * @bug 260276: [formatter] Inconsistent formatting of one-line block comment
4353
 * @test Ensure that the comment formatter has a consistent behavior while formatting one-line block comment
4354
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=260276"
4355
 */
4356
public void testBug260276() throws JavaModelException {
4357
	String source =
4358
		"class X {\n" +
4359
		"/* a\n" +
4360
		"comment */\n" +
4361
		"}\n";
4362
	formatSource(source,
4363
		"class X {\n" +
4364
		"	/*\n" +
4365
		"	 * a comment\n" +
4366
		"	 */\n" +
4367
		"}\n"
4368
	);
4369
}
4370
public void testBug260276b() throws JavaModelException {
4371
	String source =
4372
		"class X {\n" +
4373
		"/* a\n" +
4374
		" comment */\n" +
4375
		"}\n";
4376
	formatSource(source,
4377
		"class X {\n" +
4378
		"	/*\n" +
4379
		"	 * a comment\n" +
4380
		"	 */\n" +
4381
		"}\n"
4382
	);
4383
}
4384
public void testBug260276c() throws JavaModelException {
4385
	String source =
4386
		"class X {\n" +
4387
		"/* a\n" +
4388
		" * comment */\n" +
4389
		"}\n";
4390
	formatSource(source,
4391
		"class X {\n" +
4392
		"	/*\n" +
4393
		"	 * a comment\n" +
4394
		"	 */\n" +
4395
		"}\n"
4396
	);
4397
}
4398
4399
/**
4400
 * @bug 260381: [formatter] Javadoc formatter breaks {@code ...} tags.
4401
 * @test Ensure that the @code tag is similar to <code> HTML tag
4402
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=260381"
4403
 */
4404
public void testBug260381() throws JavaModelException {
4405
	String source =
4406
		"/**\n" +
4407
		" * Comments that can be formated in several lines...\n" +
4408
		" * \n" +
4409
		" * @author Myself\n" +
4410
		" * @version {@code $Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $}\n" +
4411
		" */\n" +
4412
		"public class X01 {\n" +
4413
		"}\n";
4414
	formatSource(source);
4415
}
4416
public void testBug260381b() throws JavaModelException {
4417
	String source =
4418
		"/**\n" +
4419
		" * Comments that can be formated in several lines...\n" +
4420
		" * \n" +
4421
		" * @author Myself\n" +
4422
		" * @version <code>$Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $</code>\n" +
4423
		" */\n" +
4424
		"public class X01b {\n" +
4425
		"}\n";
4426
	formatSource(source);
4427
}
4428
public void testBug260381c() throws JavaModelException {
4429
	String source =
4430
		"/**\n" +
4431
		" * Comments that can be formated in several lines...\n" +
4432
		" * \n" +
4433
		" * @author Myself\n" +
4434
		" * @version\n" +
4435
		" *          <code>3.0 xxxxxxxxxxxxxx xwxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</code>\n" +
4436
		" */\n" +
4437
		"public class X01c {\n" +
4438
		"}\n";
4439
	formatSource(source,
4440
		"/**\n" +
4441
		" * Comments that can be formated in several lines...\n" +
4442
		" * \n" +
4443
		" * @author Myself\n" +
4444
		" * @version <code>3.0 xxxxxxxxxxxxxx xwxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</code>\n" +
4445
		" */\n" +
4446
		"public class X01c {\n" +
4447
		"}\n"
4448
	);
4449
}
4450
public void testBug260381d() throws JavaModelException {
4451
	String source =
4452
		"/**\n" +
4453
		" * Comments that can be formated in several lines...\n" +
4454
		" * \n" +
4455
		" * @author Myself\n" +
4456
		" *  @see Object <code>$Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $</code>\n" +
4457
		" */\n" +
4458
		"public class X02 {\n" +
4459
		"}\n";
4460
	formatSource(source,
4461
		"/**\n" +
4462
		" * Comments that can be formated in several lines...\n" +
4463
		" * \n" +
4464
		" * @author Myself\n" +
4465
		" * @see Object\n" +
4466
		" *      <code>$Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $</code>\n" +
4467
		" */\n" +
4468
		"public class X02 {\n" +
4469
		"}\n"
4470
	);
4471
}
4472
public void testBug260381e() throws JavaModelException {
4473
	String source =
4474
		"/**\n" +
4475
		" * Comments that can be formated in several lines...\n" +
4476
		" * \n" +
4477
		" * {@code $Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $\n" +
4478
		" * $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $}\n" +
4479
		" */\n" +
4480
		"public class X03 {\n" +
4481
		"}\n";
4482
	formatSource(source);
4483
}
4484
public void testBug260381f() throws JavaModelException {
4485
	String source =
4486
		"/**\n" +
4487
		" * Literal inline tag should also be untouched by the formatter\n" +
4488
		" * \n" +
4489
		" * @version {@literal $Revision: 1.2 $ $Date: 2009/01/07 12:27:50 $ $Author:myself $ $Source: /projects/cvs/module/project/src/com/foo/Main.java,v $}\n" +
4490
		" */\n" +
4491
		"public class X04 {\n" +
4492
		"\n" +
4493
		"}\n";
4494
	formatSource(source);
4495
}
4496
public void testBug260381_wksp1_01() throws JavaModelException {
4497
	String source =
4498
		"package wksp1;\n" +
4499
		"\n" +
4500
		"public interface I01 {\n" +
4501
		"\n" +
4502
		"	/**\n" +
4503
		"	 * Returns all configured content types for the given source viewer. This list\n" +
4504
		"	 * tells the caller which content types must be configured for the given source \n" +
4505
		"	 * viewer, i.e. for which content types the given source viewer\'s functionalities\n" +
4506
		"	 * must be specified. This implementation always returns <code>\n" +
4507
		"	 * new String[] { IDocument.DEFAULT_CONTENT_TYPE }</code>.\n" +
4508
		"	 *\n" +
4509
		"	 * @param source the source viewer to be configured by this configuration\n" +
4510
		"	 * @return the configured content types for the given viewer\n" +
4511
		"	 */\n" +
4512
		"	public String[] getConfiguredContentTypes(String source);\n" +
4513
		"}\n";
4514
	formatSource(source,
4515
		"package wksp1;\n" +
4516
		"\n" +
4517
		"public interface I01 {\n" +
4518
		"\n" +
4519
		"	/**\n" +
4520
		"	 * Returns all configured content types for the given source viewer. This\n" +
4521
		"	 * list tells the caller which content types must be configured for the\n" +
4522
		"	 * given source viewer, i.e. for which content types the given source\n" +
4523
		"	 * viewer\'s functionalities must be specified. This implementation always\n" +
4524
		"	 * returns <code>\n" +
4525
		"	 * new String[] { IDocument.DEFAULT_CONTENT_TYPE }</code>.\n" +
4526
		"	 * \n" +
4527
		"	 * @param source\n" +
4528
		"	 *            the source viewer to be configured by this configuration\n" +
4529
		"	 * @return the configured content types for the given viewer\n" +
4530
		"	 */\n" +
4531
		"	public String[] getConfiguredContentTypes(String source);\n" +
4532
		"}\n"
4533
	);
4534
}
4535
public void testBug260381_wksp2_01() throws JavaModelException {
4536
	String source =
4537
		"package wksp2;\n" +
4538
		"public interface I01 {\n" +
4539
		"	/**\n" +
4540
		"	 * Returns the composition of two functions. For {@code f: A->B} and\n" +
4541
		"	 * {@code g: B->C}, composition is defined as the function h such that\n" +
4542
		"	 * {@code h(a) == g(f(a))} for each {@code a}.\n" +
4543
		"	 *\n" +
4544
		"	 * @see <a href=\"//en.wikipedia.org/wiki/Function_composition\">\n" +
4545
		"	 * function composition</a>\n" +
4546
		"	 *\n" +
4547
		"	 * @param g the second function to apply\n" +
4548
		"	 * @param f the first function to apply\n" +
4549
		"	 * @return the composition of {@code f} and {@code g}\n" +
4550
		"	 */\n" +
4551
		"	void foo();\n" +
4552
		"}\n";
4553
	formatSource(source,
4554
		"package wksp2;\n" +
4555
		"\n" +
4556
		"public interface I01 {\n" +
4557
		"	/**\n" +
4558
		"	 * Returns the composition of two functions. For {@code f: A->B} and\n" +
4559
		"	 * {@code g: B->C}, composition is defined as the function h such that\n" +
4560
		"	 * {@code h(a) == g(f(a))} for each {@code a}.\n" +
4561
		"	 * \n" +
4562
		"	 * @see <a href=\"//en.wikipedia.org/wiki/Function_composition\"> function\n" +
4563
		"	 *      composition</a>\n" +
4564
		"	 * \n" +
4565
		"	 * @param g\n" +
4566
		"	 *            the second function to apply\n" +
4567
		"	 * @param f\n" +
4568
		"	 *            the first function to apply\n" +
4569
		"	 * @return the composition of {@code f} and {@code g}\n" +
4570
		"	 */\n" +
4571
		"	void foo();\n" +
4572
		"}\n"
4573
	);
4574
}
4575
public void testBug260381_wksp2_01b() throws JavaModelException {
4576
	String source =
4577
		"package wksp2;\n" +
4578
		"public interface I01b {\n" +
4579
		"  /**\n" +
4580
		"   * Returns the composition of two functions. For <code> f: A->B</code> and\n" +
4581
		"   * <code> g: B->C</code>, composition is defined as the function h such that\n" +
4582
		"   * <code> h(a) == g(f(a))</code> for each <code> a</code>.\n" +
4583
		"   *\n" +
4584
		"   * @see <a href=\"//en.wikipedia.org/wiki/Function_composition\">\n" +
4585
		"   * function composition</a>\n" +
4586
		"   *\n" +
4587
		"   * @param g the second function to apply\n" +
4588
		"   * @param f the first function to apply\n" +
4589
		"   * @return the composition of <code> f</code> and <code> g</code>\n" +
4590
		"   */\n" +
4591
		"  void foo();\n" +
4592
		"}\n";
4593
	formatSource(source,
4594
		"package wksp2;\n" +
4595
		"\n" +
4596
		"public interface I01b {\n" +
4597
		"	/**\n" +
4598
		"	 * Returns the composition of two functions. For <code> f: A->B</code> and\n" +
4599
		"	 * <code> g: B->C</code>, composition is defined as the function h such that\n" +
4600
		"	 * <code> h(a) == g(f(a))</code> for each <code> a</code>.\n" +
4601
		"	 * \n" +
4602
		"	 * @see <a href=\"//en.wikipedia.org/wiki/Function_composition\"> function\n" +
4603
		"	 *      composition</a>\n" +
4604
		"	 * \n" +
4605
		"	 * @param g\n" +
4606
		"	 *            the second function to apply\n" +
4607
		"	 * @param f\n" +
4608
		"	 *            the first function to apply\n" +
4609
		"	 * @return the composition of <code> f</code> and <code> g</code>\n" +
4610
		"	 */\n" +
4611
		"	void foo();\n" +
4612
		"}\n"
4613
	);
4614
}
4615
public void testBug260381_wksp2_01c() throws JavaModelException {
4616
	String source =
4617
		"package wksp2;\n" +
4618
		"public interface I01c {\n" +
4619
		"  /**\n" +
4620
		"   * Returns the composition of two functions. For <code> f: A->B</code> and\n" +
4621
		"   * <code>\n" +
4622
		"   * g: B->C\n" +
4623
		"   * </code>,\n" +
4624
		"   * composition is defined as the function h such that\n" +
4625
		"   * <code>\n" +
4626
		"   *  h(a) == g(f(a))\n" +
4627
		"   *  </code>\n" +
4628
		"   *  for each\n" +
4629
		"   *  <code>\n" +
4630
		"   *  a\n" +
4631
		"   *  </code>.\n" +
4632
		"   *\n" +
4633
		"   * @see <a href=\"//en.wikipedia.org/wiki/Function_composition\">\n" +
4634
		"   * function composition</a>\n" +
4635
		"   *\n" +
4636
		"   * @param g the second function to apply\n" +
4637
		"   * @param f the first function to apply\n" +
4638
		"   * @return the composition of <code> f</code> and <code> g</code>\n" +
4639
		"   */\n" +
4640
		"  void foo();\n" +
4641
		"}\n";
4642
	formatSource(source,
4643
		"package wksp2;\n" +
4644
		"\n" +
4645
		"public interface I01c {\n" +
4646
		"	/**\n" +
4647
		"	 * Returns the composition of two functions. For <code> f: A->B</code> and\n" +
4648
		"	 * <code>\n" +
4649
		"	 * g: B->C\n" +
4650
		"	 * </code>, composition is defined as the function h such that <code>\n" +
4651
		"	 *  h(a) == g(f(a))\n" +
4652
		"	 *  </code> for each <code>\n" +
4653
		"	 *  a\n" +
4654
		"	 *  </code>.\n" +
4655
		"	 * \n" +
4656
		"	 * @see <a href=\"//en.wikipedia.org/wiki/Function_composition\"> function\n" +
4657
		"	 *      composition</a>\n" +
4658
		"	 * \n" +
4659
		"	 * @param g\n" +
4660
		"	 *            the second function to apply\n" +
4661
		"	 * @param f\n" +
4662
		"	 *            the first function to apply\n" +
4663
		"	 * @return the composition of <code> f</code> and <code> g</code>\n" +
4664
		"	 */\n" +
4665
		"	void foo();\n" +
4666
		"}\n"
4667
	);
4668
}
4669
public void testBug260381_wksp2_02() throws JavaModelException {
4670
	String source =
4671
		"package wksp2;\n" +
4672
		"\n" +
4673
		"public interface I02 {\n" +
4674
		"\n" +
4675
		"  /**\n" +
4676
		"   * Implementations of {@code computeNext} <b>must</b> invoke this method when\n" +
4677
		"   * there are no elements left in the iteration.\n" +
4678
		"   *\n" +
4679
		"   * @return {@code null}; a convenience so your {@link #computeNext}\n" +
4680
		"   *     implementation can use the simple statement {@code return endOfData();}\n" +
4681
		"   */\n" +
4682
		"  void foo();\n" +
4243
		"}\n";
4683
		"}\n";
4244
	formatSource(source,
4684
	formatSource(source,
4245
		"class X {\n" + 
4685
		"package wksp2;\n" +
4246
		"	/* *********************************************\n" + 
4686
		"\n" +
4247
		"	 * Test\n" + 
4687
		"public interface I02 {\n" +
4248
		"	 */\n" + 
4688
		"\n" +
4689
		"	/**\n" +
4690
		"	 * Implementations of {@code computeNext} <b>must</b> invoke this method\n" +
4691
		"	 * when there are no elements left in the iteration.\n" +
4692
		"	 * \n" +
4693
		"	 * @return {@code null}; a convenience so your {@link #computeNext}\n" +
4694
		"	 *         implementation can use the simple statement\n" +
4695
		"	 *         {@code return endOfData();}\n" +
4696
		"	 */\n" +
4697
		"	void foo();\n" +
4249
		"}\n"
4698
		"}\n"
4250
	);
4699
	);
4251
}
4700
}
4252
public void testBug260274d() throws JavaModelException {
4701
public void testBug260381_wksp2_03() throws JavaModelException {
4253
	String source = 
4702
	String source =
4254
		"class X {\n" + 
4703
		"package wksp2;\n" +
4255
		"/* *********************************************\n" + 
4704
		"\n" +
4256
		" * Test \n" + 
4705
		"public interface I03 {\n" +
4257
		" */\n" + 
4706
		"  /**\n" +
4707
		"   * A builder for creating immutable bimap instances, especially {@code public\n" +
4708
		"   * static final} bimaps (\"constant bimaps\"). Example: <pre>   {@code\n" +
4709
		"   *\n" +
4710
		"   *   static final ImmutableBiMap<String, Integer> WORD_TO_INT =\n" +
4711
		"   *       new ImmutableBiMap.Builder<String, Integer>()\n" +
4712
		"   *           .put(\"one\", 1)\n" +
4713
		"   *           .put(\"two\", 2)\n" +
4714
		"   *           .put(\"three\", 3)\n" +
4715
		"   *           .build();}</pre>\n" +
4716
		"   *\n" +
4717
		"   * For <i>small</i> immutable bimaps, the {@code ImmutableBiMap.of()} methods\n" +
4718
		"   * are even more convenient.\n" +
4719
		"   *\n" +
4720
		"   * <p>Builder instances can be reused - it is safe to call {@link #build}\n" +
4721
		"   * multiple times to build multiple bimaps in series. Each bimap is a superset\n" +
4722
		"   * of the bimaps created before it.\n" +
4723
		"   */\n" +
4724
		"  void foo();\n" +
4258
		"}\n";
4725
		"}\n";
4259
	formatSource(source,
4726
	formatSource(source,
4260
		"class X {\n" + 
4727
		"package wksp2;\n" +
4261
		"	/* *********************************************\n" + 
4728
		"\n" +
4262
		"	 * Test\n" + 
4729
		"public interface I03 {\n" +
4263
		"	 */\n" + 
4730
		"	/**\n" +
4731
		"	 * A builder for creating immutable bimap instances, especially\n" +
4732
		"	 * {@code public static final} bimaps (\"constant bimaps\"). Example:\n" +
4733
		"	 * \n" +
4734
		"	 * <pre>\n" +
4735
		"	 * {\n" +
4736
		"	 * 	&#064;code\n" +
4737
		"	 * 	static final ImmutableBiMap&lt;String, Integer&gt; WORD_TO_INT = new ImmutableBiMap.Builder&lt;String, Integer&gt;()\n" +
4738
		"	 * 			.put(&quot;one&quot;, 1).put(&quot;two&quot;, 2).put(&quot;three&quot;, 3).build();\n" +
4739
		"	 * }\n" +
4740
		"	 * </pre>\n" +
4741
		"	 * \n" +
4742
		"	 * For <i>small</i> immutable bimaps, the {@code ImmutableBiMap.of()}\n" +
4743
		"	 * methods are even more convenient.\n" +
4744
		"	 * \n" +
4745
		"	 * <p>\n" +
4746
		"	 * Builder instances can be reused - it is safe to call {@link #build}\n" +
4747
		"	 * multiple times to build multiple bimaps in series. Each bimap is a\n" +
4748
		"	 * superset of the bimaps created before it.\n" +
4749
		"	 */\n" +
4750
		"	void foo();\n" +
4264
		"}\n"
4751
		"}\n"
4265
	);
4752
	);
4266
}
4753
}
4267
public void testBug260274e() throws JavaModelException {
4754
public void testBug260381_wksp2_04() throws JavaModelException {
4268
	String source = 
4755
	String source =
4269
		"class X {\n" + 
4756
		"package wksp2;\n" +
4270
		"/*\n" + 
4757
		"\n" +
4271
		" * **************************************************\n" + 
4758
		"public interface I04 {\n" +
4272
		" * **********  Test  **********  Test  **************\n" + 
4759
		"\n" +
4273
		" * **************************************************\n" + 
4760
		"  /**\n" +
4274
		" */\n" + 
4761
		"   * Returns an immutable multiset containing the given elements.\n" +
4762
		"   * \n" +
4763
		"   * <p>The multiset is ordered by the first occurrence of each element. For\n" +
4764
		"   * example, {@code ImmutableMultiset.copyOf(Arrays.asList(2, 3, 1, 3))} yields\n" +
4765
		"   * a multiset with elements in the order {@code 2, 3, 3, 1}.\n" +
4766
		"   *\n" +
4767
		"   * <p>Note that if {@code c} is a {@code Collection<String>}, then {@code\n" +
4768
		"   * ImmutableMultiset.copyOf(c)} returns an {@code ImmutableMultiset<String>}\n" +
4769
		"   * containing each of the strings in {@code c}, while\n" +
4770
		"   * {@code ImmutableMultiset.of(c)} returns an\n" +
4771
		"   * {@code ImmutableMultiset<Collection<String>>} containing one element (the\n" +
4772
		"   * given collection itself).\n" +
4773
		"   *\n" +
4774
		"   * <p><b>Note:</b> Despite what the method name suggests, if {@code elements}\n" +
4775
		"   * is an {@code ImmutableMultiset}, no copy will actually be performed, and\n" +
4776
		"   * the given multiset itself will be returned.\n" +
4777
		"   *\n" +
4778
		"   * @throws NullPointerException if any of {@code elements} is null\n" +
4779
		"   */\n" +
4780
		"  void foo();\n" +
4275
		"}\n";
4781
		"}\n";
4276
	formatSource(source,
4782
	formatSource(source,
4277
		"class X {\n" + 
4783
		"package wksp2;\n" +
4278
		"	/*\n" + 
4784
		"\n" +
4279
		"	 * **************************************************\n" + 
4785
		"public interface I04 {\n" +
4280
		"	 * ********** Test ********** Test **************\n" + 
4786
		"\n" +
4281
		"	 * **************************************************\n" + 
4787
		"	/**\n" +
4282
		"	 */\n" + 
4788
		"	 * Returns an immutable multiset containing the given elements.\n" +
4789
		"	 * \n" +
4790
		"	 * <p>\n" +
4791
		"	 * The multiset is ordered by the first occurrence of each element. For\n" +
4792
		"	 * example, {@code ImmutableMultiset.copyOf(Arrays.asList(2, 3, 1, 3))}\n" +
4793
		"	 * yields a multiset with elements in the order {@code 2, 3, 3, 1}.\n" +
4794
		"	 * \n" +
4795
		"	 * <p>\n" +
4796
		"	 * Note that if {@code c} is a {@code Collection<String>}, then\n" +
4797
		"	 * {@code ImmutableMultiset.copyOf(c)} returns an\n" +
4798
		"	 * {@code ImmutableMultiset<String>} containing each of the strings in\n" +
4799
		"	 * {@code c}, while {@code ImmutableMultiset.of(c)} returns an\n" +
4800
		"	 * {@code ImmutableMultiset<Collection<String>>} containing one element (the\n" +
4801
		"	 * given collection itself).\n" +
4802
		"	 * \n" +
4803
		"	 * <p>\n" +
4804
		"	 * <b>Note:</b> Despite what the method name suggests, if {@code elements}\n" +
4805
		"	 * is an {@code ImmutableMultiset}, no copy will actually be performed, and\n" +
4806
		"	 * the given multiset itself will be returned.\n" +
4807
		"	 * \n" +
4808
		"	 * @throws NullPointerException\n" +
4809
		"	 *             if any of {@code elements} is null\n" +
4810
		"	 */\n" +
4811
		"	void foo();\n" +
4283
		"}\n"
4812
		"}\n"
4284
	);
4813
	);
4285
}
4814
}
4286
public void testBug260274f() throws JavaModelException {
4815
public void testBug260381_wksp2_05() throws JavaModelException {
4287
	String source = 
4816
	String source =
4288
		"class X {\n" + 
4817
		"package wksp2;\n" +
4289
		"/* *****************************************************************************\n" + 
4818
		"\n" +
4290
		" * Action that allows changing the model providers sort order.\n" + 
4819
		"public interface I05 {\n" +
4291
		" */\n" + 
4820
		"\n" +
4292
		"void foo() {\n" + 
4821
		"  /**\n" +
4293
		"}\n" + 
4822
		"   * Indexes the specified values into a {@code Multimap} by applying a\n" +
4823
		"   * specified function to each item in an {@code Iterable} of values. Each\n" +
4824
		"   * value will be stored as a value in the specified multimap. The key used to\n" +
4825
		"   * store that value in the multimap will be the result of calling the function\n" +
4826
		"   * on that value. Depending on the multimap implementation, duplicate entries\n" +
4827
		"   * (equal keys and equal values) may be collapsed.\n" +
4828
		"   *\n" +
4829
		"   * <p>For example,\n" +
4830
		"   *\n" +
4831
		"   * <pre class=\"code\">\n" +
4832
		"   * List&lt;String> badGuys =\n" +
4833
		"   *   Arrays.asList(\"Inky\", \"Blinky\", \"Pinky\", \"Pinky\", \"Clyde\");\n" +
4834
		"   * Function&lt;String, Integer> stringLengthFunction = ...;\n" +
4835
		"   * Multimap&lt;Integer, String> index = Multimaps.newHashMultimap();\n" +
4836
		"   * Multimaps.index(badGuys, stringLengthFunction, index);\n" +
4837
		"   * System.out.println(index); </pre>\n" +
4838
		"   *\n" +
4839
		"   * prints\n" +
4840
		"   *\n" +
4841
		"   * <pre class=\"code\">\n" +
4842
		"   * {4=[Inky], 5=[Pinky, Clyde], 6=[Blinky]} </pre>\n" +
4843
		"   *\n" +
4844
		"   * The {@link HashMultimap} collapses the duplicate occurrence of\n" +
4845
		"   * {@code (5, \"Pinky\")}.\n" +
4846
		"   *\n" +
4847
		"   * @param values the values to add to the multimap\n" +
4848
		"   * @param keyFunction the function used to produce the key for each value\n" +
4849
		"   * @param multimap the multimap to store the key value pairs\n" +
4850
		"   */\n" +
4851
		"  void foo();\n" +
4294
		"}\n";
4852
		"}\n";
4295
	formatSource(source,
4853
	formatSource(source,
4296
		"class X {\n" + 
4854
		"package wksp2;\n" +
4297
		"	/* *****************************************************************************\n" + 
4855
		"\n" +
4298
		"	 * Action that allows changing the model providers sort order.\n" + 
4856
		"public interface I05 {\n" +
4299
		"	 */\n" + 
4857
		"\n" +
4300
		"	void foo() {\n" + 
4858
		"	/**\n" +
4301
		"	}\n" + 
4859
		"	 * Indexes the specified values into a {@code Multimap} by applying a\n" +
4302
		"}\n"
4860
		"	 * specified function to each item in an {@code Iterable} of values. Each\n" +
4303
	);
4861
		"	 * value will be stored as a value in the specified multimap. The key used\n" +
4304
}
4862
		"	 * to store that value in the multimap will be the result of calling the\n" +
4305
public void testBug260274g() throws JavaModelException {
4863
		"	 * function on that value. Depending on the multimap implementation,\n" +
4306
	String source = 
4864
		"	 * duplicate entries (equal keys and equal values) may be collapsed.\n" +
4307
		"class X {\n" + 
4865
		"	 * \n" +
4308
		"/*\n" + 
4866
		"	 * <p>\n" +
4309
		" * **********************************************************************************\n" + 
4867
		"	 * For example,\n" +
4310
		" * **********************************************************************************\n" + 
4868
		"	 * \n" +
4311
		" * **********************************************************************************\n" + 
4869
		"	 * <pre class=\"code\">\n" +
4312
		" * The code below was added to track the view with focus\n" + 
4870
		"	 * List&lt;String> badGuys =\n" +
4313
		" * in order to support save actions from a view. Remove this\n" + 
4871
		"	 *   Arrays.asList(\"Inky\", \"Blinky\", \"Pinky\", \"Pinky\", \"Clyde\");\n" +
4314
		" * experimental code if the decision is to not allow views to \n" + 
4872
		"	 * Function&lt;String, Integer> stringLengthFunction = ...;\n" +
4315
		" * participate in save actions (see bug 10234) \n" + 
4873
		"	 * Multimap&lt;Integer, String> index = Multimaps.newHashMultimap();\n" +
4316
		" */\n" + 
4874
		"	 * Multimaps.index(badGuys, stringLengthFunction, index);\n" +
4317
		"}\n";
4875
		"	 * System.out.println(index);\n" +
4318
	formatSource(source,
4876
		"	 * </pre>\n" +
4319
		"class X {\n" + 
4877
		"	 * \n" +
4320
		"	/*\n" + 
4878
		"	 * prints\n" +
4321
		"	 * **********************************************************************************\n" + 
4879
		"	 * \n" +
4322
		"	 * **********************************************************************************\n" + 
4880
		"	 * <pre class=\"code\">\n" +
4323
		"	 * **********************************************************************************\n" + 
4881
		"	 * {4=[Inky], 5=[Pinky, Clyde], 6=[Blinky]}\n" +
4324
		"	 * The code below was added to track the view with focus in order to support\n" + 
4882
		"	 * </pre>\n" +
4325
		"	 * save actions from a view. Remove this experimental code if the decision\n" + 
4883
		"	 * \n" +
4326
		"	 * is to not allow views to participate in save actions (see bug 10234)\n" + 
4884
		"	 * The {@link HashMultimap} collapses the duplicate occurrence of\n" +
4327
		"	 */\n" + 
4885
		"	 * {@code (5, \"Pinky\")}.\n" +
4886
		"	 * \n" +
4887
		"	 * @param values\n" +
4888
		"	 *            the values to add to the multimap\n" +
4889
		"	 * @param keyFunction\n" +
4890
		"	 *            the function used to produce the key for each value\n" +
4891
		"	 * @param multimap\n" +
4892
		"	 *            the multimap to store the key value pairs\n" +
4893
		"	 */\n" +
4894
		"	void foo();\n" +
4328
		"}\n"
4895
		"}\n"
4329
	);
4896
	);
4330
}
4897
}
4331
public void testBug260274h() throws JavaModelException {
4898
public void testBug260381_wksp2_06() throws JavaModelException {
4332
	String source = 
4899
	String source =
4333
		"class X {\n" + 
4900
		"package wksp2;\n" +
4334
		"    /**\n" + 
4901
		"\n" +
4335
		"	 * @see #spacing(Point)\n" + 
4902
		"public interface I06 {\n" +
4336
		"	 * * @see #spacing(int, int)\n" + 
4903
		"\n" +
4337
		"	 */\n" + 
4904
		"  /**\n" +
4338
		"    public void foo() {\n" + 
4905
		"   * Adds a number of occurrences of an element to this multiset. Note that if\n" +
4339
		"    }\n" + 
4906
		"   * {@code occurrences == 1}, this method has the identical effect to {@link\n" +
4340
		"}\n";
4907
		"   * #add(Object)}. This method is functionally equivalent (except in the case\n" +
4341
	formatSource(source,
4908
		"   * of overflow) to the call {@code addAll(Collections.nCopies(element,\n" +
4342
		"class X {\n" + 
4909
		"   * occurrences))}, which would presumably perform much more poorly.\n" +
4343
		"	/**\n" + 
4910
		"   *\n" +
4344
		"	 * @see #spacing(Point) * @see #spacing(int, int)\n" + 
4911
		"   * @param element the element to add occurrences of; may be {@code null} only\n" +
4345
		"	 */\n" + 
4912
		"   *     if explicitly allowed by the implementation\n" +
4346
		"	public void foo() {\n" + 
4913
		"   * @param occurrences the number of occurrences of this element to add. May\n" +
4347
		"	}\n" + 
4914
		"   *     be zero, in which case no change will be made.\n" +
4915
		"   * @return the previous count of this element before the operation; possibly\n" +
4916
		"   *     zero - TODO: make this the actual behavior!\n" +
4917
		"   * @throws IllegalArgumentException if {@code occurrences} is negative, or if\n" +
4918
		"   *     this operation would result in more than {@link Integer#MAX_VALUE}\n" +
4919
		"   *     occurrences of the element \n" +
4920
		"   * @throws NullPointerException if {@code element} is null and this\n" +
4921
		"   *     implementation does not permit null elements. Note that if {@code\n" +
4922
		"   *     occurrences} is zero, the implementation may opt to return normally.\n" +
4923
		"   */\n" +
4924
		"  boolean /*int*/ add(E element, int occurrences);\n" +
4925
		"}\n";
4926
	formatSource(source,
4927
		"package wksp2;\n" +
4928
		"\n" +
4929
		"public interface I06 {\n" +
4930
		"\n" +
4931
		"	/**\n" +
4932
		"	 * Adds a number of occurrences of an element to this multiset. Note that if\n" +
4933
		"	 * {@code occurrences == 1}, this method has the identical effect to\n" +
4934
		"	 * {@link #add(Object)}. This method is functionally equivalent (except in\n" +
4935
		"	 * the case of overflow) to the call\n" +
4936
		"	 * {@code addAll(Collections.nCopies(element, occurrences))}, which would\n" +
4937
		"	 * presumably perform much more poorly.\n" +
4938
		"	 * \n" +
4939
		"	 * @param element\n" +
4940
		"	 *            the element to add occurrences of; may be {@code null} only if\n" +
4941
		"	 *            explicitly allowed by the implementation\n" +
4942
		"	 * @param occurrences\n" +
4943
		"	 *            the number of occurrences of this element to add. May be zero,\n" +
4944
		"	 *            in which case no change will be made.\n" +
4945
		"	 * @return the previous count of this element before the operation; possibly\n" +
4946
		"	 *         zero - TODO: make this the actual behavior!\n" +
4947
		"	 * @throws IllegalArgumentException\n" +
4948
		"	 *             if {@code occurrences} is negative, or if this operation\n" +
4949
		"	 *             would result in more than {@link Integer#MAX_VALUE}\n" +
4950
		"	 *             occurrences of the element\n" +
4951
		"	 * @throws NullPointerException\n" +
4952
		"	 *             if {@code element} is null and this implementation does not\n" +
4953
		"	 *             permit null elements. Note that if {@code occurrences} is\n" +
4954
		"	 *             zero, the implementation may opt to return normally.\n" +
4955
		"	 */\n" +
4956
		"	boolean /* int */add(E element, int occurrences);\n" +
4348
		"}\n"
4957
		"}\n"
4349
	);
4958
	);
4350
}
4959
}
4351
4960
public void testBug260381_wksp2_07() throws JavaModelException {
4352
/**
4961
	String source =
4353
 * @bug 260276: [formatter] Inconsistent formatting of one-line block comment
4962
		"package wksp2;\n" +
4354
 * @test Ensure that the comment formatter has a consistent behavior while formatting one-line block comment
4963
		"\n" +
4355
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=260276"
4964
		"public interface I07 {\n" +
4356
 */
4965
		"\n" +
4357
public void testBug260276() throws JavaModelException {
4966
		"  /**\n" +
4358
	String source = 
4967
		"   * Constructs a new, empty multiset, sorted according to the specified\n" +
4359
		"class X {\n" + 
4968
		"   * comparator. All elements inserted into the multiset must be <i>mutually\n" +
4360
		"/* a\n" + 
4969
		"   * comparable</i> by the specified comparator: {@code comparator.compare(e1,\n" +
4361
		"comment */\n" + 
4970
		"   * e2)} must not throw a {@code ClassCastException} for any elements {@code\n" +
4971
		"   * e1} and {@code e2} in the multiset. If the user attempts to add an element\n" +
4972
		"   * to the multiset that violates this constraint, the {@code add(Object)} call\n" +
4973
		"   * will throw a {@code ClassCastException}.\n" +
4974
		"   *\n" +
4975
		"   * @param comparator the comparator that will be used to sort this multiset. A\n" +
4976
		"   *     null value indicates that the elements\' <i>natural ordering</i> should\n" +
4977
		"   *     be used.\n" +
4978
		"   */\n" +
4979
		"  void foo();\n" +
4362
		"}\n";
4980
		"}\n";
4363
	formatSource(source,
4981
	formatSource(source,
4364
		"class X {\n" + 
4982
		"package wksp2;\n" +
4365
		"	/*\n" + 
4983
		"\n" +
4366
		"	 * a comment\n" + 
4984
		"public interface I07 {\n" +
4367
		"	 */\n" + 
4985
		"\n" +
4986
		"	/**\n" +
4987
		"	 * Constructs a new, empty multiset, sorted according to the specified\n" +
4988
		"	 * comparator. All elements inserted into the multiset must be <i>mutually\n" +
4989
		"	 * comparable</i> by the specified comparator:\n" +
4990
		"	 * {@code comparator.compare(e1, e2)} must not throw a\n" +
4991
		"	 * {@code ClassCastException} for any elements {@code e1} and {@code e2} in\n" +
4992
		"	 * the multiset. If the user attempts to add an element to the multiset that\n" +
4993
		"	 * violates this constraint, the {@code add(Object)} call will throw a\n" +
4994
		"	 * {@code ClassCastException}.\n" +
4995
		"	 * \n" +
4996
		"	 * @param comparator\n" +
4997
		"	 *            the comparator that will be used to sort this multiset. A null\n" +
4998
		"	 *            value indicates that the elements\' <i>natural ordering</i>\n" +
4999
		"	 *            should be used.\n" +
5000
		"	 */\n" +
5001
		"	void foo();\n" +
4368
		"}\n"
5002
		"}\n"
4369
	);
5003
	);
4370
}
5004
}
4371
public void testBug260276b() throws JavaModelException {
5005
public void testBug260381_wksp2_08() throws JavaModelException {
4372
	String source = 
5006
	String source =
4373
		"class X {\n" + 
5007
		"package wksp2;\n" +
4374
		"/* a\n" + 
5008
		"\n" +
4375
		" comment */\n" + 
5009
		"public interface I08 {\n" +
5010
		"\n" +
5011
		"	  /**\n" +
5012
		"	   * Returns the composition of a function and a predicate. For every {@code x},\n" +
5013
		"	   * the generated predicate returns {@code predicate(function(x))}.\n" +
5014
		"	   *\n" +
5015
		"	   * @return the composition of the provided function and predicate\n" +
5016
		"	   */\n" +
5017
		"	void foo();\n" +
4376
		"}\n";
5018
		"}\n";
4377
	formatSource(source,
5019
	formatSource(source,
4378
		"class X {\n" + 
5020
		"package wksp2;\n" +
4379
		"	/*\n" + 
5021
		"\n" +
4380
		"	 * a comment\n" + 
5022
		"public interface I08 {\n" +
4381
		"	 */\n" + 
5023
		"\n" +
5024
		"	/**\n" +
5025
		"	 * Returns the composition of a function and a predicate. For every\n" +
5026
		"	 * {@code x}, the generated predicate returns {@code predicate(function(x))}\n" +
5027
		"	 * .\n" +
5028
		"	 * \n" +
5029
		"	 * @return the composition of the provided function and predicate\n" +
5030
		"	 */\n" +
5031
		"	void foo();\n" +
4382
		"}\n"
5032
		"}\n"
4383
	);
5033
	);
4384
}
5034
}
4385
public void testBug260276c() throws JavaModelException {
5035
public void testBug260381_wksp2_09() throws JavaModelException {
4386
	String source = 
5036
	String source =
4387
		"class X {\n" + 
5037
		"package wksp2;\n" +
4388
		"/* a\n" + 
5038
		"\n" +
4389
		" * comment */\n" + 
5039
		"/**\n" +
5040
		"	A Conditional represents an if/then/else block.\n" +
5041
		"	When this is created the code  will already have\n" +
5042
		"	the conditional check code. The code is optimized for branch\n" +
5043
		"	offsets that fit in 2 bytes, though will handle 4 byte offsets.\n" +
5044
		"<code>\n" +
5045
		"     if condition\n" +
5046
		"	 then code\n" +
5047
		"	 else code\n" +
5048
		"</code>\n" +
5049
		"     what actually gets built is\n" +
5050
		"<code>\n" +
5051
		"     if !condition branch to eb:\n" +
5052
		"	  then code\n" +
5053
		"	  goto end:  // skip else\n" +
5054
		"	 eb:\n" +
5055
		"	  else code\n" +
5056
		"	 end:\n" +
5057
		"</code>\n" +
5058
		"*/\n" +
5059
		"public class X09 {\n" +
5060
		"\n" +
4390
		"}\n";
5061
		"}\n";
4391
	formatSource(source,
5062
	formatSource(source,
4392
		"class X {\n" + 
5063
		"package wksp2;\n" +
4393
		"	/*\n" + 
5064
		"\n" +
4394
		"	 * a comment\n" + 
5065
		"/**\n" +
4395
		"	 */\n" + 
5066
		" * A Conditional represents an if/then/else block. When this is created the code\n" +
5067
		" * will already have the conditional check code. The code is optimized for\n" +
5068
		" * branch offsets that fit in 2 bytes, though will handle 4 byte offsets. <code>\n" +
5069
		"     if condition\n" +
5070
		"	 then code\n" +
5071
		"	 else code\n" +
5072
		"</code>\n" +
5073
		" * what actually gets built is <code>\n" +
5074
		"     if !condition branch to eb:\n" +
5075
		"	  then code\n" +
5076
		"	  goto end:  // skip else\n" +
5077
		"	 eb:\n" +
5078
		"	  else code\n" +
5079
		"	 end:\n" +
5080
		"</code>\n" +
5081
		" */\n" +
5082
		"public class X09 {\n" +
5083
		"\n" +
4396
		"}\n"
5084
		"}\n"
4397
	);
5085
	);
4398
}
5086
}
Lines 4404-4503 Link Here
4404
 */
5092
 */
4405
public void testBug260798() throws JavaModelException {
5093
public void testBug260798() throws JavaModelException {
4406
	this.formatterPrefs.join_wrapped_lines = false;
5094
	this.formatterPrefs.join_wrapped_lines = false;
4407
	String source = 
5095
	String source =
4408
		"class X {\n" + 
5096
		"class X {\n" +
4409
		"    @Override\n" + 
5097
		"    @Override\n" +
4410
		"    public void addSelectionListener(SelectionListener listener) {\n" + 
5098
		"    public void addSelectionListener(SelectionListener listener) {\n" +
4411
		"        super.addSelectionListener(new SelectionListener() {\n" + 
5099
		"        super.addSelectionListener(new SelectionListener() {\n" +
4412
		"            @Override\n" + 
5100
		"            @Override\n" +
4413
		"            public void widgetSelected(SelectionEvent e) {\n" + 
5101
		"            public void widgetSelected(SelectionEvent e) {\n" +
4414
		"            }\n" + 
5102
		"            }\n" +
4415
		"\n" + 
5103
		"\n" +
4416
		"            @Override\n" + 
5104
		"            @Override\n" +
4417
		"            public void widgetDefaultSelected(SelectionEvent e) {\n" + 
5105
		"            public void widgetDefaultSelected(SelectionEvent e) {\n" +
4418
		"            };\n" + 
5106
		"            };\n" +
4419
		"        });\n" + 
5107
		"        });\n" +
4420
		"    }\n" + 
5108
		"    }\n" +
4421
		"}\n";
5109
		"}\n";
4422
	formatSource(source,
5110
	formatSource(source,
4423
		"class X {\n" + 
5111
		"class X {\n" +
4424
		"	@Override\n" + 
5112
		"	@Override\n" +
4425
		"	public void addSelectionListener(SelectionListener listener) {\n" + 
5113
		"	public void addSelectionListener(SelectionListener listener) {\n" +
4426
		"		super.addSelectionListener(new SelectionListener() {\n" + 
5114
		"		super.addSelectionListener(new SelectionListener() {\n" +
4427
		"			@Override\n" + 
5115
		"			@Override\n" +
4428
		"			public void widgetSelected(SelectionEvent e) {\n" + 
5116
		"			public void widgetSelected(SelectionEvent e) {\n" +
4429
		"			}\n" + 
5117
		"			}\n" +
4430
		"\n" + 
5118
		"\n" +
4431
		"			@Override\n" + 
5119
		"			@Override\n" +
4432
		"			public void widgetDefaultSelected(SelectionEvent e) {\n" + 
5120
		"			public void widgetDefaultSelected(SelectionEvent e) {\n" +
4433
		"			};\n" + 
5121
		"			};\n" +
4434
		"		});\n" + 
5122
		"		});\n" +
4435
		"	}\n" + 
5123
		"	}\n" +
4436
		"}\n"
5124
		"}\n"
4437
	);
5125
	);
4438
}
5126
}
4439
public void testBug260798b() throws JavaModelException {
5127
public void testBug260798b() throws JavaModelException {
4440
	this.formatterPrefs.join_wrapped_lines = false;
5128
	this.formatterPrefs.join_wrapped_lines = false;
4441
	String source = 
5129
	String source =
4442
		"class X {\n" + 
5130
		"class X {\n" +
4443
		"\n" + 
5131
		"\n" +
4444
		"    void foo() {\n" + 
5132
		"    void foo() {\n" +
4445
		"        this.bar(new Object() {\n" + 
5133
		"        this.bar(new Object() {\n" +
4446
		"            @Override\n" + 
5134
		"            @Override\n" +
4447
		"            public String toString() {\n" + 
5135
		"            public String toString() {\n" +
4448
		"                return \"\";\n" + 
5136
		"                return \"\";\n" +
4449
		"            }\n" + 
5137
		"            }\n" +
4450
		"        });\n" + 
5138
		"        });\n" +
4451
		"    }\n" + 
5139
		"    }\n" +
4452
		"}\n";
5140
		"}\n";
4453
	formatSource(source,
5141
	formatSource(source,
4454
		"class X {\n" + 
5142
		"class X {\n" +
4455
		"\n" + 
5143
		"\n" +
4456
		"	void foo() {\n" + 
5144
		"	void foo() {\n" +
4457
		"		this.bar(new Object() {\n" + 
5145
		"		this.bar(new Object() {\n" +
4458
		"			@Override\n" + 
5146
		"			@Override\n" +
4459
		"			public String toString() {\n" + 
5147
		"			public String toString() {\n" +
4460
		"				return \"\";\n" + 
5148
		"				return \"\";\n" +
4461
		"			}\n" + 
5149
		"			}\n" +
4462
		"		});\n" + 
5150
		"		});\n" +
4463
		"	}\n" + 
5151
		"	}\n" +
4464
		"}\n"
5152
		"}\n"
4465
	);
5153
	);
4466
}
5154
}
4467
public void testBug260798c() throws JavaModelException {
5155
public void testBug260798c() throws JavaModelException {
4468
	this.formatterPrefs.join_wrapped_lines = false;
5156
	this.formatterPrefs.join_wrapped_lines = false;
4469
	String source = 
5157
	String source =
4470
		"class X {\n" + 
5158
		"class X {\n" +
4471
		"\n" + 
5159
		"\n" +
4472
		"{\n" + 
5160
		"{\n" +
4473
		"    this.bar(new Object() {\n" + 
5161
		"    this.bar(new Object() {\n" +
4474
		"        @Override\n" + 
5162
		"        @Override\n" +
4475
		"        public String toString() {\n" + 
5163
		"        public String toString() {\n" +
4476
		"            return \"\";\n" + 
5164
		"            return \"\";\n" +
4477
		"        }\n" + 
5165
		"        }\n" +
4478
		"    });\n" + 
5166
		"    });\n" +
4479
		"}\n" + 
5167
		"}\n" +
4480
		"    void bar(Object object) {\n" + 
5168
		"    void bar(Object object) {\n" +
4481
		"        \n" + 
5169
		"        \n" +
4482
		"    }\n" + 
5170
		"    }\n" +
4483
		"\n" + 
5171
		"\n" +
4484
		"}\n";
5172
		"}\n";
4485
	formatSource(source,
5173
	formatSource(source,
4486
		"class X {\n" + 
5174
		"class X {\n" +
4487
		"\n" + 
5175
		"\n" +
4488
		"	{\n" + 
5176
		"	{\n" +
4489
		"		this.bar(new Object() {\n" + 
5177
		"		this.bar(new Object() {\n" +
4490
		"			@Override\n" + 
5178
		"			@Override\n" +
4491
		"			public String toString() {\n" + 
5179
		"			public String toString() {\n" +
4492
		"				return \"\";\n" + 
5180
		"				return \"\";\n" +
4493
		"			}\n" + 
5181
		"			}\n" +
4494
		"		});\n" + 
5182
		"		});\n" +
4495
		"	}\n" + 
5183
		"	}\n" +
4496
		"\n" + 
5184
		"\n" +
4497
		"	void bar(Object object) {\n" + 
5185
		"	void bar(Object object) {\n" +
4498
		"\n" + 
5186
		"\n" +
4499
		"	}\n" + 
5187
		"	}\n" +
4500
		"\n" + 
5188
		"\n" +
4501
		"}\n"
5189
		"}\n"
4502
	);
5190
	);
4503
}
5191
}
Lines 4508-4525 Link Here
4508
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=267551"
5196
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=267551"
4509
 */
5197
 */
4510
public void testBug267551() throws JavaModelException {
5198
public void testBug267551() throws JavaModelException {
4511
	String source = 
5199
	String source =
4512
		"import java.lang.annotation.*;\n" + 
5200
		"import java.lang.annotation.*;\n" +
4513
		"\n" + 
5201
		"\n" +
4514
		"@Target({ ElementType.ANNOTATION_TYPE })\n" + 
5202
		"@Target({ ElementType.ANNOTATION_TYPE })\n" +
4515
		"@Retention(RetentionPolicy.RUNTIME)\n" + 
5203
		"@Retention(RetentionPolicy.RUNTIME)\n" +
4516
		"public @interface Foo { }\n";
5204
		"public @interface Foo { }\n";
4517
	formatSource(source,
5205
	formatSource(source,
4518
		"import java.lang.annotation.*;\n" + 
5206
		"import java.lang.annotation.*;\n" +
4519
		"\n" + 
5207
		"\n" +
4520
		"@Target({ ElementType.ANNOTATION_TYPE })\n" + 
5208
		"@Target({ ElementType.ANNOTATION_TYPE })\n" +
4521
		"@Retention(RetentionPolicy.RUNTIME)\n" + 
5209
		"@Retention(RetentionPolicy.RUNTIME)\n" +
4522
		"public @interface Foo {\n" + 
5210
		"public @interface Foo {\n" +
4523
		"}\n"
5211
		"}\n"
4524
	);
5212
	);
4525
}
5213
}
Lines 4534-4574 Link Here
4534
	this.formatterPrefs.comment_format_javadoc_comment = false;
5222
	this.formatterPrefs.comment_format_javadoc_comment = false;
4535
	this.formatterPrefs.comment_format_block_comment = true;
5223
	this.formatterPrefs.comment_format_block_comment = true;
4536
	this.formatterPrefs.comment_format_line_comment = false;
5224
	this.formatterPrefs.comment_format_line_comment = false;
4537
	String source = 
5225
	String source =
4538
		"/**\n" + 
5226
		"/**\n" +
4539
		" * Test for\n" + 
5227
		" * Test for\n" +
4540
		" * bug 267658\n" + 
5228
		" * bug 267658\n" +
4541
		" */\n" + 
5229
		" */\n" +
4542
		"package javadoc;\n" + 
5230
		"package javadoc;\n" +
4543
		"\n" + 
5231
		"\n" +
4544
		"/**\n" + 
5232
		"/**\n" +
4545
		" * Test for\n" + 
5233
		" * Test for\n" +
4546
		" * bug 267658\n" + 
5234
		" * bug 267658\n" +
4547
		" */\n" + 
5235
		" */\n" +
4548
		"public class Test {\n" + 
5236
		"public class Test {\n" +
4549
		"/**\n" + 
5237
		"/**\n" +
4550
		" * Test for\n" + 
5238
		" * Test for\n" +
4551
		" * bug 267658\n" + 
5239
		" * bug 267658\n" +
4552
		" */\n" + 
5240
		" */\n" +
4553
		"int field;\n" + 
5241
		"int field;\n" +
4554
		"}\n";
5242
		"}\n";
4555
	formatSource(source,
5243
	formatSource(source,
4556
		"/**\n" + 
5244
		"/**\n" +
4557
		" * Test for\n" + 
5245
		" * Test for\n" +
4558
		" * bug 267658\n" + 
5246
		" * bug 267658\n" +
4559
		" */\n" + 
5247
		" */\n" +
4560
		"package javadoc;\n" + 
5248
		"package javadoc;\n" +
4561
		"\n" + 
5249
		"\n" +
4562
		"/**\n" + 
5250
		"/**\n" +
4563
		" * Test for\n" + 
5251
		" * Test for\n" +
4564
		" * bug 267658\n" + 
5252
		" * bug 267658\n" +
4565
		" */\n" + 
5253
		" */\n" +
4566
		"public class Test {\n" + 
5254
		"public class Test {\n" +
4567
		"	/**\n" + 
5255
		"	/**\n" +
4568
		"	 * Test for\n" + 
5256
		"	 * Test for\n" +
4569
		"	 * bug 267658\n" + 
5257
		"	 * bug 267658\n" +
4570
		"	 */\n" + 
5258
		"	 */\n" +
4571
		"	int field;\n" + 
5259
		"	int field;\n" +
4572
		"}\n"
5260
		"}\n"
4573
	);
5261
	);
4574
}
5262
}
Lines 4576-4594 Link Here
4576
	this.formatterPrefs.comment_format_javadoc_comment = false;
5264
	this.formatterPrefs.comment_format_javadoc_comment = false;
4577
	this.formatterPrefs.comment_format_block_comment = true;
5265
	this.formatterPrefs.comment_format_block_comment = true;
4578
	this.formatterPrefs.comment_format_line_comment = false;
5266
	this.formatterPrefs.comment_format_line_comment = false;
4579
	String source = 
5267
	String source =
4580
		"public class Test {\n" + 
5268
		"public class Test {\n" +
4581
		"/**\n" + 
5269
		"/**\n" +
4582
		" * @test bug\n" + 
5270
		" * @test bug\n" +
4583
		" */\n" + 
5271
		" */\n" +
4584
		"int field;\n" + 
5272
		"int field;\n" +
4585
		"}\n";
5273
		"}\n";
4586
	formatSource(source,
5274
	formatSource(source,
4587
		"public class Test {\n" + 
5275
		"public class Test {\n" +
4588
		"	/**\n" + 
5276
		"	/**\n" +
4589
		"	 * @test bug\n" + 
5277
		"	 * @test bug\n" +
4590
		"	 */\n" + 
5278
		"	 */\n" +
4591
		"	int field;\n" + 
5279
		"	int field;\n" +
4592
		"}\n"
5280
		"}\n"
4593
	);
5281
	);
4594
}
5282
}
Lines 4599-4638 Link Here
4599
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=273619"
5287
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=273619"
4600
 */
5288
 */
4601
public void testBug273619a() throws JavaModelException {
5289
public void testBug273619a() throws JavaModelException {
4602
	String source = 
5290
	String source =
4603
		"/**\n" + 
5291
		"/**\n" +
4604
		" * <ul>\n" + 
5292
		" * <ul>\n" +
4605
		" * <li>{@code *}</li>\n" + 
5293
		" * <li>{@code *}</li>\n" +
4606
		" * </ul>\n" + 
5294
		" * </ul>\n" +
4607
		" */\n" + 
5295
		" */\n" +
4608
		"public class X {\n" +
5296
		"public class X {\n" +
4609
		"}\n";
5297
		"}\n";
4610
	formatSource(source,
5298
	formatSource(source,
4611
		"/**\n" + 
5299
		"/**\n" +
4612
		" * <ul>\n" + 
5300
		" * <ul>\n" +
4613
		" * <li>{@code *}</li>\n" + 
5301
		" * <li>{@code *}</li>\n" +
4614
		" * </ul>\n" + 
5302
		" * </ul>\n" +
4615
		" */\n" + 
5303
		" */\n" +
4616
		"public class X {\n" + 
5304
		"public class X {\n" +
4617
		"}\n"
5305
		"}\n"
4618
	);
5306
	);
4619
}
5307
}
4620
public void testBug273619b() throws JavaModelException {
5308
public void testBug273619b() throws JavaModelException {
4621
	String source = 
5309
	String source =
4622
		"/**\n" + 
5310
		"/**\n" +
4623
		" * <p>\n" + 
5311
		" * <p>\n" +
4624
		" * {@link *}\n" + 
5312
		" * {@link *}\n" +
4625
		" * </p>\n" + 
5313
		" * </p>\n" +
4626
		" */\n" + 
5314
		" */\n" +
4627
		"public class X {\n" +
5315
		"public class X {\n" +
4628
		"}\n";
5316
		"}\n";
4629
	formatSource(source,
5317
	formatSource(source,
4630
		"/**\n" + 
5318
		"/**\n" +
4631
		" * <p>\n" + 
5319
		" * <p>\n" +
4632
		" * {@link *}\n" + 
5320
		" * {@link *}\n" +
4633
		" * </p>\n" + 
5321
		" * </p>\n" +
4634
		" */\n" + 
5322
		" */\n" +
4635
		"public class X {\n" + 
5323
		"public class X {\n" +
4636
		"}\n"
5324
		"}\n"
4637
	);
5325
	);
4638
}
5326
}
Lines 4645-4679 Link Here
4645
 */
5333
 */
4646
public void testBug279359() throws JavaModelException {
5334
public void testBug279359() throws JavaModelException {
4647
	this.formatterPrefs.join_wrapped_lines = false;
5335
	this.formatterPrefs.join_wrapped_lines = false;
4648
	String source = 
5336
	String source =
4649
		"public class Formatter {\n" + 
5337
		"public class Formatter {\n" +
4650
		"\n" + 
5338
		"\n" +
4651
		"        public static void main(String[] args) {\n" + 
5339
		"        public static void main(String[] args) {\n" +
4652
		"\n" + 
5340
		"\n" +
4653
		"                Executors.newCachedThreadPool().execute(new Runnable() {\n" + 
5341
		"                Executors.newCachedThreadPool().execute(new Runnable() {\n" +
4654
		"\n" + 
5342
		"\n" +
4655
		"                        public void run() {\n" + 
5343
		"                        public void run() {\n" +
4656
		"                                throw new UnsupportedOperationException(\"stub\");\n" + 
5344
		"                                throw new UnsupportedOperationException(\"stub\");\n" +
4657
		"                        }\n" + 
5345
		"                        }\n" +
4658
		"\n" + 
5346
		"\n" +
4659
		"                });\n" + 
5347
		"                });\n" +
4660
		"\n" + 
5348
		"\n" +
4661
		"        }\n" + 
5349
		"        }\n" +
4662
		"}\n";
5350
		"}\n";
4663
	formatSource(source,
5351
	formatSource(source,
4664
		"public class Formatter {\n" + 
5352
		"public class Formatter {\n" +
4665
		"\n" + 
5353
		"\n" +
4666
		"	public static void main(String[] args) {\n" + 
5354
		"	public static void main(String[] args) {\n" +
4667
		"\n" + 
5355
		"\n" +
4668
		"		Executors.newCachedThreadPool().execute(new Runnable() {\n" + 
5356
		"		Executors.newCachedThreadPool().execute(new Runnable() {\n" +
4669
		"\n" + 
5357
		"\n" +
4670
		"			public void run() {\n" + 
5358
		"			public void run() {\n" +
4671
		"				throw new UnsupportedOperationException(\"stub\");\n" + 
5359
		"				throw new UnsupportedOperationException(\"stub\");\n" +
4672
		"			}\n" + 
5360
		"			}\n" +
4673
		"\n" + 
5361
		"\n" +
4674
		"		});\n" + 
5362
		"		});\n" +
4675
		"\n" + 
5363
		"\n" +
4676
		"	}\n" + 
5364
		"	}\n" +
4677
		"}\n"
5365
		"}\n"
4678
	);
5366
	);
4679
}
5367
}
Lines 4685-4733 Link Here
4685
 */
5373
 */
4686
public void testBug280061() throws JavaModelException {
5374
public void testBug280061() throws JavaModelException {
4687
	this.formatterOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3);
5375
	this.formatterOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3);
4688
	String source = 
5376
	String source =
4689
		"public interface X {\n" + 
5377
		"public interface X {\n" +
4690
		"/**\n" + 
5378
		"/**\n" +
4691
		" * <pre>\n" + 
5379
		" * <pre>\n" +
4692
		" *   void solve(Executor e,\n" + 
5380
		" *   void solve(Executor e,\n" +
4693
		" *              Collection&lt;Callable&lt;Result&gt;&gt; solvers)\n" + 
5381
		" *              Collection&lt;Callable&lt;Result&gt;&gt; solvers)\n" +
4694
		" *     throws InterruptedException, ExecutionException {\n" + 
5382
		" *     throws InterruptedException, ExecutionException {\n" +
4695
		" *       CompletionService&lt;Result&gt; ecs\n" + 
5383
		" *       CompletionService&lt;Result&gt; ecs\n" +
4696
		" *           = new ExecutorCompletionService&lt;Result&gt;(e);\n" + 
5384
		" *           = new ExecutorCompletionService&lt;Result&gt;(e);\n" +
4697
		" *       for (Callable&lt;Result&gt; s : solvers)\n" + 
5385
		" *       for (Callable&lt;Result&gt; s : solvers)\n" +
4698
		" *           ecs.submit(s);\n" + 
5386
		" *           ecs.submit(s);\n" +
4699
		" *       int n = solvers.size();\n" + 
5387
		" *       int n = solvers.size();\n" +
4700
		" *       for (int i = 0; i &lt; n; ++i) {\n" + 
5388
		" *       for (int i = 0; i &lt; n; ++i) {\n" +
4701
		" *           Result r = ecs.take().get();\n" + 
5389
		" *           Result r = ecs.take().get();\n" +
4702
		" *           if (r != null)\n" + 
5390
		" *           if (r != null)\n" +
4703
		" *               use(r);\n" + 
5391
		" *               use(r);\n" +
4704
		" *       }\n" + 
5392
		" *       }\n" +
4705
		" *   }\n" + 
5393
		" *   }\n" +
4706
		" * </pre>\n" + 
5394
		" * </pre>\n" +
4707
		" */\n" + 
5395
		" */\n" +
4708
		" void foo();\n" + 
5396
		" void foo();\n" +
4709
		"}\n";
5397
		"}\n";
4710
	formatSource(source,
5398
	formatSource(source,
4711
		"public interface X {\n" + 
5399
		"public interface X {\n" +
4712
		"	/**\n" + 
5400
		"	/**\n" +
4713
		"	 * <pre>\n" + 
5401
		"	 * <pre>\n" +
4714
		"	 * void solve(Executor e,\n" + 
5402
		"	 * void solve(Executor e,\n" +
4715
		"	 *              Collection&lt;Callable&lt;Result&gt;&gt; solvers)\n" + 
5403
		"	 *              Collection&lt;Callable&lt;Result&gt;&gt; solvers)\n" +
4716
		"	 *     throws InterruptedException, ExecutionException {\n" + 
5404
		"	 *     throws InterruptedException, ExecutionException {\n" +
4717
		"	 *       CompletionService&lt;Result&gt; ecs\n" + 
5405
		"	 *       CompletionService&lt;Result&gt; ecs\n" +
4718
		"	 *           = new ExecutorCompletionService&lt;Result&gt;(e);\n" + 
5406
		"	 *           = new ExecutorCompletionService&lt;Result&gt;(e);\n" +
4719
		"	 *       for (Callable&lt;Result&gt; s : solvers)\n" + 
5407
		"	 *       for (Callable&lt;Result&gt; s : solvers)\n" +
4720
		"	 *           ecs.submit(s);\n" + 
5408
		"	 *           ecs.submit(s);\n" +
4721
		"	 *       int n = solvers.size();\n" + 
5409
		"	 *       int n = solvers.size();\n" +
4722
		"	 *       for (int i = 0; i &lt; n; ++i) {\n" + 
5410
		"	 *       for (int i = 0; i &lt; n; ++i) {\n" +
4723
		"	 *           Result r = ecs.take().get();\n" + 
5411
		"	 *           Result r = ecs.take().get();\n" +
4724
		"	 *           if (r != null)\n" + 
5412
		"	 *           if (r != null)\n" +
4725
		"	 *               use(r);\n" + 
5413
		"	 *               use(r);\n" +
4726
		"	 *       }\n" + 
5414
		"	 *       }\n" +
4727
		"	 *   }\n" + 
5415
		"	 *   }\n" +
4728
		"	 * </pre>\n" + 
5416
		"	 * </pre>\n" +
4729
		"	 */\n" + 
5417
		"	 */\n" +
4730
		"	void foo();\n" + 
5418
		"	void foo();\n" +
4731
		"}\n"
5419
		"}\n"
4732
	);
5420
	);
4733
}
5421
}
Lines 4740-4800 Link Here
4740
 */
5428
 */
4741
public void testBug280255() throws JavaModelException {
5429
public void testBug280255() throws JavaModelException {
4742
	this.formatterPrefs.indent_empty_lines = true;
5430
	this.formatterPrefs.indent_empty_lines = true;
4743
	String source = 
5431
	String source =
4744
		"public class X {\n" + 
5432
		"public class X {\n" +
4745
		"	private void foo(int val) {\n" + 
5433
		"	private void foo(int val) {\n" +
4746
		"		switch (val) {\n" + 
5434
		"		switch (val) {\n" +
4747
		"			case 0:\n" + 
5435
		"			case 0:\n" +
4748
		"			{\n" + 
5436
		"			{\n" +
4749
		"\n" + 
5437
		"\n" +
4750
		"\n" + 
5438
		"\n" +
4751
		"[#				return ;#]\n" + 
5439
		"[#				return ;#]\n" +
4752
		"			}\n" + 
5440
		"			}\n" +
4753
		"		}\n" + 
5441
		"		}\n" +
4754
		"	}\n" + 
5442
		"	}\n" +
4755
		"}\n";
5443
		"}\n";
4756
	formatSource(source,
5444
	formatSource(source,
4757
		"public class X {\n" + 
5445
		"public class X {\n" +
4758
		"	private void foo(int val) {\n" + 
5446
		"	private void foo(int val) {\n" +
4759
		"		switch (val) {\n" + 
5447
		"		switch (val) {\n" +
4760
		"			case 0:\n" + 
5448
		"			case 0:\n" +
4761
		"			{\n" + 
5449
		"			{\n" +
4762
		"\n" + 
5450
		"\n" +
4763
		"\n" + 
5451
		"\n" +
4764
		"			return;\n" + 
5452
		"			return;\n" +
4765
		"			}\n" + 
5453
		"			}\n" +
4766
		"		}\n" + 
5454
		"		}\n" +
4767
		"	}\n" + 
5455
		"	}\n" +
4768
		"}\n"
5456
		"}\n"
4769
	);
5457
	);
4770
}
5458
}
4771
public void testBug280255b() throws JavaModelException {
5459
public void testBug280255b() throws JavaModelException {
4772
	this.formatterPrefs.indent_empty_lines = true;
5460
	this.formatterPrefs.indent_empty_lines = true;
4773
	String source = 
5461
	String source =
4774
		"public class X {\r\n" + 
5462
		"public class X {\r\n" +
4775
		"	private void foo(int val) {\r\n" + 
5463
		"	private void foo(int val) {\r\n" +
4776
		"		switch (val) {\r\n" + 
5464
		"		switch (val) {\r\n" +
4777
		"			case 0:\r\n" + 
5465
		"			case 0:\r\n" +
4778
		"			{\r\n" + 
5466
		"			{\r\n" +
4779
		"\r\n" + 
5467
		"\r\n" +
4780
		"\r\n" + 
5468
		"\r\n" +
4781
		"[#				return ;#]\r\n" + 
5469
		"[#				return ;#]\r\n" +
4782
		"			}\r\n" + 
5470
		"			}\r\n" +
4783
		"		}\r\n" + 
5471
		"		}\r\n" +
4784
		"	}\r\n" + 
5472
		"	}\r\n" +
4785
		"}\r\n";
5473
		"}\r\n";
4786
	formatSource(source,
5474
	formatSource(source,
4787
		"public class X {\r\n" + 
5475
		"public class X {\r\n" +
4788
		"	private void foo(int val) {\r\n" + 
5476
		"	private void foo(int val) {\r\n" +
4789
		"		switch (val) {\r\n" + 
5477
		"		switch (val) {\r\n" +
4790
		"			case 0:\r\n" + 
5478
		"			case 0:\r\n" +
4791
		"			{\r\n" + 
5479
		"			{\r\n" +
4792
		"\r\n" + 
5480
		"\r\n" +
4793
		"\r\n" + 
5481
		"\r\n" +
4794
		"			return;\r\n" + 
5482
		"			return;\r\n" +
4795
		"			}\r\n" + 
5483
		"			}\r\n" +
4796
		"		}\r\n" + 
5484
		"		}\r\n" +
4797
		"	}\r\n" + 
5485
		"	}\r\n" +
4798
		"}\r\n"
5486
		"}\r\n"
4799
	);
5487
	);
4800
}
5488
}
Lines 4805-4862 Link Here
4805
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=280616"
5493
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=280616"
4806
 */
5494
 */
4807
public void testBug280616() throws JavaModelException {
5495
public void testBug280616() throws JavaModelException {
4808
	String source = 
5496
	String source =
4809
		"public interface X {\n" + 
5497
		"public interface X {\n" +
4810
		"/**\n" + 
5498
		"/**\n" +
4811
		" * <pre>\n" + 
5499
		" * <pre>\n" +
4812
		" *   void solve(Executor e,\n" + 
5500
		" *   void solve(Executor e,\n" +
4813
		" *              Collection&lt;Callable&lt;Result&gt;&gt; solvers)\n" + 
5501
		" *              Collection&lt;Callable&lt;Result&gt;&gt; solvers)\n" +
4814
		" *     throws InterruptedException, ExecutionException {\n" + 
5502
		" *     throws InterruptedException, ExecutionException {\n" +
4815
		" *       CompletionService&lt;Result&gt; ecs\n" + 
5503
		" *       CompletionService&lt;Result&gt; ecs\n" +
4816
		" *           = new ExecutorCompletionService&lt;Result&gt;(e);\n" + 
5504
		" *           = new ExecutorCompletionService&lt;Result&gt;(e);\n" +
4817
		" *       for (Callable&lt;Result&gt; s : solvers)\n" + 
5505
		" *       for (Callable&lt;Result&gt; s : solvers)\n" +
4818
		" *           ecs.submit(s);\n" + 
5506
		" *           ecs.submit(s);\n" +
4819
		" *       int n = solvers.size();\n" + 
5507
		" *       int n = solvers.size();\n" +
4820
		" *       for (int i = 0; i &lt; n; ++i) {\n" + 
5508
		" *       for (int i = 0; i &lt; n; ++i) {\n" +
4821
		" *           Result r = ecs.take().get();\n" + 
5509
		" *           Result r = ecs.take().get();\n" +
4822
		" *           if (r != null)\n" + 
5510
		" *           if (r != null)\n" +
4823
		" *               use(r);\n" + 
5511
		" *               use(r);\n" +
4824
		" *       }\n" + 
5512
		" *       }\n" +
4825
		" *   }\n" + 
5513
		" *   }\n" +
4826
		" * </pre>\n" + 
5514
		" * </pre>\n" +
4827
		" */\n" + 
5515
		" */\n" +
4828
		" void foo();\n" + 
5516
		" void foo();\n" +
4829
		"}\n";
5517
		"}\n";
4830
	formatSource(source,
5518
	formatSource(source,
4831
		"public interface X {\n" + 
5519
		"public interface X {\n" +
4832
		"	/**\n" + 
5520
		"	/**\n" +
4833
		"	 * <pre>\n" + 
5521
		"	 * <pre>\n" +
4834
		"	 * void solve(Executor e, Collection&lt;Callable&lt;Result&gt;&gt; solvers)\n" + 
5522
		"	 * void solve(Executor e, Collection&lt;Callable&lt;Result&gt;&gt; solvers)\n" +
4835
		"	 * 		throws InterruptedException, ExecutionException {\n" + 
5523
		"	 * 		throws InterruptedException, ExecutionException {\n" +
4836
		"	 * 	CompletionService&lt;Result&gt; ecs = new ExecutorCompletionService&lt;Result&gt;(e);\n" + 
5524
		"	 * 	CompletionService&lt;Result&gt; ecs = new ExecutorCompletionService&lt;Result&gt;(e);\n" +
4837
		"	 * 	for (Callable&lt;Result&gt; s : solvers)\n" + 
5525
		"	 * 	for (Callable&lt;Result&gt; s : solvers)\n" +
4838
		"	 * 		ecs.submit(s);\n" + 
5526
		"	 * 		ecs.submit(s);\n" +
4839
		"	 * 	int n = solvers.size();\n" + 
5527
		"	 * 	int n = solvers.size();\n" +
4840
		"	 * 	for (int i = 0; i &lt; n; ++i) {\n" + 
5528
		"	 * 	for (int i = 0; i &lt; n; ++i) {\n" +
4841
		"	 * 		Result r = ecs.take().get();\n" + 
5529
		"	 * 		Result r = ecs.take().get();\n" +
4842
		"	 * 		if (r != null)\n" + 
5530
		"	 * 		if (r != null)\n" +
4843
		"	 * 			use(r);\n" + 
5531
		"	 * 			use(r);\n" +
4844
		"	 * 	}\n" + 
5532
		"	 * 	}\n" +
4845
		"	 * }\n" + 
5533
		"	 * }\n" +
4846
		"	 * </pre>\n" + 
5534
		"	 * </pre>\n" +
4847
		"	 */\n" + 
5535
		"	 */\n" +
4848
		"	void foo();\n" + 
5536
		"	void foo();\n" +
4849
		"}\n"
5537
		"}\n"
4850
	);
5538
	);
4851
}
5539
}
4852
5540
4853
/**
5541
/**
4854
 * @bug 287833: [formatter] Formatter removes the first character after the * in the <pre> tag 
5542
 * @bug 287833: [formatter] Formatter removes the first character after the * in the <pre> tag
4855
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=287833"
5543
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=287833"
4856
 */
5544
 */
4857
public void testBug287833a() {
5545
public void testBug287833a() {
4858
	String source = 
5546
	String source =
4859
		"public class test1 {\n" + 
5547
		"public class test1 {\n" +
4860
	    "/**\n"+
5548
	    "/**\n"+
4861
	    "* <pre>\n"+
5549
	    "* <pre>\n"+
4862
	    "*void foo() {\n"+
5550
	    "*void foo() {\n"+
Lines 4866-4873 Link Here
4866
	    "void foo() {\n"+
5554
	    "void foo() {\n"+
4867
	    "}\n"+
5555
	    "}\n"+
4868
	    "}\n";
5556
	    "}\n";
4869
	    
5557
4870
	formatSource(source, 
5558
	formatSource(source,
4871
		"public class test1 {\n"+
5559
		"public class test1 {\n"+
4872
	    "	/**\n"+
5560
	    "	/**\n"+
4873
	    "	 * <pre>\n"+
5561
	    "	 * <pre>\n"+
Lines 4880-4887 Link Here
4880
	    "}\n");
5568
	    "}\n");
4881
}
5569
}
4882
public void testBug287833b() {
5570
public void testBug287833b() {
4883
	String source = 
5571
	String source =
4884
		"public class test1 {\n" + 
5572
		"public class test1 {\n" +
4885
	    "/**\n"+
5573
	    "/**\n"+
4886
	    "* <pre>\n"+
5574
	    "* <pre>\n"+
4887
	    "* void foo() {\n"+
5575
	    "* void foo() {\n"+
Lines 4892-4899 Link Here
4892
	    "void foo() {\n"+
5580
	    "void foo() {\n"+
4893
	    "}\n"+
5581
	    "}\n"+
4894
	    "}\n";
5582
	    "}\n";
4895
	    
5583
4896
	formatSource(source, 
5584
	formatSource(source,
4897
		"public class test1 {\n"+
5585
		"public class test1 {\n"+
4898
	    "	/**\n"+
5586
	    "	/**\n"+
4899
	    "	 * <pre>\n"+
5587
	    "	 * <pre>\n"+
Lines 4907-4914 Link Here
4907
	    "}\n");
5595
	    "}\n");
4908
}
5596
}
4909
public void testBug287833c() {
5597
public void testBug287833c() {
4910
	String source = 
5598
	String source =
4911
		"public class test1 {\n" + 
5599
		"public class test1 {\n" +
4912
	    "/**\n"+
5600
	    "/**\n"+
4913
	    "* <pre>\n"+
5601
	    "* <pre>\n"+
4914
	    "* void foo() {\n"+
5602
	    "* void foo() {\n"+
Lines 4919-4926 Link Here
4919
	    "void foo() {\n"+
5607
	    "void foo() {\n"+
4920
	    "}\n"+
5608
	    "}\n"+
4921
	    "}\n";
5609
	    "}\n";
4922
	    
5610
4923
	formatSource(source, 
5611
	formatSource(source,
4924
		"public class test1 {\n"+
5612
		"public class test1 {\n"+
4925
	    "	/**\n"+
5613
	    "	/**\n"+
4926
	    "	 * <pre>\n"+
5614
	    "	 * <pre>\n"+
Lines 4940-4995 Link Here
4940
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=300379"
5628
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=300379"
4941
 */
5629
 */
4942
public void testBug300379() {
5630
public void testBug300379() {
4943
	String source = 
5631
	String source =
4944
		"public class X {\n" + 
5632
		"public class X {\n" +
4945
		"    /**\n" + 
5633
		"    /**\n" +
4946
		"     * <pre>   {@code\n" + 
5634
		"     * <pre>   {@code\n" +
4947
		"     * \n" + 
5635
		"     * \n" +
4948
		"     *   public class X {\n" + 
5636
		"     *   public class X {\n" +
4949
		"     *   }}</pre>\n" + 
5637
		"     *   }}</pre>\n" +
4950
		"     */\n" + 
5638
		"     */\n" +
4951
		"    public void foo() {}\n" + 
5639
		"    public void foo() {}\n" +
4952
	    "}\n";
5640
	    "}\n";
4953
	    
5641
4954
	formatSource(source, 
5642
	formatSource(source,
4955
		"public class X {\n" + 
5643
		"public class X {\n" +
4956
		"	/**\n" + 
5644
		"	/**\n" +
4957
		"	 * <pre>\n" + 
5645
		"	 * <pre>\n" +
4958
		"	 * {\n" + 
5646
		"	 * {\n" +
4959
		"	 * 	&#064;code\n" + 
5647
		"	 * 	&#064;code\n" +
4960
		"	 * 	public class X {\n" + 
5648
		"	 * 	public class X {\n" +
4961
		"	 * 	}\n" + 
5649
		"	 * 	}\n" +
4962
		"	 * }\n" + 
5650
		"	 * }\n" +
4963
		"	 * </pre>\n" + 
5651
		"	 * </pre>\n" +
4964
		"	 */\n" + 
5652
		"	 */\n" +
4965
		"	public void foo() {\n" + 
5653
		"	public void foo() {\n" +
4966
		"	}\n" + 
5654
		"	}\n" +
4967
	    "}\n");
5655
	    "}\n");
4968
}
5656
}
4969
public void testBug300379b() {
5657
public void testBug300379b() {
4970
	String source = 
5658
	String source =
4971
		"public class X {\n" + 
5659
		"public class X {\n" +
4972
		"    /**\n" + 
5660
		"    /**\n" +
4973
		"     * <pre>   {@code\n" + 
5661
		"     * <pre>   {@code\n" +
4974
		"     * \n" + 
5662
		"     * \n" +
4975
		"     *   public class X {}}</pre>\n" + 
5663
		"     *   public class X {}}</pre>\n" +
4976
		"     */\n" + 
5664
		"     */\n" +
4977
		"    public void foo() {}\n" + 
5665
		"    public void foo() {}\n" +
4978
	    "}\n";
5666
	    "}\n";
4979
	    
5667
4980
	formatSource(source, 
5668
	formatSource(source,
4981
		"public class X {\n" + 
5669
		"public class X {\n" +
4982
		"	/**\n" + 
5670
		"	/**\n" +
4983
		"	 * <pre>\n" + 
5671
		"	 * <pre>\n" +
4984
		"	 * {\n" + 
5672
		"	 * {\n" +
4985
		"	 * 	&#064;code\n" + 
5673
		"	 * 	&#064;code\n" +
4986
		"	 * 	public class X {\n" + 
5674
		"	 * 	public class X {\n" +
4987
		"	 * 	}\n" + 
5675
		"	 * 	}\n" +
4988
		"	 * }\n" + 
5676
		"	 * }\n" +
4989
		"	 * </pre>\n" + 
5677
		"	 * </pre>\n" +
4990
		"	 */\n" + 
5678
		"	 */\n" +
4991
		"	public void foo() {\n" + 
5679
		"	public void foo() {\n" +
4992
		"	}\n" + 
5680
		"	}\n" +
4993
	    "}\n");
5681
	    "}\n");
4994
}
5682
}
4995
5683

Return to bug 260381