*** empty log message ***
diff --git a/buildnotes_jdt-core.html b/buildnotes_jdt-core.html
index 3b49060..0f8a040 100644
--- a/buildnotes_jdt-core.html
+++ b/buildnotes_jdt-core.html
@@ -30,7 +30,9 @@
 </ul>
 
 <h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=15418">15418</a>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=15416">15416</a>
+Classpath container - need to set value even if not referenced
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=15418">15418</a>
 Classpath container - may get the init-in-progress value back
 <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=15334">15334</a>
 ast: Message should have length 
diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java b/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
index 03cddd9..2c6eee4 100644
--- a/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
+++ b/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
@@ -148,7 +148,7 @@
 				DefaultErrorHandlingPolicies.proceedWithAllProblems(),

 				compilerOptions,

 				new DefaultProblemFactory(Locale.getDefault()) {

-					public void record(IProblem problem, CompilationResult unitResult) {

+					public void record(IProblem problem, CompilationResult unitResult, ReferenceContext referenceContext) {

 						if (problem.isError() && (problem.getID() & IProblem.Syntax) != 0) {

 							CompletionEngine.this.requestor.acceptError(problem);

 						}

diff --git a/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java b/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
index 60da0fb..6d65cae 100644
--- a/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
+++ b/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java
@@ -78,8 +78,8 @@
 				DefaultErrorHandlingPolicies.proceedWithAllProblems(),

 				options,

 				new DefaultProblemFactory(Locale.getDefault())) {

-			public void record(IProblem problem, CompilationResult unitResult) {

-				unitResult.record(problem);

+			public void record(IProblem problem, CompilationResult unitResult, ReferenceContext referenceContext) {

+				unitResult.record(problem, referenceContext);

 				SelectionEngine.this.requestor.acceptError(problem);

 			}

 		};

diff --git a/compiler/org/eclipse/jdt/internal/compiler/CompilationResult.java b/compiler/org/eclipse/jdt/internal/compiler/CompilationResult.java
index b45a463..75e84d3 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/CompilationResult.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/CompilationResult.java
@@ -26,7 +26,10 @@
  */

 

 import org.eclipse.jdt.core.compiler.*;

+import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;

 import org.eclipse.jdt.internal.compiler.env.*;

+import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;

+import org.eclipse.jdt.internal.compiler.lookup.MethodScope;

 

 import java.util.*;

 

@@ -34,7 +37,10 @@
 	public IProblem problems[];

 	public int problemCount;

 	public ICompilationUnit compilationUnit;

-

+	private Map problemsMap;

+	private Map firstErrorsMap;

+	private HashSet duplicateProblems;

+	

 	public char[][][] qualifiedReferences;

 	public char[][] simpleNameReferences;

 

@@ -65,6 +71,38 @@
 	this.totalUnitsKnown = totalUnitsKnown;

 

 }

+private int computePriority(IProblem problem){

+

+	final int P_STATIC = 1000;

+	final int P_OUTSIDE_METHOD = 3000;

+	final int P_FIRST_ERROR = 1000;

+	final int P_ERROR = 10000;

+	

+	int priority = 1000 - problem.getSourceLineNumber(); // early problems first

+	if (priority < 0) priority = 0;

+	

+	if (problem.isError()){

+		priority += P_ERROR;

+	}

+	ReferenceContext context = (ReferenceContext) problemsMap.get(problem);

+	if (context != null){

+		if (context instanceof AbstractMethodDeclaration){

+			AbstractMethodDeclaration method = (AbstractMethodDeclaration) context;

+			if (method.isStatic()) {

+				priority += P_STATIC;

+			}

+		} else {

+		priority += P_OUTSIDE_METHOD;

+		}

+	} else {

+		priority += P_OUTSIDE_METHOD;

+	}

+	if (firstErrorsMap.containsKey(problem)){

+		priority += P_FIRST_ERROR;

+	}

+		

+	return priority;

+}

 public ClassFile[] getClassFiles() {

 	Enumeration enum = compiledTypes.elements();

 	ClassFile[] classFiles = new ClassFile[compiledTypes.size()];

@@ -95,18 +133,26 @@
  * problems.

  */

 public IProblem[] getProblems() {

-

+	

 	// Re-adjust the size of the problems if necessary.

 	if (problems != null) {

-		if (problemCount != problems.length) {

+

+		if (this.problemCount != problems.length) {

 			System.arraycopy(problems, 0, (problems = new IProblem[problemCount]), 0, problemCount);

 		}

-

+/*				 

+		if (this.problemCount > Compiler.MaxProblemPerUnit){

+			quickPrioritize(problems, 0, problemCount - 1);

+			this.problemCount = Compiler.MaxProblemPerUnit;

+			System.arraycopy(problems, 0, (problems = new IProblem[problemCount]), 0, problemCount);

+		}

+*/

 		// Sort problems per source positions.

 		quicksort(problems, 0, problems.length-1);

 	}

 	return problems;

 }

+

 public boolean hasErrors() {

 	if (problems != null)

 		for (int i = 0; i < problemCount; i++) {

@@ -126,6 +172,7 @@
 		}

 	return false;

 }

+

 private static void quicksort(IProblem arr[], int left, int right) {

 	int i, last, pos;

 

@@ -149,13 +196,38 @@
 	quicksort(arr, left, last - 1);

 	quicksort(arr, last + 1, right);

 }

+

+private void quickPrioritize(IProblem arr[], int left, int right) {

+	int i, last, prio;

+

+	if (left >= right) {

+		/* do nothing if array contains fewer than two */

+		return;

+		/* two elements */

+	}

+

+	swap(arr, left, (left + right) / 2);

+	last = left;

+	prio = computePriority(arr[left]);

+

+	for (i = left + 1; i <= right; i++) {

+		if (computePriority(arr[i]) > prio) {

+			swap(arr, ++last, i);

+		}

+	}

+

+	swap(arr, left, last);

+	quickPrioritize(arr, left, last - 1);

+	quickPrioritize(arr, last + 1, right);

+}

+

 /**

  * For now, remember the compiled type using its compound name.

  */

 public void record(char[] typeName, ClassFile classFile) {

 	compiledTypes.put(typeName, classFile);

 }

-public void record(IProblem newProblem) {

+public void record(IProblem newProblem, ReferenceContext referenceContext) {

 	if (problemCount == 0) {

 		problems = new IProblem[5];

 	} else {

@@ -163,6 +235,12 @@
 			System.arraycopy(problems, 0, (problems = new IProblem[problemCount * 2]), 0, problemCount);

 	};

 	problems[problemCount++] = newProblem;

+	if (referenceContext != null){

+		if (problemsMap == null) problemsMap = new Hashtable(5);

+		if (firstErrorsMap == null) firstErrorsMap = new Hashtable(5);

+		if (newProblem.isError() && !referenceContext.hasErrors()) firstErrorsMap.put(newProblem, newProblem);

+		problemsMap.put(newProblem, referenceContext);

+	}

 }

 private static void swap(IProblem arr[], int i, int j) {

 	IProblem tmp;

@@ -172,6 +250,7 @@
 }

 CompilationResult tagAsAccepted(){

 	this.hasBeenAccepted = true;

+	this.problemsMap = null; // flush

 	return this;

 }

 }

diff --git a/compiler/org/eclipse/jdt/internal/compiler/Compiler.java b/compiler/org/eclipse/jdt/internal/compiler/Compiler.java
index b821640..1bc33de 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/Compiler.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/Compiler.java
@@ -22,6 +22,8 @@
 	public CompilerOptions options;

 	public ProblemReporter problemReporter;

 

+	public static int MaxProblemPerUnit = 50;

+	

 	// management of unit to be processed

 	//public CompilationUnitResult currentCompilationUnitResult;

 	CompilationUnitDeclaration[] unitsToProcess;

@@ -420,11 +422,13 @@
 							Util.bind("compilation.internalError" ) //$NON-NLS-1$

 								+ "\n"  //$NON-NLS-1$

 								+ buffer.toString()},

-						Error,

-			// severity

-			0, // source start

-			0, // source end

-			0)); // line number		

+						Error, // severity

+						0, // source start

+						0, // source end

+						0, // line number		

+						unit,

+						result),

+					unit);

 

 			/* hand back the compilation result */

 			if (!result.hasBeenAccepted) {

@@ -469,11 +473,13 @@
 							result.getFileName(),

 							abortException.problemId,

 							abortException.problemArguments,

-							Error,

-				// severity

-				0, // source start

-				0, // source end

-				0)); // line number

+							Error, // severity

+							0, // source start

+							0, // source end

+							0, // line number		

+							unit,

+							result),

+						unit);				

 			} else {

 				/* distant internal exception which could not be reported back there */

 				if (abortException.exception != null) {

diff --git a/compiler/org/eclipse/jdt/internal/compiler/SourceElementParser.java b/compiler/org/eclipse/jdt/internal/compiler/SourceElementParser.java
index 123b66b..3befd42 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/SourceElementParser.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/SourceElementParser.java
@@ -81,8 +81,8 @@
 		DefaultErrorHandlingPolicies.exitAfterAllProblems(),

 		options, 

 		problemFactory) {

-		public void record(IProblem problem, CompilationResult unitResult) {

-			unitResult.record(problem);

+		public void record(IProblem problem, CompilationResult unitResult, ReferenceContext referenceContext) {

+			unitResult.record(problem, referenceContext);

 			requestor.acceptProblem(problem);

 		}

 	},

diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java b/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
index 3c77f28..766cd2d 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
@@ -251,6 +251,10 @@
 		}

 	}

 

+	public boolean hasErrors() {

+		return this.ignoreFurtherInvestigation;

+	}

+

 	public boolean isAbstract() {

 

 		if (binding != null)

diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java b/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java
index cbfce40..629be47 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java
@@ -172,6 +172,10 @@
 		return (currentPackage == null) && (imports == null) && (types == null);

 	}

 

+	public boolean hasErrors() {

+		return this.ignoreFurtherInvestigation;

+	}

+

 	/*

 	 * Force inner local types to update their innerclass emulation

 	 */

@@ -218,7 +222,6 @@
 	}

 

 	public void tagAsHavingErrors() {

-

 		ignoreFurtherInvestigation = true;

 	}

 

diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java b/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
index eb6af5d..9698210 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
@@ -799,6 +799,10 @@
 		return (modifiers & AccInterface) != 0;

 	}

 

+	public boolean hasErrors() {

+		return this.ignoreFurtherInvestigation;

+	}

+

 	/**

 	 * A <clinit> will be requested as soon as static fields or assertions are present. It will be eliminated during

 	 * classfile creation if no bytecode was actually produced based on some optimizations/compiler settings.

diff --git a/compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java b/compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java
index 36b21cd..aae2b6c 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java
@@ -13,7 +13,8 @@
 import org.eclipse.jdt.internal.compiler.CompilationResult;

 

 public interface ReferenceContext {

-public void abort(int abortLevel);

-public CompilationResult compilationResult();

-void tagAsHavingErrors();

+	void abort(int abortLevel);

+	CompilationResult compilationResult();

+	void tagAsHavingErrors();

+	boolean hasErrors();

 }

diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
index 215f9a6..6304051 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
@@ -329,7 +329,7 @@
 	

 	try {

 		int failed = 0;

-		for (int f = fields.length; --f >= 0;) {

+		for (int f = 0, max = fields.length; f < max; f++) {

 			if (resolveTypeFor(fields[f]) == null) {

 				fields[f] = null;

 				failed++;

@@ -659,7 +659,7 @@
 			return methods;

 	

 		int failed = 0;

-		for (int m = methods.length; --m >= 0;) {

+		for (int m = 0, max = methods.length; m < max; m++) {

 			if (resolveTypesFor(methods[m]) == null) {

 				methods[m] = null; // unable to resolve parameters

 				failed++;

@@ -744,6 +744,7 @@
 		field.type = fieldDecls[f].getTypeBinding(scope);

 		if (!field.type.isValidBinding()) {

 			scope.problemReporter().fieldTypeProblem(this, fieldDecls[f], field.type);

+			//scope.problemReporter().invalidType(fieldDecls[f].type, field.type);

 			fieldDecls[f].binding = null;

 			return null;

 		}

@@ -777,6 +778,7 @@
 			resolvedExceptionType = (ReferenceBinding) exceptionTypes[i].getTypeBinding(scope);

 			if (!resolvedExceptionType.isValidBinding()) {

 				methodDecl.scope.problemReporter().exceptionTypeProblem(this, methodDecl, exceptionTypes[i], resolvedExceptionType);

+				//methodDecl.scope.problemReporter().invalidType(exceptionTypes[i], resolvedExceptionType);

 				continue;

 			}

 			if (throwable != resolvedExceptionType && !throwable.isSuperclassOf(resolvedExceptionType)) {

@@ -799,6 +801,7 @@
 			method.parameters[i] = arg.type.getTypeBinding(scope);

 			if (!method.parameters[i].isValidBinding()) {

 				methodDecl.scope.problemReporter().argumentTypeProblem(this, methodDecl, arg, method.parameters[i]);

+				//methodDecl.scope.problemReporter().invalidType(arg, method.parameters[i]);

 				foundArgProblem = true;

 			} else if (method.parameters[i] == VoidBinding) {

 				methodDecl.scope.problemReporter().argumentTypeCannotBeVoid(this, methodDecl, arg);

@@ -821,6 +824,7 @@
 			method.returnType = returnType.getTypeBinding(scope);

 			if (!method.returnType.isValidBinding()) {

 				methodDecl.scope.problemReporter().returnTypeProblem(this, (MethodDeclaration) methodDecl, method.returnType);

+				//methodDecl.scope.problemReporter().invalidType(returnType, method.returnType);

 				method.returnType = null;

 				foundReturnTypeProblem = true;

 			} else if (method.returnType.isArrayType() && ((ArrayBinding) method.returnType).leafComponentType == VoidBinding) {

diff --git a/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java b/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java
index 04f6e76..4f5dfb2 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java
@@ -49,7 +49,9 @@
 	int severity, 

 	int problemStartPosition, 

 	int problemEndPosition, 

-	int lineNumber) {

+	int lineNumber,

+	ReferenceContext referenceContext,

+	CompilationResult unitResult) {

 

 	return problemFactory.createProblem(

 		fileName, 

@@ -91,12 +93,15 @@
 			problemEndPosition, 

 			problemStartPosition >= 0

 				? searchLineNumber(unitResult.lineSeparatorPositions, problemStartPosition)

-				: 0); 

-

+				: 0,

+			referenceContext,

+			unitResult); 

+	if (problem == null) return; // problem couldn't be created, ignore

+	

 	switch (severity & Error) {

 		case Error :

+			this.record(problem, unitResult, referenceContext);

 			referenceContext.tagAsHavingErrors();

-			this.record(problem, unitResult);

 

 			// should abort ?

 			int abortLevel;

@@ -107,7 +112,7 @@
 			}

 			break;

 		case Warning :

-			this.record(problem, unitResult);

+			this.record(problem, unitResult, referenceContext);

 			break;

 	}

 }

@@ -132,8 +137,8 @@
 		referenceContext,

 		unitResult);

 }

-public void record(IProblem problem, CompilationResult unitResult) {

-	unitResult.record(problem);

+public void record(IProblem problem, CompilationResult unitResult, ReferenceContext referenceContext) {

+	unitResult.record(problem, referenceContext);

 }

 /**

  * Search the line number corresponding to a specific position

diff --git a/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
index 058a3ea..5188414 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
@@ -1565,15 +1565,7 @@
 			superinterfaceRef.sourceStart,

 			superinterfaceRef.sourceEnd);

 }

-public void invalidType(Expression expression, TypeBinding type) {

-	// CODE should be UPDATED according to error coding in the different type binding errors

-	//The different targetted errors should be :

-		//UndefinedType

-		//NotVisibleType

-		//AmbiguousType

-		//InternalTypeNameProvided

-		//InheritedTypeHidesEnclosingName

-

+public void invalidType(AstNode location, TypeBinding type) {

 	int flag = IProblem.UndefinedType; // default

 	switch (type.problemId()) {

 		case NotFound :

@@ -1600,8 +1592,8 @@
 	this.handle(

 		flag,

 		new String[] {new String(type.readableName())},

-		expression.sourceStart,

-		expression.sourceEnd);

+		location.sourceStart,

+		location.sourceEnd);

 }

 public void invalidTypeReference(Expression expression) {

 	this.handle(