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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java (-3 / +13 lines)
Lines 211-230 Link Here
211
	this.complianceLevel = complianceLevel;
211
	this.complianceLevel = complianceLevel;
212
	this.checkNonExternalizedStringLiterals = checkNonExternalizedStringLiterals;
212
	this.checkNonExternalizedStringLiterals = checkNonExternalizedStringLiterals;
213
	if (taskTags != null) {
213
	if (taskTags != null) {
214
		int length = taskTags.length;
214
		int taskTagsLength = taskTags.length;
215
		int length = taskTagsLength;
215
		if (taskPriorities != null) {
216
		if (taskPriorities != null) {
217
			int taskPrioritiesLength = taskPriorities.length;
218
			if (taskPrioritiesLength != taskTagsLength) {
219
				if (taskPrioritiesLength > taskTagsLength) {
220
					System.arraycopy(taskPriorities, 0, (taskPriorities = new char[taskTagsLength][]), 0, taskTagsLength);
221
				} else {
222
					System.arraycopy(taskTags, 0, (taskTags = new char[taskPrioritiesLength][]), 0, taskPrioritiesLength);
223
					length = taskPrioritiesLength;
224
				}
225
			}
216
			int[] initialIndexes = new int[length];
226
			int[] initialIndexes = new int[length];
217
			for (int i = 0; i < length; i++) {
227
			for (int i = 0; i < length; i++) {
218
				initialIndexes[i] = i;
228
				initialIndexes[i] = i;
219
			}
229
			}
220
			Util.reverseQuickSort(taskTags, 0, taskTags.length - 1, initialIndexes);
230
			Util.reverseQuickSort(taskTags, 0, length - 1, initialIndexes);
221
			char[][] temp = new char[length][];
231
			char[][] temp = new char[length][];
222
			for (int i = 0; i < length; i++) {
232
			for (int i = 0; i < length; i++) {
223
				temp[i] = taskPriorities[initialIndexes[i]];
233
				temp[i] = taskPriorities[initialIndexes[i]];
224
			}
234
			}
225
			this.taskPriorities = temp;
235
			this.taskPriorities = temp;
226
		} else {
236
		} else {
227
			Util.reverseQuickSort(taskTags, 0, taskTags.length - 1);
237
			Util.reverseQuickSort(taskTags, 0, length - 1);
228
		}
238
		}
229
		this.taskTags = taskTags;
239
		this.taskTags = taskTags;
230
		this.isTaskCaseSensitive = isTaskCaseSensitive;
240
		this.isTaskCaseSensitive = isTaskCaseSensitive;
(-)model/org/eclipse/jdt/core/JavaCore.java (-4 / +10 lines)
Lines 1336-1342 Link Here
1336
	 * Compiler option ID: Defining the Automatic Task Priorities.
1336
	 * Compiler option ID: Defining the Automatic Task Priorities.
1337
	 * <p>In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
1337
	 * <p>In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low)
1338
	 *    of the task markers issued by the compiler.
1338
	 *    of the task markers issued by the compiler.
1339
	 *    If the default is specified, the priority of each task marker is <code>"NORMAL"</code>.
1339
	 *    If the default is specified, the priority of each task marker is <code>"NORMAL"</code>.</p>
1340
	 * <p>Task Priorities and task tags must have the same length. If task priorities are set, then task tags should also
1341
	 * be set.</p>
1340
	 * <dl>
1342
	 * <dl>
1341
	 * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.taskPriorities"</code></dd>
1343
	 * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.taskPriorities"</code></dd>
1342
	 * <dt>Possible values:</dt><dd><code>{ "&lt;priority&gt;[,&lt;priority&gt;]*" }</code> where <code>&lt;priority&gt;</code> is one of <code>"HIGH"</code>, <code>"NORMAL"</code> or <code>"LOW"</code></dd>
1344
	 * <dt>Possible values:</dt><dd><code>{ "&lt;priority&gt;[,&lt;priority&gt;]*" }</code> where <code>&lt;priority&gt;</code> is one of <code>"HIGH"</code>, <code>"NORMAL"</code> or <code>"LOW"</code></dd>
Lines 1344-1349 Link Here
1344
	 * </dl>
1346
	 * </dl>
1345
	 * @since 2.1
1347
	 * @since 2.1
1346
	 * @category CompilerOptionID
1348
	 * @category CompilerOptionID
1349
	 * @see #COMPILER_TASK_TAGS
1347
	 */
1350
	 */
1348
	public static final String COMPILER_TASK_PRIORITIES = PLUGIN_ID + ".compiler.taskPriorities"; //$NON-NLS-1$
1351
	public static final String COMPILER_TASK_PRIORITIES = PLUGIN_ID + ".compiler.taskPriorities"; //$NON-NLS-1$
1349
	/**
1352
	/**
Lines 1351-1365 Link Here
1351
	 * <p>When the tag list is not empty, the compiler will issue a task marker whenever it encounters
1354
	 * <p>When the tag list is not empty, the compiler will issue a task marker whenever it encounters
1352
	 *    one of the corresponding tags inside any comment in Java source code.
1355
	 *    one of the corresponding tags inside any comment in Java source code.
1353
	 * <p>Generated task messages will start with the tag, and range until the next line separator,
1356
	 * <p>Generated task messages will start with the tag, and range until the next line separator,
1354
	 *    comment ending, or tag.
1357
	 *    comment ending, or tag.</p>
1355
	 * <p>When a given line of code bears multiple tags, each tag will be reported separately.
1358
	 * <p>When a given line of code bears multiple tags, each tag will be reported separately.
1356
	 *    Moreover, a tag immediately followed by another tag will be reported using the contents of the
1359
	 *    Moreover, a tag immediately followed by another tag will be reported using the contents of the
1357
	 *    next non-empty tag of the line, if any.
1360
	 *    next non-empty tag of the line, if any.</p>
1358
	 * <p>Note that tasks messages are trimmed. If a tag is starting with a letter or digit, then it cannot be leaded by
1361
	 * <p>Note that tasks messages are trimmed. If a tag is starting with a letter or digit, then it cannot be leaded by
1359
	 *    another letter or digit to be recognized (<code>"fooToDo"</code> will not be recognized as a task for tag <code>"ToDo"</code>, but <code>"foo#ToDo"</code>
1362
	 *    another letter or digit to be recognized (<code>"fooToDo"</code> will not be recognized as a task for tag <code>"ToDo"</code>, but <code>"foo#ToDo"</code>
1360
	 *    will be detected for either tag <code>"ToDo"</code> or <code>"#ToDo"</code>). Respectively, a tag ending with a letter or digit cannot be followed
1363
	 *    will be detected for either tag <code>"ToDo"</code> or <code>"#ToDo"</code>). Respectively, a tag ending with a letter or digit cannot be followed
1361
	 *    by a letter or digit to be recognized (<code>"ToDofoo"</code> will not be recognized as a task for tag <code>"ToDo"</code>, but <code>"ToDo:foo"</code> will
1364
	 *    by a letter or digit to be recognized (<code>"ToDofoo"</code> will not be recognized as a task for tag <code>"ToDo"</code>, but <code>"ToDo:foo"</code> will
1362
	 *    be detected either for tag <code>"ToDo"</code> or <code>"ToDo:"</code>).
1365
	 *    be detected either for tag <code>"ToDo"</code> or <code>"ToDo:"</code>).</p>
1366
	 * <p>Task Priorities and task tags must have the same length. If task tags are set, then task priorities should also
1367
	 * be set.</p>
1363
	 * <dl>
1368
	 * <dl>
1364
	 * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.taskTags"</code></dd>
1369
	 * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.taskTags"</code></dd>
1365
	 * <dt>Possible values:</dt><dd><code>{ "&lt;tag&gt;[,&lt;tag&gt;]*" }</code> where <code>&lt;tag&gt;</code> is a String without any wild-card or leading/trailing spaces</dd>
1370
	 * <dt>Possible values:</dt><dd><code>{ "&lt;tag&gt;[,&lt;tag&gt;]*" }</code> where <code>&lt;tag&gt;</code> is a String without any wild-card or leading/trailing spaces</dd>
Lines 1367-1372 Link Here
1367
	 * </dl>
1372
	 * </dl>
1368
	 * @since 2.1
1373
	 * @since 2.1
1369
	 * @category CompilerOptionID
1374
	 * @category CompilerOptionID
1375
	 * @see #COMPILER_TASK_PRIORITIES
1370
	 */
1376
	 */
1371
	public static final String COMPILER_TASK_TAGS = PLUGIN_ID + ".compiler.taskTags"; //$NON-NLS-1$
1377
	public static final String COMPILER_TASK_TAGS = PLUGIN_ID + ".compiler.taskTags"; //$NON-NLS-1$
1372
	/**
1378
	/**
(-)model/org/eclipse/jdt/internal/core/JavaModelManager.java (+1 lines)
Lines 2061-2066 Link Here
2061
		// backward compatibility
2061
		// backward compatibility
2062
		addDeprecatedOptions(options);
2062
		addDeprecatedOptions(options);
2063
2063
2064
		Util.fixTaskTags(options);
2064
		// store built map in cache
2065
		// store built map in cache
2065
		this.optionsCache = new Hashtable(options);
2066
		this.optionsCache = new Hashtable(options);
2066
2067
(-)model/org/eclipse/jdt/internal/core/JavaProject.java (+2 lines)
Lines 1674-1681 Link Here
1674
					options.put(propertyName, propertyValue.trim());
1674
					options.put(propertyName, propertyValue.trim());
1675
				}
1675
				}
1676
			}
1676
			}
1677
			Util.fixTaskTags(options);
1677
			return options;
1678
			return options;
1678
		}
1679
		}
1680
		Util.fixTaskTags(projectOptions);
1679
		return projectOptions;
1681
		return projectOptions;
1680
	}
1682
	}
1681
1683
(-)model/org/eclipse/jdt/internal/core/util/Util.java (+50 lines)
Lines 112-117 Link Here
112
	private static final char[] VOID = "void".toCharArray(); //$NON-NLS-1$
112
	private static final char[] VOID = "void".toCharArray(); //$NON-NLS-1$
113
	private static final char[] INIT = "<init>".toCharArray(); //$NON-NLS-1$
113
	private static final char[] INIT = "<init>".toCharArray(); //$NON-NLS-1$
114
114
115
	private static final String TASK_PRIORITIES_PROBLEM = "TASK_PRIORITIES_PB"; //$NON-NLS-1$
115
	private static List fgRepeatedMessages= new ArrayList(5);
116
	private static List fgRepeatedMessages= new ArrayList(5);
116
117
117
	private Util() {
118
	private Util() {
Lines 1825-1830 Link Here
1825
		log(e);
1826
		log(e);
1826
	}
1827
	}
1827
1828
1829
	public static void logRepeatedMessage(String key, int statusErrorID, String message) {
1830
		if (key == null) {
1831
			throw new IllegalArgumentException("key cannot be null"); //$NON-NLS-1$
1832
		}
1833
		if (fgRepeatedMessages.contains(key)) {
1834
			return;
1835
		}
1836
		fgRepeatedMessages.add(key);
1837
		log(statusErrorID, message);
1838
	}
1839
1828
	/*
1840
	/*
1829
	 * Add a log entry
1841
	 * Add a log entry
1830
	 */
1842
	 */
Lines 3571-3574 Link Here
3571
		return start;
3583
		return start;
3572
	}
3584
	}
3573
3585
3586
	/*
3587
	 * This method adjusts the task tags and task priorities so that they have the same size
3588
	 */
3589
	public static void fixTaskTags(Map defaultOptionsMap) {
3590
		Object taskTagsValue = defaultOptionsMap.get(JavaCore.COMPILER_TASK_TAGS);
3591
		char[][] taskTags = null;
3592
		if (taskTagsValue instanceof String) {
3593
			taskTags = CharOperation.splitAndTrimOn(',', ((String) taskTagsValue).toCharArray());
3594
		}
3595
		Object taskPrioritiesValue = defaultOptionsMap.get(JavaCore.COMPILER_TASK_PRIORITIES);
3596
		char[][] taskPriorities = null;
3597
		if (taskPrioritiesValue instanceof String) {
3598
			taskPriorities = CharOperation.splitAndTrimOn(',', ((String) taskPrioritiesValue).toCharArray());
3599
		}
3600
		if (taskPriorities == null) {
3601
			if (taskTags != null) {
3602
				Util.logRepeatedMessage(TASK_PRIORITIES_PROBLEM, IStatus.ERROR, "Inconsistent values for taskTags (not null) and task priorities (null)"); //$NON-NLS-1$
3603
				defaultOptionsMap.remove(JavaCore.COMPILER_TASK_TAGS);
3604
				return;
3605
			}
3606
		} else if (taskTags == null) {
3607
			Util.logRepeatedMessage(TASK_PRIORITIES_PROBLEM, IStatus.ERROR, "Inconsistent values for taskTags (null) and task priorities (not null)"); //$NON-NLS-1$
3608
			defaultOptionsMap.remove(JavaCore.COMPILER_TASK_PRIORITIES);
3609
			return;
3610
		}
3611
		int taskTagsLength = taskTags.length;
3612
		int taskPrioritiesLength = taskPriorities.length;
3613
		if (taskTagsLength != taskPrioritiesLength) {
3614
			Util.logRepeatedMessage(TASK_PRIORITIES_PROBLEM, IStatus.ERROR, "Inconsistent values for taskTags and task priorities : length is different"); //$NON-NLS-1$
3615
			if (taskTagsLength > taskPrioritiesLength) {
3616
				System.arraycopy(taskTags, 0, (taskTags = new char[taskPrioritiesLength][]), 0, taskPrioritiesLength);
3617
				defaultOptionsMap.put(JavaCore.COMPILER_TASK_TAGS, new String(CharOperation.concatWith(taskTags,',')));
3618
			} else {
3619
				System.arraycopy(taskPriorities, 0, (taskPriorities = new char[taskTagsLength][]), 0, taskTagsLength);
3620
				defaultOptionsMap.put(JavaCore.COMPILER_TASK_PRIORITIES, new String(CharOperation.concatWith(taskPriorities,',')));
3621
			}
3622
		}
3623
	}
3574
}
3624
}

Return to bug 307295