### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core Index: compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java,v retrieving revision 1.202 diff -u -r1.202 Scanner.java --- compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java 4 Mar 2010 16:43:55 -0000 1.202 +++ compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java 8 Apr 2010 01:24:29 -0000 @@ -211,20 +211,30 @@ this.complianceLevel = complianceLevel; this.checkNonExternalizedStringLiterals = checkNonExternalizedStringLiterals; if (taskTags != null) { - int length = taskTags.length; + int taskTagsLength = taskTags.length; + int length = taskTagsLength; if (taskPriorities != null) { + int taskPrioritiesLength = taskPriorities.length; + if (taskPrioritiesLength != taskTagsLength) { + if (taskPrioritiesLength > taskTagsLength) { + System.arraycopy(taskPriorities, 0, (taskPriorities = new char[taskTagsLength][]), 0, taskTagsLength); + } else { + System.arraycopy(taskTags, 0, (taskTags = new char[taskPrioritiesLength][]), 0, taskPrioritiesLength); + length = taskPrioritiesLength; + } + } int[] initialIndexes = new int[length]; for (int i = 0; i < length; i++) { initialIndexes[i] = i; } - Util.reverseQuickSort(taskTags, 0, taskTags.length - 1, initialIndexes); + Util.reverseQuickSort(taskTags, 0, length - 1, initialIndexes); char[][] temp = new char[length][]; for (int i = 0; i < length; i++) { temp[i] = taskPriorities[initialIndexes[i]]; } this.taskPriorities = temp; } else { - Util.reverseQuickSort(taskTags, 0, taskTags.length - 1); + Util.reverseQuickSort(taskTags, 0, length - 1); } this.taskTags = taskTags; this.isTaskCaseSensitive = isTaskCaseSensitive; Index: model/org/eclipse/jdt/core/JavaCore.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v retrieving revision 1.649 diff -u -r1.649 JavaCore.java --- model/org/eclipse/jdt/core/JavaCore.java 2 Mar 2010 06:46:01 -0000 1.649 +++ model/org/eclipse/jdt/core/JavaCore.java 8 Apr 2010 01:24:32 -0000 @@ -1336,7 +1336,9 @@ * Compiler option ID: Defining the Automatic Task Priorities. *

In parallel with the Automatic Task Tags, this list defines the priorities (high, normal or low) * of the task markers issued by the compiler. - * If the default is specified, the priority of each task marker is "NORMAL". + * If the default is specified, the priority of each task marker is "NORMAL".

+ *

Task Priorities and task tags must have the same length. If task priorities are set, then task tags should also + * be set.

*
*
Option id:
"org.eclipse.jdt.core.compiler.taskPriorities"
*
Possible values:
{ "<priority>[,<priority>]*" } where <priority> is one of "HIGH", "NORMAL" or "LOW"
@@ -1344,6 +1346,7 @@ *
* @since 2.1 * @category CompilerOptionID + * @see #COMPILER_TASK_TAGS */ public static final String COMPILER_TASK_PRIORITIES = PLUGIN_ID + ".compiler.taskPriorities"; //$NON-NLS-1$ /** @@ -1351,15 +1354,17 @@ *

When the tag list is not empty, the compiler will issue a task marker whenever it encounters * one of the corresponding tags inside any comment in Java source code. *

Generated task messages will start with the tag, and range until the next line separator, - * comment ending, or tag. + * comment ending, or tag.

*

When a given line of code bears multiple tags, each tag will be reported separately. * Moreover, a tag immediately followed by another tag will be reported using the contents of the - * next non-empty tag of the line, if any. + * next non-empty tag of the line, if any.

*

Note that tasks messages are trimmed. If a tag is starting with a letter or digit, then it cannot be leaded by * another letter or digit to be recognized ("fooToDo" will not be recognized as a task for tag "ToDo", but "foo#ToDo" * will be detected for either tag "ToDo" or "#ToDo"). Respectively, a tag ending with a letter or digit cannot be followed * by a letter or digit to be recognized ("ToDofoo" will not be recognized as a task for tag "ToDo", but "ToDo:foo" will - * be detected either for tag "ToDo" or "ToDo:"). + * be detected either for tag "ToDo" or "ToDo:").

+ *

Task Priorities and task tags must have the same length. If task tags are set, then task priorities should also + * be set.

*
*
Option id:
"org.eclipse.jdt.core.compiler.taskTags"
*
Possible values:
{ "<tag>[,<tag>]*" } where <tag> is a String without any wild-card or leading/trailing spaces
@@ -1367,6 +1372,7 @@ *
* @since 2.1 * @category CompilerOptionID + * @see #COMPILER_TASK_PRIORITIES */ public static final String COMPILER_TASK_TAGS = PLUGIN_ID + ".compiler.taskTags"; //$NON-NLS-1$ /** Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v retrieving revision 1.446 diff -u -r1.446 JavaModelManager.java --- model/org/eclipse/jdt/internal/core/JavaModelManager.java 29 Mar 2010 05:33:50 -0000 1.446 +++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 8 Apr 2010 01:24:34 -0000 @@ -2061,6 +2061,7 @@ // backward compatibility addDeprecatedOptions(options); + Util.fixTaskTags(options); // store built map in cache this.optionsCache = new Hashtable(options); Index: model/org/eclipse/jdt/internal/core/JavaProject.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java,v retrieving revision 1.430 diff -u -r1.430 JavaProject.java --- model/org/eclipse/jdt/internal/core/JavaProject.java 4 Mar 2010 10:11:50 -0000 1.430 +++ model/org/eclipse/jdt/internal/core/JavaProject.java 8 Apr 2010 01:24:35 -0000 @@ -1674,8 +1674,10 @@ options.put(propertyName, propertyValue.trim()); } } + Util.fixTaskTags(options); return options; } + Util.fixTaskTags(projectOptions); return projectOptions; } Index: model/org/eclipse/jdt/internal/core/util/Util.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java,v retrieving revision 1.141 diff -u -r1.141 Util.java --- model/org/eclipse/jdt/internal/core/util/Util.java 12 Feb 2010 18:23:23 -0000 1.141 +++ model/org/eclipse/jdt/internal/core/util/Util.java 8 Apr 2010 01:24:36 -0000 @@ -112,6 +112,7 @@ private static final char[] VOID = "void".toCharArray(); //$NON-NLS-1$ private static final char[] INIT = "".toCharArray(); //$NON-NLS-1$ + private static final String TASK_PRIORITIES_PROBLEM = "TASK_PRIORITIES_PB"; //$NON-NLS-1$ private static List fgRepeatedMessages= new ArrayList(5); private Util() { @@ -1825,6 +1826,17 @@ log(e); } + public static void logRepeatedMessage(String key, int statusErrorID, String message) { + if (key == null) { + throw new IllegalArgumentException("key cannot be null"); //$NON-NLS-1$ + } + if (fgRepeatedMessages.contains(key)) { + return; + } + fgRepeatedMessages.add(key); + log(statusErrorID, message); + } + /* * Add a log entry */ @@ -3571,4 +3583,42 @@ return start; } + /* + * This method adjusts the task tags and task priorities so that they have the same size + */ + public static void fixTaskTags(Map defaultOptionsMap) { + Object taskTagsValue = defaultOptionsMap.get(JavaCore.COMPILER_TASK_TAGS); + char[][] taskTags = null; + if (taskTagsValue instanceof String) { + taskTags = CharOperation.splitAndTrimOn(',', ((String) taskTagsValue).toCharArray()); + } + Object taskPrioritiesValue = defaultOptionsMap.get(JavaCore.COMPILER_TASK_PRIORITIES); + char[][] taskPriorities = null; + if (taskPrioritiesValue instanceof String) { + taskPriorities = CharOperation.splitAndTrimOn(',', ((String) taskPrioritiesValue).toCharArray()); + } + if (taskPriorities == null) { + if (taskTags != null) { + Util.logRepeatedMessage(TASK_PRIORITIES_PROBLEM, IStatus.ERROR, "Inconsistent values for taskTags (not null) and task priorities (null)"); //$NON-NLS-1$ + defaultOptionsMap.remove(JavaCore.COMPILER_TASK_TAGS); + return; + } + } else if (taskTags == null) { + Util.logRepeatedMessage(TASK_PRIORITIES_PROBLEM, IStatus.ERROR, "Inconsistent values for taskTags (null) and task priorities (not null)"); //$NON-NLS-1$ + defaultOptionsMap.remove(JavaCore.COMPILER_TASK_PRIORITIES); + return; + } + int taskTagsLength = taskTags.length; + int taskPrioritiesLength = taskPriorities.length; + if (taskTagsLength != taskPrioritiesLength) { + Util.logRepeatedMessage(TASK_PRIORITIES_PROBLEM, IStatus.ERROR, "Inconsistent values for taskTags and task priorities : length is different"); //$NON-NLS-1$ + if (taskTagsLength > taskPrioritiesLength) { + System.arraycopy(taskTags, 0, (taskTags = new char[taskPrioritiesLength][]), 0, taskPrioritiesLength); + defaultOptionsMap.put(JavaCore.COMPILER_TASK_TAGS, new String(CharOperation.concatWith(taskTags,','))); + } else { + System.arraycopy(taskPriorities, 0, (taskPriorities = new char[taskTagsLength][]), 0, taskTagsLength); + defaultOptionsMap.put(JavaCore.COMPILER_TASK_PRIORITIES, new String(CharOperation.concatWith(taskPriorities,','))); + } + } + } }