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

Collapse All | Expand All

(-)formatter/org/eclipse/jdt/internal/formatter/Scribe.java (-124 / +237 lines)
Lines 1157-1163 Link Here
1157
		this.scanner.getNextChar();
1157
		this.scanner.getNextChar();
1158
		this.column += 2;
1158
		this.column += 2;
1159
		this.scanner.skipComments = true;
1159
		this.scanner.skipComments = true;
1160
		
1160
		StringBuffer tokensBuffer = new StringBuffer();
1161
1161
		// Consume text token per token
1162
		// Consume text token per token
1162
		int maxColumn = this.formatter.preferences.comment_line_length + 1;
1163
		int maxColumn = this.formatter.preferences.comment_line_length + 1;
1163
		int previousToken = -1;
1164
		int previousToken = -1;
Lines 1172-1178 Link Here
1172
		int lineNumber = scannerLine;
1173
		int lineNumber = scannerLine;
1173
		int lastTextLine = -1;
1174
		int lastTextLine = -1;
1174
		boolean openedString = false;
1175
		boolean openedString = false;
1175
		boolean openedChar = false;
1176
		while (!this.scanner.atEnd()) {
1176
		while (!this.scanner.atEnd()) {
1177
			
1177
			
1178
			// Consume token
1178
			// Consume token
Lines 1183-1211 Link Here
1183
				String msg = iie.getMessage();
1183
				String msg = iie.getMessage();
1184
				boolean insertSpace = (previousToken == TerminalTokens.TokenNameWHITESPACE || newLine) && !firstWord;
1184
				boolean insertSpace = (previousToken == TerminalTokens.TokenNameWHITESPACE || newLine) && !firstWord;
1185
				if (msg == Scanner.INVALID_CHARACTER_CONSTANT) {
1185
				if (msg == Scanner.INVALID_CHARACTER_CONSTANT) {
1186
					if (openedChar) {
1186
					if (insertSpace) {
1187
						openedChar = false;
1187
						tokensBuffer.append(' ');
1188
					} else {
1189
						if (insertSpace) {
1190
							buffer.append(' ');
1191
							this.column++;
1192
						}
1193
						openedChar = true;
1194
					}
1188
					}
1195
					buffer.append('\'');
1189
					tokensBuffer.append('\'');
1196
					this.column++;
1197
				} else if (msg == Scanner.INVALID_CHAR_IN_STRING) {
1190
				} else if (msg == Scanner.INVALID_CHAR_IN_STRING) {
1198
					if (openedString) {
1191
					if (openedString) {
1199
						openedString = false;
1192
						openedString = false;
1200
					} else {
1193
					} else {
1201
						if (insertSpace) {
1194
						if (insertSpace) {
1202
							buffer.append(' ');
1195
							tokensBuffer.append(' ');
1203
							this.column++;
1204
						}
1196
						}
1205
						openedString = true;
1197
						openedString = true;
1206
					}
1198
					}
1207
					buffer.append('"');
1199
					tokensBuffer.append('"');
1208
					this.column++;
1209
				} else {
1200
				} else {
1210
					// skip failure
1201
					// skip failure
1211
				}
1202
				}
Lines 1218-1226 Link Here
1218
			}
1209
			}
1219
			
1210
			
1220
			// Look at specific tokens
1211
			// Look at specific tokens
1221
    		boolean insertSpace = (previousToken == TerminalTokens.TokenNameWHITESPACE || newLine) && !firstWord;
1212
    		boolean insertSpace = (previousToken == TerminalTokens.TokenNameWHITESPACE || newLine) && (!firstWord || !hasTokens);
1222
			switch (token) {
1213
			switch (token) {
1223
				case TerminalTokens.TokenNameWHITESPACE:
1214
				case TerminalTokens.TokenNameWHITESPACE:
1215
					buffer.append(tokensBuffer);
1216
					this.column += tokensBuffer.length();
1217
					tokensBuffer.setLength(0);
1224
					previousToken = token;
1218
					previousToken = token;
1225
					lineNumber = Util.getLineNumber(this.scanner.getCurrentTokenEndPosition(), this.lineEnds, scannerLine>1 ? scannerLine-2 : 0, this.maxLines);
1219
					lineNumber = Util.getLineNumber(this.scanner.getCurrentTokenEndPosition(), this.lineEnds, scannerLine>1 ? scannerLine-2 : 0, this.maxLines);
1226
					if (lineNumber > scannerLine) {
1220
					if (lineNumber > scannerLine) {
Lines 1230-1237 Link Here
1230
					scannerLine = lineNumber;
1224
					scannerLine = lineNumber;
1231
					continue;
1225
					continue;
1232
				case TerminalTokens.TokenNameMULTIPLY:
1226
				case TerminalTokens.TokenNameMULTIPLY:
1227
					previousToken = token;
1233
					lineNumber = Util.getLineNumber(this.scanner.getCurrentTokenEndPosition(), this.lineEnds, scannerLine>1 ? scannerLine-2 : 0, this.maxLines);
1228
					lineNumber = Util.getLineNumber(this.scanner.getCurrentTokenEndPosition(), this.lineEnds, scannerLine>1 ? scannerLine-2 : 0, this.maxLines);
1234
					if (this.scanner.currentCharacter == '/') {
1229
					if (this.scanner.currentCharacter == '/') {
1230
						// Add remaining buffered tokens
1231
						if (tokensBuffer.length() > 0) {
1232
							buffer.append(tokensBuffer);
1233
							this.column += tokensBuffer.length();
1234
						}
1235
						// end of comment
1235
						// end of comment
1236
						if (multiLines) {
1236
						if (multiLines) {
1237
					    	buffer.append(this.lineSeparator);
1237
					    	buffer.append(this.lineSeparator);
Lines 1240-1303 Link Here
1240
						}
1240
						}
1241
						buffer.append(' ');
1241
						buffer.append(' ');
1242
			    		buffer.append(BLOCK_FOOTER);
1242
			    		buffer.append(BLOCK_FOOTER);
1243
				    	this.column += BLOCK_LINE_PREFIX_LENGTH + 1;
1243
				    	this.column += BLOCK_FOOTER_LENGTH + 1;
1244
				    	this.scanner.getNextChar(); // reach the end of scanner
1244
				    	this.scanner.getNextChar(); // reach the end of scanner
1245
				    	continue;
1245
				    	continue;
1246
					}
1246
					}
1247
					scannerLine = lineNumber;
1247
					scannerLine = lineNumber;
1248
					continue;
1248
					continue;
1249
				case TerminalTokens.TokenNameLESS:
1250
					// We cannot break tags
1251
					StringBuffer breakBuffer = new StringBuffer();
1252
					int start = this.scanner.startPosition;
1253
		    		int tokenLength = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - this.scanner.startPosition;
1254
					breakBuffer.append(this.scanner.source, this.scanner.startPosition, tokenLength);
1255
					try {
1256
						boolean closing = false;
1257
						if ((token = this.scanner.getNextToken()) == TerminalTokens.TokenNameDIVIDE) {
1258
			    			tokenLength = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - this.scanner.startPosition;
1259
							breakBuffer.append(this.scanner.source, this.scanner.startPosition, tokenLength);
1260
							token = this.scanner.getNextToken();
1261
							closing = true;
1262
						}
1263
						if (token == TerminalTokens.TokenNameIdentifier) {
1264
			    			tokenLength = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - this.scanner.startPosition;
1265
							breakBuffer.append(this.scanner.source, this.scanner.startPosition, tokenLength);
1266
							token = this.scanner.getNextToken();
1267
							if (token == TerminalTokens.TokenNameGREATER) {
1268
				    			tokenLength = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - this.scanner.startPosition;
1269
								breakBuffer.append(this.scanner.source, this.scanner.startPosition, tokenLength);
1270
								if ((this.column + breakBuffer.length()) > maxColumn) {
1271
							    	buffer.append(this.lineSeparator);
1272
							    	this.column = 1;
1273
							    	printIndentationIfNecessary(buffer);
1274
						    		buffer.append(BLOCK_LINE_PREFIX);
1275
							    	this.column += BLOCK_LINE_PREFIX_LENGTH;
1276
									multiLines = true;
1277
								} else if (!closing) {
1278
									buffer.append(' ');
1279
									this.column++;
1280
								}
1281
								buffer.append(breakBuffer);
1282
								this.column += breakBuffer.length();
1283
								previousToken = token;
1284
								scannerLine = lineNumber;
1285
								newLine = false;
1286
								continue;
1287
							}
1288
						}
1289
					}
1290
					catch (InvalidInputException iie) {
1291
						// forget as we're started after next token
1292
					}
1293
					// Need to retrieve correct position
1294
					this.scanner.resetTo(start, currentTokenEndPosition-1);
1295
					try {
1296
	                    token = this.scanner.getNextToken();
1297
                    } catch (InvalidInputException e) {
1298
	                    // will not happen
1299
                    }
1300
					break;
1301
			}
1249
			}
1302
1250
1303
			// Look at gap and insert corresponding lines if necessary
1251
			// Look at gap and insert corresponding lines if necessary
Lines 1324-1329 Link Here
1324
					 }
1272
					 }
1325
				}
1273
				}
1326
				for (int i=0; i<linesGap; i++) {
1274
				for (int i=0; i<linesGap; i++) {
1275
					// Add remaining buffered tokens
1276
					if (tokensBuffer.length() > 0) {
1277
						buffer.append(tokensBuffer);
1278
						tokensBuffer.setLength(0);
1279
					}
1327
			    	buffer.append(this.lineSeparator);
1280
			    	buffer.append(this.lineSeparator);
1328
			    	this.column = 1;
1281
			    	this.column = 1;
1329
			    	printIndentationIfNecessary(buffer);
1282
			    	printIndentationIfNecessary(buffer);
Lines 1343-1370 Link Here
1343
    		hasTokens = true;
1296
    		hasTokens = true;
1344
    		if (!hastTextOnFirstLine && scannerLine == firstLine) {
1297
    		if (!hastTextOnFirstLine && scannerLine == firstLine) {
1345
    			hastTextOnFirstLine = true;
1298
    			hastTextOnFirstLine = true;
1346
    			this.column++;
1347
    		}
1299
    		}
1348
			this.column += tokenLength;
1300
    		int lastColumn = this.column + tokensBuffer.length() + tokenLength;
1349
    		if (previousToken == -1 || insertSpace) this.column++;
1301
    		if (previousToken == -1 || insertSpace) lastColumn++;
1350
    		
1302
    		
1351
    		// Append next token inserting a new line if max line is reached
1303
    		// Append next token inserting a new line if max line is reached
1352
			if (!firstWord && this.column > maxColumn) {
1304
			if (!firstWord && lastColumn > maxColumn) {
1305
		    	String tokensString = tokensBuffer.toString().trim();
1306
				if ((firstColumn+tokensString.length()+tokenLength) > maxColumn) {
1307
					// there won't be enough room even if we break the line before the buffered tokens
1308
					// So add the buffered tokens now
1309
					if (buffer.length() == 0) {
1310
						buffer.append(' ');
1311
						this.column++;
1312
					}
1313
					buffer.append(tokensString);
1314
					this.column += tokensString.length();
1315
					tokensBuffer.setLength(0);
1316
				}
1353
				// not enough space on the line
1317
				// not enough space on the line
1354
		    	buffer.append(this.lineSeparator);
1318
		    	buffer.append(this.lineSeparator);
1355
		    	this.column = 1;
1319
		    	this.column = 1;
1356
		    	printIndentationIfNecessary(buffer);
1320
		    	printIndentationIfNecessary(buffer);
1357
	    		buffer.append(BLOCK_LINE_PREFIX);
1321
	    		buffer.append(BLOCK_LINE_PREFIX);
1358
		    	this.column += BLOCK_LINE_PREFIX_LENGTH;
1322
		    	this.column += BLOCK_LINE_PREFIX_LENGTH;
1323
		    	if (tokensBuffer.length() > 0) {
1324
					buffer.append(tokensString);
1325
					this.column += tokensString.length();
1326
					tokensBuffer.setLength(0);
1327
		    	}
1359
				buffer.append(this.scanner.source, tokenStart, tokenLength);
1328
				buffer.append(this.scanner.source, tokenStart, tokenLength);
1360
				this.column += tokenLength;
1329
				this.column += tokenLength;
1361
				multiLines = true;
1330
				multiLines = true;
1362
			} else {
1331
			} else {
1363
				// append token to the line
1332
				// append token to the line
1364
				if (insertSpace)  {
1333
				if (insertSpace)  {
1365
					if (buffer.length() > 0) buffer.append(' ');
1334
					tokensBuffer.append(' ');
1366
				}
1335
				}
1367
				buffer.append(this.scanner.source, tokenStart, tokenLength);
1336
				tokensBuffer.append(this.scanner.source, tokenStart, tokenLength);
1368
			}
1337
			}
1369
			previousToken = token;
1338
			previousToken = token;
1370
			newLine = false;
1339
			newLine = false;
Lines 1380-1390 Link Here
1380
					replacement.append(this.lineSeparator);
1349
					replacement.append(this.lineSeparator);
1381
					this.column = 1;
1350
					this.column = 1;
1382
					printIndentationIfNecessary(replacement);
1351
					printIndentationIfNecessary(replacement);
1383
					replacement.append(BLOCK_LINE_PREFIX);
1352
					if (buffer.charAt(0) == ' ') {
1353
						replacement.append(' ');
1354
						replacement.append('*');
1355
					} else {
1356
						replacement.append(BLOCK_LINE_PREFIX);
1357
						this.column++;
1358
					}
1384
			    	this.column = col;
1359
			    	this.column = col;
1385
				}
1360
				}
1386
			} else {
1361
			} else {
1387
				if (hasTokens) replacement.append(' ');
1362
				if (buffer.charAt(0) != ' ') {
1363
					replacement.append(' ');
1364
					this.column++;
1365
				}
1388
			}
1366
			}
1389
			replacement.append(buffer);
1367
			replacement.append(buffer);
1390
			addReplaceEdit(currentTokenStartPosition, currentTokenEndPosition-1, replacement.toString());
1368
			addReplaceEdit(currentTokenStartPosition, currentTokenEndPosition-1, replacement.toString());
Lines 2057-2074 Link Here
2057
		int maxNodes = block.nodesPtr;
2035
		int maxNodes = block.nodesPtr;
2058
2036
2059
		// format tag section if necessary
2037
		// format tag section if necessary
2038
		int maxColumn = this.formatter.preferences.comment_line_length;
2039
		boolean clearBlankLines = this.formatter.preferences.comment_clear_blank_lines_in_javadoc_comment;
2060
		if (!block.isDescription()) {
2040
		if (!block.isDescription()) {
2061
			this.column += previousEnd - block.sourceStart + 1;
2041
			this.column += previousEnd - block.sourceStart + 1;
2062
			if (block.isInlined()) 	{
2042
			if (block.isInlined()) 	{
2063
				this.column++; // Add extra character for inline tag
2043
				this.column++; // Add extra character for inline tag
2064
			}
2044
			}
2065
			FormatJavadocNode reference= block.reference;
2045
			FormatJavadocReference reference= block.reference;
2066
			if (reference != null) {
2046
			if (reference != null) {
2067
				// format between tag name and reference
2047
				// format reference
2068
				addReplaceEdit(previousEnd+1, reference.sourceStart - 1, " "); //$NON-NLS-1$
2048
				StringBuffer buffer = new StringBuffer();
2069
				this.column++;
2049
				printJavadocBlockReference(buffer, reference, block);
2050
			    addReplaceEdit(previousEnd+1, reference.sourceEnd, buffer.toString());
2070
				previousEnd = reference.sourceEnd;
2051
				previousEnd = reference.sourceEnd;
2071
				this.column += previousEnd - reference.sourceStart + 1;
2072
			}
2052
			}
2073
2053
2074
			// Nothing else to do if the tag has no node
2054
			// Nothing else to do if the tag has no node
Lines 2076-2082 Link Here
2076
		}
2056
		}
2077
		
2057
		
2078
		// tag section: iterate through the blocks composing this tag but the last one
2058
		// tag section: iterate through the blocks composing this tag but the last one
2079
		int maxColumn = this.formatter.preferences.comment_line_length;
2080
		if (block.isHeaderLine()) maxColumn++;
2059
		if (block.isHeaderLine()) maxColumn++;
2081
		for (int i=0; i<=maxNodes; i++) {
2060
		for (int i=0; i<=maxNodes; i++) {
2082
			FormatJavadocNode node = block.nodes[i];
2061
			FormatJavadocNode node = block.nodes[i];
Lines 2084-2093 Link Here
2084
			
2063
			
2085
			// Print empty lines before the node
2064
			// Print empty lines before the node
2086
			int textLength = -1;
2065
			int textLength = -1;
2066
			int newLines;
2087
			if (i == 0) {
2067
			if (i == 0) {
2088
				int newLines = this.formatter.preferences.comment_insert_new_line_for_parameter && block.isParamTag() ? 1 : 0;
2068
				newLines = this.formatter.preferences.comment_insert_new_line_for_parameter && !block.isInlined() && block.isParamTag() ? 1 : 0;
2089
				if (nodeStart > (previousEnd+1)) {
2069
				if (nodeStart > (previousEnd+1)) {
2090
			   		printJavadocGapLines(previousEnd+1, nodeStart-1, newLines, this.formatter.preferences.comment_clear_blank_lines_in_javadoc_comment, false, null);
2070
			   		printJavadocGapLines(previousEnd+1, nodeStart-1, newLines, clearBlankLines, false, null);
2091
				} else {
2071
				} else {
2092
					StringBuffer buffer = new StringBuffer();
2072
					StringBuffer buffer = new StringBuffer();
2093
					if (newLines > 0) {
2073
					if (newLines > 0) {
Lines 2098-2104 Link Here
2098
					}
2078
					}
2099
				}
2079
				}
2100
			} else {
2080
			} else {
2101
				int newLines = this.column > this.formatter.preferences.comment_line_length ? 1 : 0;
2081
				newLines = this.column > this.formatter.preferences.comment_line_length ? 1 : 0;
2102
				if (node.isText()) {
2082
				if (node.isText()) {
2103
					// Need to verify if new line is necessary for immutable tag
2083
					// Need to verify if new line is necessary for immutable tag
2104
					FormatJavadocText text = (FormatJavadocText) node;
2084
					FormatJavadocText text = (FormatJavadocText) node;
Lines 2137-2148 Link Here
2137
								newLines = 1;
2117
								newLines = 1;
2138
								((FormatJavadocText)node).linesBefore = 1;
2118
								((FormatJavadocText)node).linesBefore = 1;
2139
							}
2119
							}
2140
				   			printJavadocGapLines(previousEnd+1, nodeStart-1, newLines, this.formatter.preferences.comment_clear_blank_lines_in_javadoc_comment, false, null);
2120
				   			printJavadocGapLines(previousEnd+1, nodeStart-1, newLines, clearBlankLines, false, null);
2141
						} catch (InvalidInputException iie) {
2121
						} catch (InvalidInputException iie) {
2142
							// skip
2122
							// skip
2143
						}
2123
						}
2144
					} else {
2124
					} else {
2145
			   			printJavadocGapLines(previousEnd+1, nodeStart-1, newLines, this.formatter.preferences.comment_clear_blank_lines_in_javadoc_comment, false, null);
2125
			   			printJavadocGapLines(previousEnd+1, nodeStart-1, newLines, clearBlankLines, false, null);
2146
					}
2126
					}
2147
				}
2127
				}
2148
			}
2128
			}
Lines 2156-2161 Link Here
2156
						if (textLength == -1) {
2136
						if (textLength == -1) {
2157
							textLength = getTextLength(block, text);
2137
							textLength = getTextLength(block, text);
2158
						}
2138
						}
2139
						// Indent if new line was added
2140
						if (newLines > 0) {
2141
							int col = this.column;
2142
							StringBuffer buffer = new StringBuffer();
2143
							int textEnd = text.separatorsPtr == -1 ? text.sourceEnd : (int) (text.separators[0] >>> 32);
2144
							printJavadocTextLine(buffer, text.sourceStart, textEnd, block, true, true, true);
2145
							addReplaceEdit(text.sourceStart, textEnd, buffer.toString());
2146
							textLength -= this.column - col;
2147
						}
2159
						this.column += textLength;
2148
						this.column += textLength;
2160
					} else {
2149
					} else {
2161
						printJavadocHtmlTag(text, block);
2150
						printJavadocHtmlTag(text, block);
Lines 2172-2177 Link Here
2172
		}
2161
		}
2173
	}
2162
	}
2174
2163
2164
	private void printJavadocBlockReference(StringBuffer buffer, FormatJavadocReference reference, FormatJavadocBlock block) {
2165
2166
		boolean indentRootTags = this.formatter.preferences.comment_indent_root_tags && !block.isDescription();
2167
		boolean indentParamTag = this.formatter.preferences.comment_indent_parameter_description && block.isParamTag();
2168
		boolean headerLine = block.isHeaderLine() && this.lastNumberOfNewLines == 0;
2169
		StringBuffer tokensBuffer = new StringBuffer();
2170
		
2171
		// First we need to know what is the indentation
2172
		int firstColumn = 1 + this.indentationLevel + BLOCK_LINE_PREFIX_LENGTH;
2173
		if (headerLine) firstColumn++;
2174
		StringBuffer indentationBuffer = null;
2175
		if (indentRootTags) {
2176
			int indentLevel = this.indentationLevel;
2177
			int indentations = this.numberOfIndentations;
2178
			this.numberOfIndentations += (BLOCK_LINE_PREFIX_LENGTH / this.indentationSize) + 1;
2179
			this.indentationLevel = this.numberOfIndentations * this.indentationSize;
2180
			int currentColumn = this.column;
2181
			this.column = firstColumn;
2182
			if (indentParamTag) {
2183
				this.indentationLevel += this.indentationSize;
2184
				this.numberOfIndentations++;
2185
			}
2186
			printIndentationIfNecessary(indentationBuffer = new StringBuffer());
2187
			firstColumn = this.indentationLevel + 1;
2188
			this.column = currentColumn;
2189
			this.indentationLevel = indentLevel;
2190
			this.numberOfIndentations = indentations;
2191
		}
2192
2193
		// Scan the text token per token to compact it and size it the max line length
2194
		int maxColumn = this.formatter.preferences.comment_line_length + 1;
2195
		int previousToken = -1;
2196
		this.scanner.resetTo(reference.sourceStart, reference.sourceEnd);
2197
		while (!this.scanner.atEnd()) {
2198
			int token;
2199
			try {
2200
				token = this.scanner.getNextToken();
2201
				switch (token) {
2202
					case TerminalTokens.TokenNameWHITESPACE:
2203
						buffer.append(tokensBuffer);
2204
						this.column += tokensBuffer.length();
2205
						tokensBuffer.setLength(0);
2206
						if (CharOperation.indexOf('\n', this.scanner.source, this.scanner.startPosition, this.scanner.getCurrentTokenEndPosition()) >= 0) {
2207
							// consume line break
2208
							loop: while (true) {
2209
								token = this.scanner.getNextToken();
2210
								switch (token) {
2211
									case TerminalTokens.TokenNameWHITESPACE:
2212
									case TerminalTokens.TokenNameMULTIPLY:
2213
										previousToken = token; // will not insert space
2214
										continue;
2215
									default:
2216
										break loop;
2217
								}
2218
							}
2219
							break;
2220
						}
2221
						previousToken = token;
2222
						continue;
2223
					case TerminalTokens.TokenNameMULTIPLY:
2224
						previousToken = token;
2225
						continue;
2226
				}
2227
			} catch (InvalidInputException iie) {
2228
				continue;
2229
			}
2230
			int tokenStart = this.scanner.getCurrentTokenStartPosition();
2231
    		int tokenLength = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - tokenStart;
2232
    		int lastColumn = this.column + tokensBuffer.length() + tokenLength;
2233
    		boolean insertSpace = previousToken == TerminalTokens.TokenNameWHITESPACE || previousToken == -1;
2234
    		if (insertSpace) lastColumn++;
2235
    		if (headerLine) {
2236
    			// special case when text is on the same line of the javadoc's header
2237
    			if (lastColumn > maxColumn)  {
2238
    				lastColumn--; // new line gives an extra character
2239
    			}
2240
    		}
2241
			if (lastColumn > maxColumn) {
2242
		    	String tokensString = tokensBuffer.toString().trim();
2243
		    	int indentLength = indentationBuffer==null ? 0 : indentationBuffer.length();
2244
				if ((firstColumn-1+indentLength+tokensString.length()+tokenLength) > maxColumn) {
2245
					// there won't be enough room even if we break the line before the buffered tokens
2246
					// So add the buffered tokens now
2247
					if (buffer.length() == 0) {
2248
						buffer.append(' ');
2249
						this.column++;
2250
					}
2251
					buffer.append(tokensString);
2252
					this.column += tokensString.length();
2253
					tokensBuffer.setLength(0);
2254
				}
2255
				// not enough space on the line
2256
		    	buffer.append(this.lineSeparator);
2257
		    	this.column = 1;
2258
		    	printIndentationIfNecessary(buffer);
2259
	    		buffer.append(BLOCK_LINE_PREFIX);
2260
		    	this.column = headerLine ? firstColumn-1 : firstColumn;
2261
		    	if (indentationBuffer != null) {
2262
		    		buffer.append(indentationBuffer);
2263
		    	}
2264
		    	if (tokensBuffer.length() > 0) {
2265
					buffer.append(tokensString);
2266
					this.column += tokensString.length();
2267
					tokensBuffer.setLength(0);
2268
		    	}
2269
				buffer.append(this.scanner.source, tokenStart, tokenLength);
2270
				this.column += tokenLength;
2271
				if (headerLine) {
2272
					firstColumn--;
2273
					headerLine = false;
2274
				}
2275
			} else {
2276
				// append token to the line
2277
				if (insertSpace) {
2278
					tokensBuffer.append(' ');
2279
				}
2280
				tokensBuffer.append(this.scanner.source, tokenStart, tokenLength);
2281
			}
2282
			previousToken = token;
2283
		}
2284
		if (tokensBuffer.length() > 0) {
2285
			buffer.append(tokensBuffer);
2286
			this.column += tokensBuffer.length();
2287
		}
2288
    }
2289
2175
	private int getTextLength(FormatJavadocBlock block, FormatJavadocText text) {
2290
	private int getTextLength(FormatJavadocBlock block, FormatJavadocText text) {
2176
2291
2177
		// Simple for one line tags
2292
		// Simple for one line tags
Lines 2482-2488 Link Here
2482
		int textStart = text.sourceStart;
2597
		int textStart = text.sourceStart;
2483
		int nextStart = textStart;
2598
		int nextStart = textStart;
2484
		int startLine = Util.getLineNumber(textStart, this.lineEnds, 0, this.maxLines);
2599
		int startLine = Util.getLineNumber(textStart, this.lineEnds, 0, this.maxLines);
2485
		boolean textOnNewLine = (text == block.nodes[0] && ((block.isParamTag() && this.formatter.preferences.comment_insert_new_line_for_parameter) || !block.hasTextOnTagLine())) || text.linesBefore > 0;
2600
		boolean textOnNewLine = (text == block.nodes[0] && ((!block.isInlined() && block.isParamTag() && this.formatter.preferences.comment_insert_new_line_for_parameter) || !block.hasTextOnTagLine())) || text.linesBefore > 0;
2486
	    int htmlTagID = text.getHtmlTagID();
2601
	    int htmlTagID = text.getHtmlTagID();
2487
	    StringBuffer buffer = new StringBuffer();
2602
	    StringBuffer buffer = new StringBuffer();
2488
2603
Lines 2510-2516 Link Here
2510
					}
2625
					}
2511
					if (textStart < previousEnd) {
2626
					if (textStart < previousEnd) {
2512
						addReplaceEdit(textStart, previousEnd, buffer.toString());
2627
						addReplaceEdit(textStart, previousEnd, buffer.toString());
2513
//						this.column += buffer.length();
2514
					}
2628
					}
2515
					boolean immutable = htmlTag == null ? false : htmlTag.isImmutableHtmlTag();
2629
					boolean immutable = htmlTag == null ? false : htmlTag.isImmutableHtmlTag();
2516
					boolean overEndLine = false;
2630
					boolean overEndLine = false;
Lines 2533-2540 Link Here
2533
								if (indentationBuffer != null) {
2647
								if (indentationBuffer != null) {
2534
									addInsertEdit(node.sourceStart, indentationBuffer.toString());
2648
									addInsertEdit(node.sourceStart, indentationBuffer.toString());
2535
								}
2649
								}
2536
//								buffer.append(' ');
2537
//								this.column++;
2538
							}
2650
							}
2539
						} else {
2651
						} else {
2540
							linesAfter = printJavadocHtmlTag(htmlTag, block);
2652
							linesAfter = printJavadocHtmlTag(htmlTag, block);
Lines 2554-2560 Link Here
2554
						printJavadocGapLines(previousEnd+1, nextStart, linesAfter, clearBlankLines, false, buffer);
2666
						printJavadocGapLines(previousEnd+1, nextStart, linesAfter, clearBlankLines, false, buffer);
2555
						textOnNewLine = true;
2667
						textOnNewLine = true;
2556
					}
2668
					}
2557
					boolean needIndentation = buffer.length() == 0 && textOnNewLine;
2669
					boolean needIndentation = textOnNewLine;
2558
					if (idx > 0) {
2670
					if (idx > 0) {
2559
						if (!needIndentation && (text.htmlIndexes[idx-1] & JAVADOC_TAGS_ID_MASK) == JAVADOC_SEPARATOR_TAGS_ID) {
2671
						if (!needIndentation && (text.htmlIndexes[idx-1] & JAVADOC_TAGS_ID_MASK) == JAVADOC_SEPARATOR_TAGS_ID) {
2560
							needIndentation = true;
2672
							needIndentation = true;
Lines 2580-2586 Link Here
2580
					if (clearBlankLines) {
2692
					if (clearBlankLines) {
2581
						// keep previously computed lines after
2693
						// keep previously computed lines after
2582
					} else {
2694
					} else {
2583
//						if (wasHtmlTag || idx==0 || (idx==max && ((text.htmlIndexes[max] & JAVADOC_TAGS_ID_MASK) == htmlTagID))) {
2584
						if (idx==0 || (idx==max && ((text.htmlIndexes[max] & JAVADOC_TAGS_ID_MASK) == htmlTagID)) || (idx < max && wasHtmlTag && (text.htmlIndexes[idx-1] & JAVADOC_TAGS_ID_MASK) != JAVADOC_IMMUTABLE_TAGS_ID)) {
2695
						if (idx==0 || (idx==max && ((text.htmlIndexes[max] & JAVADOC_TAGS_ID_MASK) == htmlTagID)) || (idx < max && wasHtmlTag && (text.htmlIndexes[idx-1] & JAVADOC_TAGS_ID_MASK) != JAVADOC_IMMUTABLE_TAGS_ID)) {
2585
							if (linesAfter < linesGap) {
2696
							if (linesAfter < linesGap) {
2586
								linesAfter = linesGap;
2697
								linesAfter = linesGap;
Lines 2668-2674 Link Here
2668
		int textStart = text.sourceStart;
2779
		int textStart = text.sourceStart;
2669
		int nextStart = textStart;
2780
		int nextStart = textStart;
2670
		int startLine = Util.getLineNumber(textStart, this.lineEnds, 0, this.maxLines);
2781
		int startLine = Util.getLineNumber(textStart, this.lineEnds, 0, this.maxLines);
2671
		boolean textOnNewLine = (text == block.nodes[0] && block.isParamTag() && (this.formatter.preferences.comment_insert_new_line_for_parameter || !block.hasTextOnTagLine())) || text.linesBefore > 0;
2782
		boolean textOnNewLine = (text == block.nodes[0] && !block.isInlined() && block.isParamTag() && (this.formatter.preferences.comment_insert_new_line_for_parameter || !block.hasTextOnTagLine())) || text.linesBefore > 0 || this.column > (this.formatter.preferences.comment_line_length+1);
2672
2783
2673
		// Iterate on text line separators
2784
		// Iterate on text line separators
2674
		for (int idx=0, max=text.separatorsPtr; idx<=max ; idx++) {
2785
		for (int idx=0, max=text.separatorsPtr; idx<=max ; idx++) {
Lines 2719-2725 Link Here
2719
		boolean indentRootTags = this.formatter.preferences.comment_indent_root_tags && !block.isDescription();
2830
		boolean indentRootTags = this.formatter.preferences.comment_indent_root_tags && !block.isDescription();
2720
		boolean indentParamTag = this.formatter.preferences.comment_indent_parameter_description && block.isParamTag();
2831
		boolean indentParamTag = this.formatter.preferences.comment_indent_parameter_description && block.isParamTag();
2721
		boolean headerLine = (buffer.indexOf(Util.LINE_SEPARATOR) < 0) && block.isHeaderLine() && this.lastNumberOfNewLines == 0;
2832
		boolean headerLine = (buffer.indexOf(Util.LINE_SEPARATOR) < 0) && block.isHeaderLine() && this.lastNumberOfNewLines == 0;
2722
		StringBuffer textBuffer = isHtmlTag ? new StringBuffer() : buffer;
2833
		StringBuffer tokensBuffer = new StringBuffer();
2723
		
2834
		
2724
		// First we need to know what is the indentation
2835
		// First we need to know what is the indentation
2725
		int firstColumn = 1 + this.indentationLevel + BLOCK_LINE_PREFIX_LENGTH;
2836
		int firstColumn = 1 + this.indentationLevel + BLOCK_LINE_PREFIX_LENGTH;
Lines 2739-2745 Link Here
2739
			printIndentationIfNecessary(indentationBuffer = new StringBuffer());
2850
			printIndentationIfNecessary(indentationBuffer = new StringBuffer());
2740
			if (needIndentation) {
2851
			if (needIndentation) {
2741
				this.column = firstColumn;
2852
				this.column = firstColumn;
2742
				printIndentationIfNecessary(textBuffer);
2853
				printIndentationIfNecessary(buffer);
2743
			}
2854
			}
2744
			firstColumn = this.indentationLevel + 1;
2855
			firstColumn = this.indentationLevel + 1;
2745
			this.column = currentColumn < firstColumn ? firstColumn : currentColumn;
2856
			this.column = currentColumn < firstColumn ? firstColumn : currentColumn;
Lines 2767-2789 Link Here
2767
					String msg = iie.getMessage();
2878
					String msg = iie.getMessage();
2768
					if (msg == Scanner.INVALID_CHARACTER_CONSTANT) {
2879
					if (msg == Scanner.INVALID_CHARACTER_CONSTANT) {
2769
						if (insertSpace) {
2880
						if (insertSpace) {
2770
							buffer.append(' ');
2881
							tokensBuffer.append(' ');
2771
							this.column++;
2772
						}
2882
						}
2773
						buffer.append('\'');
2883
						tokensBuffer.append('\'');
2774
						this.column++;
2775
					} else if (msg == Scanner.INVALID_CHAR_IN_STRING) {
2884
					} else if (msg == Scanner.INVALID_CHAR_IN_STRING) {
2776
						if (openedString) {
2885
						if (openedString) {
2777
							openedString = false;
2886
							openedString = false;
2778
						} else {
2887
						} else {
2779
							if (insertSpace) {
2888
							if (insertSpace) {
2780
								buffer.append(' ');
2889
								tokensBuffer.append(' ');
2781
								this.column++;
2782
							}
2890
							}
2783
							openedString = true;
2891
							openedString = true;
2784
						}
2892
						}
2785
						buffer.append('"');
2893
						tokensBuffer.append('"');
2786
						this.column++;
2787
					} else {
2894
					} else {
2788
						// skip failure
2895
						// skip failure
2789
					}
2896
					}
Lines 2795-2818 Link Here
2795
				}
2902
				}
2796
				if (token == TerminalTokens.TokenNameWHITESPACE) {
2903
				if (token == TerminalTokens.TokenNameWHITESPACE) {
2797
					previousToken = token;
2904
					previousToken = token;
2905
					buffer.append(tokensBuffer);
2906
					this.column += tokensBuffer.length();
2907
					tokensBuffer.setLength(0);
2798
					continue;
2908
					continue;
2799
				}
2909
				}
2800
    			int tokenStart = this.scanner.getCurrentTokenStartPosition();
2910
    			int tokenStart = this.scanner.getCurrentTokenStartPosition();
2801
	    		int tokenLength = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - tokenStart;
2911
	    		int tokenLength = (this.scanner.atEnd() ? this.scanner.eofPosition : this.scanner.currentPosition) - tokenStart;
2802
	    		boolean insertSpace = previousToken == TerminalTokens.TokenNameWHITESPACE || (tokenStart == textStart && this.column > firstColumn && !(firstText || isHtmlTag));
2912
	    		boolean insertSpace = previousToken == TerminalTokens.TokenNameWHITESPACE || (tokenStart == textStart && this.column > firstColumn && !(firstText || isHtmlTag));
2803
				this.column += tokenLength;
2913
	    		int lastColumn = this.column + tokensBuffer.length() + tokenLength;
2804
	    		if (insertSpace) this.column++;
2914
	    		if (insertSpace) lastColumn++;
2805
	    		int col = column; 
2806
	    		if (headerLine) {
2915
	    		if (headerLine) {
2807
	    			// special case when text is on the same line of the javadoc's header
2916
	    			// special case when text is on the same line of the javadoc's header
2808
	    			if (col > maxColumn)  {
2917
	    			if (lastColumn > maxColumn)  {
2809
	    				col--; // new line gives an extra character
2918
	    				lastColumn--; // new line gives an extra character
2810
	    				this.lastNumberOfNewLines++; // in case we leave just after
2919
	    				this.lastNumberOfNewLines++; // in case we leave just after
2811
	    			}
2920
	    			}
2812
	    		}
2921
	    		}
2813
				if (col > maxColumn) {
2922
				if (lastColumn > maxColumn) {
2814
					// not enough space on the line
2923
					// not enough space on the line
2815
					if (col == this.column) this.lastNumberOfNewLines++;
2924
					if (lastColumn == this.column) this.lastNumberOfNewLines++;
2816
			    	buffer.append(this.lineSeparator);
2925
			    	buffer.append(this.lineSeparator);
2817
			    	this.column = 1;
2926
			    	this.column = 1;
2818
			    	printIndentationIfNecessary(buffer);
2927
			    	printIndentationIfNecessary(buffer);
Lines 2821-2831 Link Here
2821
			    	if (indentationBuffer != null) {
2930
			    	if (indentationBuffer != null) {
2822
			    		buffer.append(indentationBuffer);
2931
			    		buffer.append(indentationBuffer);
2823
			    	}
2932
			    	}
2824
					if (isHtmlTag && buffer != textBuffer) {
2933
			    	if (tokensBuffer.length() > 0) {
2825
						buffer.append(textBuffer);
2934
			    		String tokensString = tokensBuffer.toString().trim();
2826
						textBuffer = buffer;
2935
						buffer.append(tokensString);
2827
					}
2936
						this.column += tokensString.length();
2828
					textBuffer.append(this.scanner.source, tokenStart, tokenLength);
2937
						tokensBuffer.setLength(0);
2938
			    	}
2939
					buffer.append(this.scanner.source, tokenStart, tokenLength);
2829
					this.column += tokenLength;
2940
					this.column += tokenLength;
2830
					if (headerLine) {
2941
					if (headerLine) {
2831
						firstColumn--;
2942
						firstColumn--;
Lines 2833-2850 Link Here
2833
					}
2944
					}
2834
    			} else {
2945
    			} else {
2835
					// append token to the line
2946
					// append token to the line
2836
					if (insertSpace)  {
2947
		    		if (insertSpace) {
2837
		    			textBuffer.append(' ');
2948
		    			tokensBuffer.append(' ');
2838
					}
2949
		    		}
2839
					textBuffer.append(this.scanner.source, tokenStart, tokenLength);
2950
					tokensBuffer.append(this.scanner.source, tokenStart, tokenLength);
2840
    			}
2951
    			}
2841
				previousToken = token;
2952
				previousToken = token;
2842
    		}
2953
    		}
2843
		}
2954
		}
2844
		finally {
2955
		finally {
2845
			this.scanner.skipComments = false;
2956
			this.scanner.skipComments = false;
2846
			if (isHtmlTag && buffer != textBuffer) {
2957
			// Add remaining buffered tokens
2847
				buffer.append(textBuffer);
2958
			if (tokensBuffer.length() > 0) {
2959
				buffer.append(tokensBuffer);
2960
				this.column += tokensBuffer.length();
2848
			}
2961
			}
2849
		}
2962
		}
2850
    }
2963
    }
(-)formatter/org/eclipse/jdt/internal/formatter/FormatterCommentParser.java (-39 / +7 lines)
Lines 72-105 Link Here
72
 * @see org.eclipse.jdt.internal.compiler.parser.JavadocParser#createMethodReference(java.lang.Object, java.util.List)
72
 * @see org.eclipse.jdt.internal.compiler.parser.JavadocParser#createMethodReference(java.lang.Object, java.util.List)
73
 */
73
 */
74
protected Object createMethodReference(Object receiver, List arguments) throws InvalidInputException {
74
protected Object createMethodReference(Object receiver, List arguments) throws InvalidInputException {
75
76
	// Get intermediate arguments positions
77
	long[] positions = null;
78
	if (arguments != null) {
79
		int size = arguments.size();
80
		positions = new long[size];
81
		for (int i=0; i<size; i++) {
82
			FormatJavadocReference reference = (FormatJavadocReference) arguments.get(i);
83
			positions[i] = (((long) reference.sourceStart) << 32) + reference.sourceEnd;
84
		}
85
	}
86
87
	// Build the node
88
	int start = receiver == null ? this.memberStart : ((FormatJavadocReference) receiver).sourceStart;
75
	int start = receiver == null ? this.memberStart : ((FormatJavadocReference) receiver).sourceStart;
89
	int lineStart = this.scanner.getLineNumber(start);
76
	int lineStart = this.scanner.getLineNumber(start);
90
	FormatJavadocReference reference = new FormatJavadocReference(start, this.scanner.getCurrentTokenEndPosition(), lineStart);
77
	return new FormatJavadocReference(start, this.scanner.getCurrentTokenEndPosition(), lineStart);
91
	reference.positions = positions;
92
	return reference;
93
}
78
}
94
79
95
/* (non-Javadoc)
80
/* (non-Javadoc)
96
 * @see org.eclipse.jdt.internal.compiler.parser.JavadocParser#createTag()
81
 * @see org.eclipse.jdt.internal.compiler.parser.JavadocParser#createTag()
97
 */
82
 */
98
protected void createTag() {
83
protected void createTag() {
99
//	if (this.tagValue == TAG_OTHERS_VALUE)  {
100
//		if (this.textStart == -1) this.textStart = this.tagSourceStart;
101
//		return;
102
//	}
103
	int lineStart = this.scanner.getLineNumber(this.tagSourceStart);
84
	int lineStart = this.scanner.getLineNumber(this.tagSourceStart);
104
	FormatJavadocBlock block = new FormatJavadocBlock(this.tagSourceStart, this.tagSourceEnd, lineStart, this.tagValue);
85
	FormatJavadocBlock block = new FormatJavadocBlock(this.tagSourceStart, this.tagSourceEnd, lineStart, this.tagValue);
105
	if (this.inlineTagStarted) {
86
	if (this.inlineTagStarted) {
Lines 129-135 Link Here
129
	}
110
	}
130
	long[] positions = new long[size];
111
	long[] positions = new long[size];
131
	System.arraycopy(this.identifierPositionStack, this.identifierPtr - size + 1, positions, 0, size);
112
	System.arraycopy(this.identifierPositionStack, this.identifierPtr - size + 1, positions, 0, size);
132
	return new FormatJavadocReference(positions, lineStart);
113
	return new FormatJavadocReference((int) (positions[0] >>> 32), (int) positions[positions.length-1], lineStart);
133
}
114
}
134
115
135
/*
116
/*
Lines 293-308 Link Here
293
	if (!valid) {
274
	if (!valid) {
294
		this.scanner.resetTo(this.tagSourceEnd+1, this.javadocEnd);
275
		this.scanner.resetTo(this.tagSourceEnd+1, this.javadocEnd);
295
		this.index = this.tagSourceEnd+1;
276
		this.index = this.tagSourceEnd+1;
296
//		char ch = peekChar();
297
//		if (ch != ' ' && !ScannerHelper.isWhitespace(ch)) {
298
//			// no space after the tag, just create a normal tag
299
//			return false;
300
//		}
301
//		this.scanner.getNextToken(); // consume first token
302
//		pushIdentifier(true, false); // force the identifier even if invalid
303
//		pushSeeRef(createTypeReference(0));
304
//		this.index = this.scanner.currentPosition;
305
//		valid = true;
306
	}
277
	}
307
	return valid;
278
	return valid;
308
}
279
}
Lines 346-358 Link Here
346
	int start = (int) (this.identifierPositionStack[0] >>> 32);
317
	int start = (int) (this.identifierPositionStack[0] >>> 32);
347
	int lineStart = this.scanner.getLineNumber(start);
318
	int lineStart = this.scanner.getLineNumber(start);
348
	FormatJavadocReference reference;
319
	FormatJavadocReference reference;
349
	if (isTypeParam) {
320
	reference = new FormatJavadocReference(start, (int) this.identifierPositionStack[isTypeParam ? 2 : 0], lineStart);
350
		reference = new FormatJavadocReference(start, (int) this.identifierPositionStack[2], lineStart);
351
		reference.positions = new long[3];
352
		System.arraycopy(this.identifierPositionStack, 0, reference.positions, 0, 3);
353
	} else {
354
		reference = new FormatJavadocReference(start, (int) this.identifierPositionStack[0], lineStart);
355
	}
356
	block.reference = reference;
321
	block.reference = reference;
357
	block.sourceEnd = reference.sourceEnd;
322
	block.sourceEnd = reference.sourceEnd;
358
	pushOnAstStack(block, true);
323
	pushOnAstStack(block, true);
Lines 416-422 Link Here
416
		} else {
381
		} else {
417
			// If last fragment is a tag, then use it as previous tag
382
			// If last fragment is a tag, then use it as previous tag
418
			FormatJavadocNode lastNode = previousBlock.nodes[previousBlock.nodesPtr];
383
			FormatJavadocNode lastNode = previousBlock.nodes[previousBlock.nodesPtr];
419
			if (!lastNode.isText()) {
384
			while (lastNode != null && lastNode.isText()) {
385
				lastNode = lastNode.getLastNode();
386
			}
387
			if (lastNode != null) {
420
				previousBlock = (FormatJavadocBlock) lastNode;
388
				previousBlock = (FormatJavadocBlock) lastNode;
421
				previousStart = previousBlock.sourceStart;
389
				previousStart = previousBlock.sourceStart;
422
			}
390
			}
(-)formatter/org/eclipse/jdt/internal/formatter/FormatJavadocBlock.java (-9 / +16 lines)
Lines 28-33 Link Here
28
	final static int ON_HEADER_LINE = 0x0004;
28
	final static int ON_HEADER_LINE = 0x0004;
29
	final static int TEXT_ON_TAG_LINE = 0x0008;
29
	final static int TEXT_ON_TAG_LINE = 0x0008;
30
	final static int ONE_LINE_TAG = 0x0010;
30
	final static int ONE_LINE_TAG = 0x0010;
31
	final static int PARAM_TAG = 0x0020;
31
	
32
	
32
	// constants
33
	// constants
33
	final static int MAX_TAG_HIERARCHY = 10;
34
	final static int MAX_TAG_HIERARCHY = 10;
Lines 43-48 Link Here
43
	super(start, end, line);
44
	super(start, end, line);
44
	this.tagValue = value;
45
	this.tagValue = value;
45
	this.tagEnd = end;
46
	this.tagEnd = end;
47
	switch (value) {
48
		case TAG_PARAM_VALUE:
49
		// TODO why are following tags considered like @param by the formatter?
50
		case TAG_SERIAL_FIELD_VALUE:
51
		case TAG_THROWS_VALUE:
52
		case TAG_EXCEPTION_VALUE:
53
			flags |= PARAM_TAG;
54
	}
46
}
55
}
47
56
48
private void addNode(FormatJavadocNode node) {
57
private void addNode(FormatJavadocNode node) {
Lines 72-82 Link Here
72
					textHierarchy[i].sourceEnd = block.sourceEnd;
81
					textHierarchy[i].sourceEnd = block.sourceEnd;
73
				}
82
				}
74
				this.sourceEnd = block.sourceEnd;
83
				this.sourceEnd = block.sourceEnd;
84
				if (isParamTag()) {
85
					block.flags |= PARAM_TAG;
86
				}
75
				return;
87
				return;
76
			}
88
			}
77
		}
89
		}
78
	}
90
	}
79
	addNode(block);
91
	addNode(block);
92
	if (isParamTag()) {
93
		block.flags |= PARAM_TAG;
94
	}
80
}
95
}
81
96
82
void addText(FormatJavadocText text) {
97
void addText(FormatJavadocText text) {
Lines 264-278 Link Here
264
 * 	<code>false</code> otherwise.
279
 * 	<code>false</code> otherwise.
265
 */
280
 */
266
public boolean isParamTag() {
281
public boolean isParamTag() {
267
	switch (this.tagValue) {
282
	return (this.flags & PARAM_TAG) == PARAM_TAG;
268
		case TAG_PARAM_VALUE:
269
		// TODO (eric) why are following tags considered like @param by the formatter?
270
		case TAG_SERIAL_FIELD_VALUE:
271
		case TAG_THROWS_VALUE:
272
		case TAG_EXCEPTION_VALUE:
273
			return true;
274
	}
275
	return false;
276
}
283
}
277
284
278
protected void toString(StringBuffer buffer) {
285
protected void toString(StringBuffer buffer) {
(-)formatter/org/eclipse/jdt/internal/formatter/FormatJavadocReference.java (-6 lines)
Lines 19-25 Link Here
19
 * </p>
19
 * </p>
20
 */
20
 */
21
public class FormatJavadocReference extends FormatJavadocNode {
21
public class FormatJavadocReference extends FormatJavadocNode {
22
	long[] positions; // positions of separators ('.') for qualified references
23
22
24
public FormatJavadocReference(int start, int end, int line) {
23
public FormatJavadocReference(int start, int end, int line) {
25
	super(start, end, line);
24
	super(start, end, line);
Lines 29-39 Link Here
29
	super((int) (position >>> 32), (int) position, line);
28
	super((int) (position >>> 32), (int) position, line);
30
}
29
}
31
30
32
public FormatJavadocReference(long[] positions, int line) {
33
	super((int) (positions[0] >>> 32), (int) positions[positions.length-1], line);
34
	this.positions = positions;
35
}
36
37
void clean() {
31
void clean() {
38
	// Clean positions when used
32
	// Clean positions when used
39
}
33
}
(-)src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsMassiveTests.java (-4 / +4 lines)
Lines 132-144 Link Here
132
 * <ul>
132
 * <ul>
133
 * 	<li>3.0 performance workspace (9951 units):<ul>
133
 * 	<li>3.0 performance workspace (9951 units):<ul>
134
 * 		<li>0 error</li>
134
 * 		<li>0 error</li>
135
 * 		<li>199 failures</li>
135
 * 		<li>104 failures</li>
136
 * 		<li>751 different lines leading spaces</li>
136
 * 		<li>799 different lines leading spaces</li>
137
 *		</ul></li>
137
 *		</ul></li>
138
 *		<li>ganymede workspace (25819 units):<ul>
138
 *		<li>ganymede workspace (25819 units):<ul>
139
 * 		<li>0 error</li>
139
 * 		<li>0 error</li>
140
 * 		<li>376 failures</li>
140
 * 		<li>202 failures</li>
141
 * 		<li>1350 different lines leading spaces</li>
141
 * 		<li>1410 different lines leading spaces</li>
142
 *		</ul></li>
142
 *		</ul></li>
143
 * </ul>
143
 * </ul>
144
 * 
144
 * 
(-)src/org/eclipse/jdt/core/tests/formatter/FormatterCommentsTests.java (+59 lines)
Lines 688-693 Link Here
688
public void testTagParam04() throws JavaModelException {
688
public void testTagParam04() throws JavaModelException {
689
	formatUnit("tags.param", "X04.java");
689
	formatUnit("tags.param", "X04.java");
690
}
690
}
691
public void testTagParam05() throws JavaModelException {
692
	formatUnit("tags.param", "X05.java");
693
}
694
public void testTagParam06() throws JavaModelException {
695
	formatUnit("tags.param", "X06.java");
696
}
691
697
692
/*
698
/*
693
 * Test formatter see tags
699
 * Test formatter see tags
Lines 701-706 Link Here
701
public void testTagSee03() throws JavaModelException {
707
public void testTagSee03() throws JavaModelException {
702
	formatUnit("tags.see", "X03.java");
708
	formatUnit("tags.see", "X03.java");
703
}
709
}
710
public void testTagSee04() throws JavaModelException {
711
	formatUnit("tags.see", "X04.java");
712
}
713
public void testTagSee05() throws JavaModelException {
714
	formatUnit("tags.see", "X05.java");
715
}
716
public void testTagSee06() throws JavaModelException {
717
	formatUnit("tags.see", "X06.java");
718
}
704
719
705
/*
720
/*
706
 * Test formatter see tags
721
 * Test formatter see tags
Lines 803-808 Link Here
803
public void testBlockComments10() throws JavaModelException {
818
public void testBlockComments10() throws JavaModelException {
804
	formatUnit("comments.block", "X10.java");
819
	formatUnit("comments.block", "X10.java");
805
}
820
}
821
public void testBlockComments11() throws JavaModelException {
822
	formatUnit("comments.block", "X11.java");
823
}
806
824
807
/*
825
/*
808
 * Test formatter on example got from workspaces
826
 * Test formatter on example got from workspaces
Lines 869-876 Link Here
869
public void testWkspEclipse13() throws JavaModelException {
887
public void testWkspEclipse13() throws JavaModelException {
870
	formatUnit("wksp.eclipse", "X13.java");
888
	formatUnit("wksp.eclipse", "X13.java");
871
}
889
}
890
public void testWkspEclipse14() throws JavaModelException {
891
	formatUnit("wksp.eclipse", "X14.java");
892
}
872
// JUnit 3.8.2
893
// JUnit 3.8.2
873
public void testWkspJUnit01() throws JavaModelException {
894
public void testWkspJUnit01() throws JavaModelException {
874
	formatUnit("wksp.junit", "X01.java");
895
	formatUnit("wksp.junit", "X01.java");
875
}
896
}
897
898
/**
899
 * @bug 228652: [formatter] New line inserted while formatting a region of a compilation unit.
900
 * @test Insure that no new line is inserted before the formatted region
901
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=228652"
902
 */
903
// TODO (frederic) See https://bugs.eclipse.org/bugs/show_bug.cgi?id=49187
904
public void _testBug228652() {
905
	String input =
906
			"package a;\r\n" + 
907
			"\r\n" + 
908
			"public class Test {\r\n" + 
909
			"\r\n" + 
910
			"	private int field;\r\n" + 
911
			"	\r\n" + 
912
			"	/**\r\n" + 
913
			"	 * fds \r\n" + 
914
			"	 */\r\n" + 
915
			"	public void foo() {\r\n" + 
916
			"	}\r\n" + 
917
			"}";
918
919
	String expected =
920
			"package a;\r\n" + 
921
			"\r\n" + 
922
			"public class Test {\r\n" + 
923
			"\r\n" + 
924
			"	private int field;\r\n" + 
925
			"	\r\n" + 
926
			"	/**\r\n" + 
927
			"	 * fds\r\n" + 
928
			"	 */\r\n" + 
929
			"	public void foo() {\r\n" + 
930
			"	}\r\n" + 
931
			"}";
932
	
933
	formatSource(input, expected, CodeFormatter.K_COMPILATION_UNIT | CodeFormatter.F_INCLUDE_COMMENTS, 0, false, 62, 19, null);
934
}
876
}
935
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/clear_blank_lines/X01.java (-1 / +2 lines)
Lines 6-12 Link Here
6
 * 
6
 * 
7
 * @see {@link PropertyPage}
7
 * @see {@link PropertyPage}
8
 * @see {@link ILaunchConfiguration}
8
 * @see {@link ILaunchConfiguration}
9
 * @see {@link org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog}
9
 * @see {@link org.eclipse.debug.internal.ui.launchConfigurations.
10
 * 	LaunchConfigurationsDialog}
10
 * @see {@link IDebugHelpContextIds#DEFAULT_LAUNCHCONFIGURATION_PROPERTY_PAGE}
11
 * @see {@link IDebugHelpContextIds#DEFAULT_LAUNCHCONFIGURATION_PROPERTY_PAGE}
11
 * 	CONTEXTLAUNCHING
12
 * 	CONTEXTLAUNCHING
12
 * @since 3.3.0
13
 * @since 3.3.0
(-)workspace/FormatterJavadoc/test/tags/see/out/dont_indent_tags/X03.java (-2 / +2 lines)
Lines 8-15 Link Here
8
	}
8
	}
9
9
10
	/**
10
	/**
11
	 * @see X03 Simple type reference (there's no desciption before this section
11
	 * @see X03 Simple type reference (there's no desciption before this
12
	 * !)
12
	 * section!)
13
	 * @see X03.Y03.Z03 Qualified field reference (extended description to have
13
	 * @see X03.Y03.Z03 Qualified field reference (extended description to have
14
	 * it on two lines after the formatting...)
14
	 * it on two lines after the formatting...)
15
	 * @see test.tags.see.X03.Y03 Fully qualified field reference
15
	 * @see test.tags.see.X03.Y03 Fully qualified field reference
(-)workspace/FormatterJavadoc/test/comments/block/out/default/X08.java (-2 / +2 lines)
Lines 6-13 Link Here
6
			if (true) {
6
			if (true) {
7
				if (true) {
7
				if (true) {
8
					if (condition /*
8
					if (condition /*
9
									 * && useChange(d.fDirection) && !d.
9
									 * && useChange(d.fDirection) &&
10
									 * fIsWhitespace
10
									 * !d.fIsWhitespace
11
									 */) {
11
									 */) {
12
					}
12
					}
13
				}
13
				}
(-)workspace/FormatterJavadoc/test/comments/block/out/default/X05e.java (-4 / +4 lines)
Lines 17-24 Link Here
17
 * this list of conditions and the following disclaimer.
17
 * this list of conditions and the following disclaimer.
18
 * 
18
 * 
19
 * 2. Redistributions in binary form must reproduce the above copyright notice,
19
 * 2. Redistributions in binary form must reproduce the above copyright notice,
20
 * this list of conditions and the following disclaimer in the documentation and
20
 * this list of conditions and the following disclaimer in the documentation
21
 * /or other materials provided with the distribution.
21
 * and/or other materials provided with the distribution.
22
 * 
22
 * 
23
 * 3. The end-user documentation included with the redistribution, if any, must
23
 * 3. The end-user documentation included with the redistribution, if any, must
24
 * include the following acknowledgment: "This product includes software
24
 * include the following acknowledgment: "This product includes software
Lines 44-51 Link Here
44
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
44
 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
45
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
45
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
46
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
46
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
47
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==========================
47
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48
 * ==========================================
48
 * ====================================================================
49
 * 
49
 * 
50
 * This software consists of voluntary contributions made by many individuals on
50
 * This software consists of voluntary contributions made by many individuals on
51
 * behalf of the Apache Software Foundation. For more information on the Apache
51
 * behalf of the Apache Software Foundation. For more information on the Apache
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X02.java (-2 / +2 lines)
Lines 6-13 Link Here
6
	 * will remove the charset setting for this resource.
6
	 * will remove the charset setting for this resource.
7
	 * <p>
7
	 * <p>
8
	 * This method changes resources; these changes will be reported in a
8
	 * This method changes resources; these changes will be reported in a
9
	 * subsequent resource change event, including an indication that this file'
9
	 * subsequent resource change event, including an indication that this
10
	 * s encoding has changed.
10
	 * file's encoding has changed.
11
	 * </p>
11
	 * </p>
12
	 * <p>
12
	 * <p>
13
	 * This method is long-running; progress and cancellation are provided by
13
	 * This method is long-running; progress and cancellation are provided by
(-)workspace/FormatterJavadoc/test/comments/block/out/clear_blank_lines/X05e.java (-7 / +7 lines)
Lines 17-24 Link Here
17
 * end-user documentation included with the redistribution, if any, must include
17
 * end-user documentation included with the redistribution, if any, must include
18
 * the following acknowledgment: "This product includes software developed by
18
 * the following acknowledgment: "This product includes software developed by
19
 * the Apache Software Foundation (http://www.apache.org/)." Alternately, this
19
 * the Apache Software Foundation (http://www.apache.org/)." Alternately, this
20
 * acknowledgment may appear in the software itself, if and wherever such third-
20
 * acknowledgment may appear in the software itself, if and wherever such
21
 * party acknowledgments normally appear. 4. The names "Apache" and
21
 * third-party acknowledgments normally appear. 4. The names "Apache" and
22
 * "Apache Software Foundation" and "Apache Lucene" must not be used to endorse
22
 * "Apache Software Foundation" and "Apache Lucene" must not be used to endorse
23
 * or promote products derived from this software without prior written
23
 * or promote products derived from this software without prior written
24
 * permission. For written permission, please contact apache@apache.org. 5.
24
 * permission. For written permission, please contact apache@apache.org. 5.
Lines 34-44 Link Here
34
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
34
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
35
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
35
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
36
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
36
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
37
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================
37
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38
 * ================================== This software consists of voluntary
38
 * ==================================================================== This
39
 * contributions made by many individuals on behalf of the Apache Software
39
 * software consists of voluntary contributions made by many individuals on
40
 * Foundation. For more information on the Apache Software Foundation, please
40
 * behalf of the Apache Software Foundation. For more information on the Apache
41
 * see <http://www.apache.org/>.
41
 * Software Foundation, please see <http://www.apache.org/>.
42
 */
42
 */
43
class Y05 {
43
class Y05 {
44
}
44
}
(-)workspace/FormatterJavadoc/test/comments/block/out/clear_blank_lines/X05.java (-7 / +7 lines)
Lines 13-20 Link Here
13
 * end-user documentation included with the redistribution, if any, must include
13
 * end-user documentation included with the redistribution, if any, must include
14
 * the following acknowledgment: "This product includes software developed by
14
 * the following acknowledgment: "This product includes software developed by
15
 * the Apache Software Foundation (http://www.apache.org/)." Alternately, this
15
 * the Apache Software Foundation (http://www.apache.org/)." Alternately, this
16
 * acknowledgment may appear in the software itself, if and wherever such third-
16
 * acknowledgment may appear in the software itself, if and wherever such
17
 * party acknowledgments normally appear. 4. The names "Apache" and
17
 * third-party acknowledgments normally appear. 4. The names "Apache" and
18
 * "Apache Software Foundation" and "Apache Lucene" must not be used to endorse
18
 * "Apache Software Foundation" and "Apache Lucene" must not be used to endorse
19
 * or promote products derived from this software without prior written
19
 * or promote products derived from this software without prior written
20
 * permission. For written permission, please contact apache@apache.org. 5.
20
 * permission. For written permission, please contact apache@apache.org. 5.
Lines 30-40 Link Here
30
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
31
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
32
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
32
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
33
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ==================================
33
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
 * ================================== This software consists of voluntary
34
 * ==================================================================== This
35
 * contributions made by many individuals on behalf of the Apache Software
35
 * software consists of voluntary contributions made by many individuals on
36
 * Foundation. For more information on the Apache Software Foundation, please
36
 * behalf of the Apache Software Foundation. For more information on the Apache
37
 * see <http://www.apache.org/>.
37
 * Software Foundation, please see <http://www.apache.org/>.
38
 */
38
 */
39
public class X05 {
39
public class X05 {
40
40
(-)src/org/eclipse/jdt/core/tests/formatter/comment/JavaDocTestCase.java (+40 lines)
Lines 935-938 Link Here
935
		String result=testFormat(input, options);
935
		String result=testFormat(input, options);
936
		assertEquals(expected, result);
936
		assertEquals(expected, result);
937
	}
937
	}
938
939
	/**
940
	 * @bug 228652: [formatter] New line inserted while formatting a region of a compilation unit.
941
	 * @test Insure that no new line is inserted before the formatted region
942
	 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=228652"
943
	 */
944
	public void testBug228652() {
945
		Map options = DefaultCodeFormatterConstants.getEclipseDefaultSettings();
946
947
		String input =
948
				"package a;\r\n" + 
949
				"\r\n" + 
950
				"public class Test {\r\n" + 
951
				"\r\n" + 
952
				"	private int field;\r\n" + 
953
				"	\r\n" + 
954
				"	/**\r\n" + 
955
				"	 * fds \r\n" + 
956
				"	 */\r\n" + 
957
				"	public void foo() {\r\n" + 
958
				"	}\r\n" + 
959
				"}";
960
961
		String expected =
962
				"package a;\r\n" + 
963
				"\r\n" + 
964
				"public class Test {\r\n" + 
965
				"\r\n" + 
966
				"	private int field;\r\n" + 
967
				"	\r\n" + 
968
				"	/**\r\n" + 
969
				"	 * fds\r\n" + 
970
				"	 */\r\n" + 
971
				"	public void foo() {\r\n" + 
972
				"	}\r\n" + 
973
				"}";
974
		
975
		String result = testFormat(input, 62, 19, CodeFormatter.K_JAVA_DOC, options);
976
		assertEquals(expected, result);
977
	}
938
}
978
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X01.java (-1 / +2 lines)
Lines 6-12 Link Here
6
 * 
6
 * 
7
 * @see {@link PropertyPage}
7
 * @see {@link PropertyPage}
8
 * @see {@link ILaunchConfiguration}
8
 * @see {@link ILaunchConfiguration}
9
 * @see {@link org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog}
9
 * @see {@link
10
 * org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog}
10
 * @see {@link IDebugHelpContextIds#DEFAULT_LAUNCHCONFIGURATION_PROPERTY_PAGE}
11
 * @see {@link IDebugHelpContextIds#DEFAULT_LAUNCHCONFIGURATION_PROPERTY_PAGE}
11
 * 
12
 * 
12
 * CONTEXTLAUNCHING
13
 * CONTEXTLAUNCHING
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X02.java (-2 / +2 lines)
Lines 6-13 Link Here
6
	 * will remove the charset setting for this resource.
6
	 * will remove the charset setting for this resource.
7
	 * <p>
7
	 * <p>
8
	 * This method changes resources; these changes will be reported in a
8
	 * This method changes resources; these changes will be reported in a
9
	 * subsequent resource change event, including an indication that this file'
9
	 * subsequent resource change event, including an indication that this
10
	 * s encoding has changed.
10
	 * file's encoding has changed.
11
	 * </p>
11
	 * </p>
12
	 * <p>
12
	 * <p>
13
	 * This method is long-running; progress and cancellation are provided by
13
	 * This method is long-running; progress and cancellation are provided by
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X08.java (-12 / +12 lines)
Lines 41-58 Link Here
41
 * <code>isSaveNeeded</code> . The value <code>true</code> triggers a subsequent
41
 * <code>isSaveNeeded</code> . The value <code>true</code> triggers a subsequent
42
 * call to <code>save</code> where the modified resources can be saved.
42
 * call to <code>save</code> where the modified resources can be saved.
43
 * <p>
43
 * <p>
44
 * The most important part of this implementation is the setup of the compare/
44
 * The most important part of this implementation is the setup of the
45
 * merge UI. The UI uses a simple browser metaphor to present compare results.
45
 * compare/merge UI. The UI uses a simple browser metaphor to present compare
46
 * The top half of the layout shows the structural compare results (e.g. added,
46
 * results. The top half of the layout shows the structural compare results
47
 * deleted, and changed files), the bottom half the content compare results (e.g
47
 * (e.g. added, deleted, and changed files), the bottom half the content compare
48
 * . textual differences between two files). A selection in the top pane is fed
48
 * results (e.g. textual differences between two files). A selection in the top
49
 * to the bottom pane. If a content viewer is registered for the type of the
49
 * pane is fed to the bottom pane. If a content viewer is registered for the
50
 * selected object, this viewer is installed in the pane. In addition if a
50
 * type of the selected object, this viewer is installed in the pane. In
51
 * structure viewer is registered for the selection type the top pane is split
51
 * addition if a structure viewer is registered for the selection type the top
52
 * horizontally to make room for another pane and the structure viewer is
52
 * pane is split horizontally to make room for another pane and the structure
53
 * installed in it. When comparing Java files this second structure viewer would
53
 * viewer is installed in it. When comparing Java files this second structure
54
 * show the structural differences within a Java file, e.g. added, deleted or
54
 * viewer would show the structural differences within a Java file, e.g. added,
55
 * changed methods and fields.
55
 * deleted or changed methods and fields.
56
 * <p>
56
 * <p>
57
 * Subclasses provide custom setups, e.g. for a Catchup/Release operation by
57
 * Subclasses provide custom setups, e.g. for a Catchup/Release operation by
58
 * passing a subclass of <code>CompareConfiguration</code> and by implementing
58
 * passing a subclass of <code>CompareConfiguration</code> and by implementing
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X01.java (-1 / +2 lines)
Lines 6-12 Link Here
6
 * 
6
 * 
7
 * @see {@link PropertyPage}
7
 * @see {@link PropertyPage}
8
 * @see {@link ILaunchConfiguration}
8
 * @see {@link ILaunchConfiguration}
9
 * @see {@link org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog}
9
 * @see {@link org.eclipse.debug.internal.ui.launchConfigurations.
10
 * 	LaunchConfigurationsDialog}
10
 * @see {@link IDebugHelpContextIds#DEFAULT_LAUNCHCONFIGURATION_PROPERTY_PAGE}
11
 * @see {@link IDebugHelpContextIds#DEFAULT_LAUNCHCONFIGURATION_PROPERTY_PAGE}
11
 * 
12
 * 
12
 * 	CONTEXTLAUNCHING
13
 * 	CONTEXTLAUNCHING
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X02.java (-2 / +2 lines)
Lines 6-13 Link Here
6
	 * will remove the charset setting for this resource.
6
	 * will remove the charset setting for this resource.
7
	 * <p>
7
	 * <p>
8
	 * This method changes resources; these changes will be reported in a
8
	 * This method changes resources; these changes will be reported in a
9
	 * subsequent resource change event, including an indication that this file'
9
	 * subsequent resource change event, including an indication that this
10
	 * s encoding has changed.
10
	 * file's encoding has changed.
11
	 * </p>
11
	 * </p>
12
	 * <p>
12
	 * <p>
13
	 * This method is long-running; progress and cancellation are provided by
13
	 * This method is long-running; progress and cancellation are provided by
(-)workspace/FormatterJavadoc/test/tags/see/out/default/X03.java (-2 / +2 lines)
Lines 8-15 Link Here
8
	}
8
	}
9
9
10
	/**
10
	/**
11
	 * @see X03 Simple type reference (there's no desciption before this section
11
	 * @see X03 Simple type reference (there's no desciption before this
12
	 * 	!)
12
	 * 	section!)
13
	 * @see X03.Y03.Z03 Qualified field reference (extended description to have
13
	 * @see X03.Y03.Z03 Qualified field reference (extended description to have
14
	 * 	it on two lines after the formatting...)
14
	 * 	it on two lines after the formatting...)
15
	 * @see test.tags.see.X03.Y03 Fully qualified field reference
15
	 * @see test.tags.see.X03.Y03 Fully qualified field reference
(-)workspace/FormatterJavadoc/test/tags/param/out/dont_indent_descr/X06.java (+14 lines)
Added Link Here
1
package test.tags.param;
2
3
public class X06 {
4
	/**
5
	 * Returns a collection of projects referenced by a build scope attribute.
6
	 * 
7
	 * @param scope
8
	 * 	build scope attribute (<code>ATTR_BUILD_SCOPE</code>)
9
	 * @return collection of porjects referred to by the scope attribute
10
	 */
11
	int foo() {
12
		return 0;
13
	}
14
}
(-)workspace/FormatterJavadoc/test/tags/see/out/dont_indent_tags/X06.java (+11 lines)
Added Link Here
1
package test.tags.see;
2
3
public class X06 {
4
5
	/**
6
	 * @see org.xml.sax.ext.DeclHandler#externalEntityDecl(java.lang.String,
7
	 * java.lang.String, java.lang.String)
8
	 */
9
	void foo() {
10
	}
11
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_tags/X14.java (+21 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X14 {
4
5
	/**
6
	 * Returns an open input stream on the contents of the specified help
7
	 * resource. The client is responsible for closing the stream when finished.
8
	 * 
9
	 * @param href
10
	 * the URL (as a string) of the help resource
11
	 * <p>
12
	 * Valid href are as described in {@link
13
	 * org.eclipse.help.IHelpResource#getHref IHelpResource.getHref}
14
	 * </p>
15
	 * @return an input stream containing the contents of the help resource, or
16
	 * <code>null</code> if the help resource could not be found and opened
17
	 */
18
	int foo(String href) {
19
		return 0;
20
	}
21
}
(-)workspace/FormatterJavadoc/test/comments/block/X11.java (+11 lines)
Added Link Here
1
package test.comments.block;
2
3
public class X11 {
4
5
public X11() {
6
	this(false /*comment*/, false /*whitespace*/, false /*nls*/, 0 /*sourceLevel*/, null/*taskTag*/, null/*taskPriorities*/, true /*taskCaseSensitive*/);
7
}
8
9
public X11(boolean b, boolean c, boolean d, int i, Object object, Object object2, boolean e) {
10
}
11
}
(-)workspace/FormatterJavadoc/test/tags/see/X04.java (+11 lines)
Added Link Here
1
package test.tags.see;
2
3
public class X04 {
4
5
	/**
6
	 * When a preference changes, update the in-memory cache of the preference.
7
	 * @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent)
8
	 */
9
	void foo() {
10
	}
11
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/dont_indent_descr/X14.java (+21 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X14 {
4
5
	/**
6
	 * Returns an open input stream on the contents of the specified help
7
	 * resource. The client is responsible for closing the stream when finished.
8
	 * 
9
	 * @param href
10
	 * 	the URL (as a string) of the help resource
11
	 * 	<p>
12
	 * 	Valid href are as described in {@link
13
	 * 	org.eclipse.help.IHelpResource#getHref IHelpResource.getHref}
14
	 * 	</p>
15
	 * @return an input stream containing the contents of the help resource, or
16
	 * 	<code>null</code> if the help resource could not be found and opened
17
	 */
18
	int foo(String href) {
19
		return 0;
20
	}
21
}
(-)workspace/FormatterJavadoc/test/tags/param/out/dont_indent_tags/X05.java (+12 lines)
Added Link Here
1
package test.tags.param;
2
3
public class X05 {
4
	/**
5
	 * Test with exception tag.
6
	 * 
7
	 * @exception Throwable
8
	 * if any exception is thrown
9
	 */
10
	public void foo() throws Throwable {
11
	}
12
}
(-)workspace/FormatterJavadoc/test/comments/block/out/default/X11.java (+14 lines)
Added Link Here
1
package test.comments.block;
2
3
public class X11 {
4
5
	public X11() {
6
		this(false /* comment */, false /* whitespace */, false /* nls */,
7
				0 /* sourceLevel */, null/* taskTag */,
8
				null/* taskPriorities */, true /* taskCaseSensitive */);
9
	}
10
11
	public X11(boolean b, boolean c, boolean d, int i, Object object,
12
			Object object2, boolean e) {
13
	}
14
}
(-)workspace/FormatterJavadoc/test/tags/see/out/dont_indent_tags/X05.java (+13 lines)
Added Link Here
1
package test.tags.see;
2
3
public class X05 {
4
5
	class Y05 {
6
		/**
7
		 * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String,
8
		 * java.lang.String)
9
		 */
10
		void foo() {
11
		}
12
	}
13
}
(-)workspace/FormatterJavadoc/test/tags/see/out/default/X04.java (+13 lines)
Added Link Here
1
package test.tags.see;
2
3
public class X04 {
4
5
	/**
6
	 * When a preference changes, update the in-memory cache of the preference.
7
	 * 
8
	 * @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#
9
	 * 	propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent)
10
	 */
11
	void foo() {
12
	}
13
}
(-)workspace/FormatterJavadoc/test/tags/see/out/default/X06.java (+11 lines)
Added Link Here
1
package test.tags.see;
2
3
public class X06 {
4
5
	/**
6
	 * @see org.xml.sax.ext.DeclHandler#externalEntityDecl(java.lang.String,
7
	 * 	java.lang.String, java.lang.String)
8
	 */
9
	void foo() {
10
	}
11
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/out/default/X14.java (+21 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X14 {
4
5
	/**
6
	 * Returns an open input stream on the contents of the specified help
7
	 * resource. The client is responsible for closing the stream when finished.
8
	 * 
9
	 * @param href
10
	 * 		the URL (as a string) of the help resource
11
	 * 		<p>
12
	 * 		Valid href are as described in {@link
13
	 * 		org.eclipse.help.IHelpResource#getHref IHelpResource.getHref}
14
	 * 		</p>
15
	 * @return an input stream containing the contents of the help resource, or
16
	 * 	<code>null</code> if the help resource could not be found and opened
17
	 */
18
	int foo(String href) {
19
		return 0;
20
	}
21
}
(-)workspace/FormatterJavadoc/test/tags/see/out/dont_indent_tags/X04.java (+13 lines)
Added Link Here
1
package test.tags.see;
2
3
public class X04 {
4
5
	/**
6
	 * When a preference changes, update the in-memory cache of the preference.
7
	 * 
8
	 * @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#
9
	 * propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent)
10
	 */
11
	void foo() {
12
	}
13
}
(-)workspace/FormatterJavadoc/test/tags/see/X05.java (+12 lines)
Added Link Here
1
package test.tags.see;
2
3
public class X05 {
4
5
	class Y05 {
6
		/**
7
		 * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String)
8
		 */
9
		void foo() {
10
		}
11
	}
12
}
(-)workspace/FormatterJavadoc/test/tags/param/out/dont_indent_tags/X06.java (+14 lines)
Added Link Here
1
package test.tags.param;
2
3
public class X06 {
4
	/**
5
	 * Returns a collection of projects referenced by a build scope attribute.
6
	 * 
7
	 * @param scope
8
	 * build scope attribute (<code>ATTR_BUILD_SCOPE</code>)
9
	 * @return collection of porjects referred to by the scope attribute
10
	 */
11
	int foo() {
12
		return 0;
13
	}
14
}
(-)workspace/FormatterJavadoc/test/tags/see/X06.java (+10 lines)
Added Link Here
1
package test.tags.see;
2
3
public class X06 {
4
5
	/**
6
	 * @see org.xml.sax.ext.DeclHandler#externalEntityDecl(java.lang.String, java.lang.String, java.lang.String)
7
	 */
8
	void foo() {
9
	}
10
}
(-)workspace/FormatterJavadoc/test/tags/param/out/dont_indent_descr/X05.java (+12 lines)
Added Link Here
1
package test.tags.param;
2
3
public class X05 {
4
	/**
5
	 * Test with exception tag.
6
	 * 
7
	 * @exception Throwable
8
	 * 	if any exception is thrown
9
	 */
10
	public void foo() throws Throwable {
11
	}
12
}
(-)workspace/FormatterJavadoc/test/wksp/eclipse/X14.java (+22 lines)
Added Link Here
1
package test.wksp.eclipse;
2
3
public class X14 {
4
5
	/**
6
	 * Returns an open input stream on the contents of the specified help
7
	 * resource. The client is responsible for closing the stream when finished.
8
	 * 
9
	 * @param href
10
	 *            the URL (as a string) of the help resource
11
	 *            <p>
12
	 *            Valid href are as described in
13
	 *            {@link  org.eclipse.help.IHelpResource#getHref IHelpResource.getHref}
14
	 *            </p>
15
	 * @return an input stream containing the contents of the help resource, or
16
	 *         <code>null</code> if the help resource could not be found and
17
	 *         opened
18
	 */
19
	int foo(String href) {
20
		return 0;
21
	}
22
}
(-)workspace/FormatterJavadoc/test/tags/see/out/default/X05.java (+13 lines)
Added Link Here
1
package test.tags.see;
2
3
public class X05 {
4
5
	class Y05 {
6
		/**
7
		 * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String,
8
		 * 	java.lang.String)
9
		 */
10
		void foo() {
11
		}
12
	}
13
}

Return to bug 227043