R3_2_maintenance - Merge with TARGET_321 branch (overwrite in fact more than merge)
diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF
index 6336f17..6bf6958 100644
--- a/META-INF/MANIFEST.MF
+++ b/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jdt.core; singleton:=true
-Bundle-Version: 3.2.100.qualifier
+Bundle-Version: 3.2.1.qualifier
 Bundle-Activator: org.eclipse.jdt.core.JavaCore
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/batch/org/eclipse/jdt/internal/compiler/batch/Main.java b/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
index 0f22161..35ee8b2 100644
--- a/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
+++ b/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
@@ -28,9 +28,7 @@
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.Date;
-import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Locale;
@@ -581,7 +579,7 @@
 				if (localErrorCount == 0) {
 					this.printlnErr("----------"); //$NON-NLS-1$
 				}
-				this.printlnErr(problem.isError() ?
+				this.printErr(problem.isError() ?
 						Main.bind(
 								"requestor.error", //$NON-NLS-1$
 								Integer.toString(globalErrorCount),
@@ -592,7 +590,7 @@
 										new String(problem.getOriginatingFileName())));
 				try {
 					final String errorReportSource = ((DefaultProblem) problem).errorReportSource(unitSource);
-					if (errorReportSource.length() != 0) this.printlnErr(errorReportSource);
+					this.printlnErr(errorReportSource);
 					this.printlnErr(problem.getMessage());
 				} catch (Exception e) {
 					this.printlnErr(Main.bind(
@@ -958,12 +956,15 @@
 			buffer.append("<"); //$NON-NLS-1$
 			buffer.append(name);
 			if (params != null) {
-				for (Enumeration enumeration = Collections.enumeration(params.keySet()); enumeration.hasMoreElements();) {
+				int length = parameters.size();
+				String[] keys = new String[length];
+				parameters.keySet().toArray(keys);
+				Arrays.sort(keys);
+				for (int i = 0; i < length; i++) {
 					buffer.append(" "); //$NON-NLS-1$
-					String key= (String) enumeration.nextElement();
-					buffer.append(key);
+					buffer.append(keys[i]);
 					buffer.append("=\""); //$NON-NLS-1$
-					buffer.append(getEscaped(String.valueOf(params.get(key))));
+					buffer.append(getEscaped(String.valueOf(params.get(keys[i]))));
 					buffer.append("\""); //$NON-NLS-1$
 				}
 			}
diff --git a/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties b/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
index 18a593c..c81e4ff 100644
--- a/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
+++ b/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
@@ -14,7 +14,7 @@
 #Format: compiler.name = word1 word2 word3
 compiler.name = Eclipse Java Compiler
 #Format: compiler.version = 0.XXX[, other words (don't forget the comma if adding other words)]
-compiler.version = 0.700, 3.3.0 pre-3.3.0 milestone-1
+compiler.version = v_672_R32x, pre-3.2.1 release
 compiler.copyright = Copyright IBM Corp 2000, 2006. All rights reserved.
 
 ### scanning
@@ -46,7 +46,7 @@
 configure.duplicateCompliance = duplicate compliance setting specification: {0}
 configure.duplicateSource = duplicate source compliance setting specification: {0}
 configure.duplicateTarget = duplicate target compliance setting specification: {0}
-configure.source = source level should be comprised in between ''1.3'' and ''1.6'' (or ''6'' or ''6.0''): {0}
+configure.source = source level should be comprised in between ''1.3'' and ''1.6'' (or ''5'', ''5.0'', ''6'' or ''6.0''): {0}
 configure.duplicateOutputPath = duplicate output path specification: {0}
 configure.duplicateBootClasspath = duplicate bootclasspath specification: {0}
 configure.duplicateExtDirs = duplicate extdirs specification: {0}
@@ -55,7 +55,7 @@
 configure.invalidWarningConfiguration = invalid warning configuration: {0}
 configure.invalidWarning = invalid warning: {0}
 configure.invalidWarningOption = invalid warning option: {0}
-configure.targetJDK = target level should be comprised in between ''1.1'' and ''1.6'' (or ''6'' or ''6.0''): {0}
+configure.targetJDK = target level should be comprised in between ''1.1'' and ''1.6'' (or ''5'', ''5.0'', ''6'' or ''6.0''): {0}
 configure.incompatibleTargetForSource = Target level ''{0}'' is incompatible with source level ''{1}''. A target level ''{1}'' or better is required
 configure.incompatibleTargetForGenericSource = Target level ''{0}'' is incompatible with source level ''{1}''. A source level ''1.5'' or better is required
 configure.incompatibleComplianceForSource = Compliance level ''{0}'' is incompatible with source level ''{1}''. A compliance level ''{1}'' or better is required
@@ -141,8 +141,9 @@
 \                       -target 1.5)\n\
 \    -1.6               use 1.6 compliance level (implicit -source 1.6\n\
 \                       -target 1.6)\n\
-\    -source <version>  set source level: 1.3 to 1.6 (or 6 or 6.0)\n\
-\    -target <version>  set classfile target level: 1.1 to 1.6 (or 6 or 6.0)\n\
+\    -source <version>  set source level: 1.3 to 1.6 (or 5, 5.0, 6 or 6.0)\n\
+\    -target <version>  set classfile target level: 1.1 to 1.6 (or 5, 5.0, 6 or\n\
+\                       6.0)\n\
 \ \n\
 \ Warning options:\n\
 \    -deprecation     + deprecation outside deprecated code\n\
diff --git a/buildnotes_jdt-core.html b/buildnotes_jdt-core.html
index 6ba69e8..f0c2868 100644
--- a/buildnotes_jdt-core.html
+++ b/buildnotes_jdt-core.html
@@ -3,14 +3,14 @@
 <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="Author" content="IBM">
-   <title>JDT/Core Release Notes 3.2</title>
+   <title>JDT/Core Release Notes 3.2.x</title>
    <link rel="stylesheet" href="jdt_core_style.css" charset="iso-8859-1" type="text/css">
 </head>
 <body text="#000000" bgcolor="#FFFFFF">
 <table border=0 cellspacing=5 cellpadding=2 width="100%" >
   <tr> 
     <td align="left" width="72%" class="title1">
-      <font size="+3"><b>jdt core - build notes 3.2 stream</b></font>
+      <font size="+3"><b>jdt core - build notes 3.2.x stream</b></font>
     </td>
   </tr>
   <tr><td align="left" width="72%" class="title2"><font size="-2">java development tooling core</font></td></tr>
@@ -20,7 +20,7 @@
 	  <font size="-1">
 	  Here are the build notes for the Eclipse JDT/Core plug-in project 
 	  <a href="http://www.eclipse.org/jdt/core/index.php"><b>org.eclipse.jdt.core</b></a>, 
-	  describing <a href="http://bugs.eclipse.org/bugs" target=new>bug</a> resolution and substantial changes in the <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=R3_2_maintenance"><b>R3_2_maintenance</b></a> branch. 
+	  describing <a href="http://bugs.eclipse.org/bugs" target=new>bug</a> resolution and substantial changes in the <a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=TARGET_321"><b>TARGET_321</b></a> branch. 
 	  <!--
 	  This present document covers all changes since Release 3.0 (also see a summary of <a href="http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.jdt.core/notes/API_changes.html">API changes</a>).
 	  Older changes which occurred up to Release 3.0 can be found in 
@@ -37,6 +37,125 @@
 	</td>
   </tr>
 </table>
+<a name="v_672_R32x"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.2.1 - ?th September 2006
+<br>Project org.eclipse.jdt.core v_672_R32x
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_672_R32x">cvs</a>).
+<h2>What's new in this drop</h2>
+<ul>
+<li>Incremented plug-in version ID to &quot;3.2.1&quot;</li>
+<li>Progressive help message for the batch compiler.<br>
+	The new <tt>-help:warn</tt> option displays details about the various 
+    parameters applicable to the <tt>-warn</tt> option; these details are no
+    more part of the general help message, which is thus more compact.
+    (See also bug 
+    <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=144248">144248</a>.)
+    </li>
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=117302">117302</a>
+Clean build of large project gives unresolved type errors
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=147875">147875</a>
+[1.5][compiler] NPE when initializing annotations of a binary field
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=148523">148523</a>
+[batch] Batch compiler output contains extra linebreak before line position
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=148215">148215</a>
+[search] Exception while searching for declarations of referenced types in binary java elements packaged in a jar
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=145007">145007</a>
+[1.5][javadoc] Generics + Inner Class -&gt; Javadoc &quot;missing @throws&quot; warning
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=147690">147690</a>
+[1.5][compiler] Incompatible serialversionuid when using covariant in Java 1.5
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=147747">147747</a>
+max stack for clinit of enum overestimated
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=142059">142059</a>
+[efs] renaming package fails to update references
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=143013">143013</a>
+SWTException: Failed to execute runnable (...AbortCompilation)
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=147024">147024</a>
+[compiler] Compiler bug when accessing static final attribute in a non-static way
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=143684">143684</a>
+Creating of static imports is unavailable..
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=147736">147736</a>
+ClassCastException in TypeHierarchy
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=91709">91709</a>
+[1.5][model] Quick Fix Error but no Problem Reported
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=147381">147381</a>
+[1.5][compiler] Generics discrepancy between Eclipse compiler and Sun compiler.
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=144573">144573</a>
+compilationParticipant extension point schema incomplete
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=145835">145835</a>
+getJavaClassLibs needs to account for IBM J2SE 1.5
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=147096">147096</a>
+ecj.jar manifest should not use x-friends, but use x-internal=true instead
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=146015">146015</a>
+Some JDT/Core tests results are still VM dependent
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=146324">146324</a>
+Batch builds produce "The type X is already defined" errors
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=146615">146615</a>
+[hierarchy] TypeHierarchyTests is tests order dependent
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=142207">142207</a>
+[batch][options] Source/target level names 5 and 5.0 missing from batch 
+compiler help message
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=146215">146215</a>
+JDT Core tests should not be dependent on HashMap implementation
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=145746">145746</a>
+[1.5][compiler] Enum synthetic methods should be improved
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=145732">145732</a>
+[1.5][compiler] Inconsistent behavior in ECJ code for enum types
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=145516">145516</a>
+Bad performance when compiling a java file with non java content
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=142897">142897</a>
+[1.5][compiler] Compiler cannot resolve type of inner class of a bounded generic type
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=144976">144976</a>
+[hierarchy] NPE in ReferenceBinding
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=145500">145500</a>
+[hierarchy] Superclass could be more resilient
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=144866">144866</a>
+[assist][javadoc] Wrong completion inside @value tag
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=144414">144414</a>
+JDT Compiler fails while standard javac compiler can proceed
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=142772">142772</a>
+[1.5][compiler] Compilation succeeds with static imports that fail with javac
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=144504">144504</a>
+JDT Core model JUnit tests fail when ordering of methods reversed
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=143259">143259</a>
+[1.5][compiler] NullPointerException in ReferenceBinding.binarySearch , Eclipse 3.2RC4
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=144426">144426</a>
+[compiler] Compiler incorrectly reports "assignment to variable has no effect" when it is a duplicate
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=144248">144248</a>
+[batch] Progressive help text
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=141512">141512</a>
+[batch] re-format the help message so as to fit into 80 columns
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=141522">141522</a>
+[compiler][batch] ClassFile#buildAllDirectoriesInto should protect itself 
+against concurrent directory creation
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=141330">141330</a>
+[1.5][compiler] Suspicious error message for type mismatch
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=141252">141252</a>
+[1.6]][compiler] ClassFormatError: Illegal class name "" in class file
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=141810">141810</a>
+[1.5][compiler] Enum switch tables incorrectly generated by the compiler
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=141327">141327</a>
+StackFrame and VerificationTypeInfo must call super.clone() in their clone() method
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=140476">140476</a>
+JDOM: IDOMType.setSuperInterfaces(new String [0]) fails to remove existing implements clause
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=132430">132430</a>
+[1.5][javadoc] Unwanted missing tag warning for overridden method with parameter containing type variable
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=130752">130752</a>
+[comments] first BlockComment parsed as LineComment
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=95152">95152</a>
+[search] F3 can't find synthetic constructor
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=140156">140156</a>
+[1.5][search] Invalid method handle with parameterized parameters when no source is attached
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=123679">123679</a>
+[search] missing icon or bad hit in search results
+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=141550">141550</a>
+Enable now passing tests
+
 <a name="v_671"></a>
 <p><hr><h1>
 Eclipse Platform Build Notes<br>
@@ -73,9 +192,7 @@
 <h2>What's new in this drop</h2>
 
 <h3>Problem Reports Fixed</h3>
-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=144504">144504</a>
-JDT Core model JUnit tests fail when ordering of methods reversed
-<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=143718">143718</a>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=143718">143718</a>
 [1.6][compiler] ClassFormatError : wrong stack map frame is used
 
 <a name="v_668"></a>
@@ -3362,4 +3479,4 @@
         alt="Valid HTML 4.01 Transitional" height="31" width="88"></a>
   </p>
 </body>
-</html>
+</html>
\ No newline at end of file
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java b/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
index 9a1548e..6f399b6 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
@@ -5963,4 +5963,4 @@
 		methodCountOffset = contentsOffset;
 		contentsOffset += 2;
 	}
-}
\ No newline at end of file
+}
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java b/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
index 426f136..1dd21be 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
@@ -121,18 +121,12 @@
 			codeStream.recordPositionsFrom(pc, this.sourceStart);
 			return;
 		}
-		Constant cst = condition.constant;
-		Constant condCst = condition.optimizedBooleanConstant();
-		boolean needTruePart =
-			!(((cst != Constant.NotAConstant) && (cst.booleanValue() == false))
-				|| ((condCst != Constant.NotAConstant) && (condCst.booleanValue() == false)));
-		boolean needFalsePart =
-			!(((cst != Constant.NotAConstant) && (cst.booleanValue() == true))
-				|| ((condCst != Constant.NotAConstant) && (condCst.booleanValue() == true)));
+		Constant cst = condition.optimizedBooleanConstant();
+		boolean needTruePart = !(cst != Constant.NotAConstant && cst.booleanValue() == false);
+		boolean needFalsePart = 	!(cst != Constant.NotAConstant && cst.booleanValue() == true);
 		endifLabel = new BranchLabel(codeStream);
 
 		// Generate code for the condition
-		boolean needConditionValue = (cst == Constant.NotAConstant) && (condCst == Constant.NotAConstant);
 		falseLabel = new BranchLabel(codeStream);
 		falseLabel.tagBits |= BranchLabel.USED;
 		condition.generateOptimizedBoolean(
@@ -140,7 +134,7 @@
 			codeStream,
 			null,
 			falseLabel,
-			needConditionValue);
+			cst == Constant.NotAConstant);
 
 		if (trueInitStateIndex != -1) {
 			codeStream.removeNotDefinitelyAssignedVariables(
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java b/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
index b324874..f8c3c29 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
@@ -621,9 +621,11 @@
 		// a label valued to nil means: by default we fall through the case... 
 		// both nil means we leave the value on the stack
 
-		if ((constant != Constant.NotAConstant) && (constant.typeID() == T_boolean)) {
+		Constant cst = this.optimizedBooleanConstant();
+		generateCode(currentScope, codeStream, valueRequired && cst == Constant.NotAConstant);
+		if ((cst != Constant.NotAConstant) && (cst.typeID() == T_boolean)) {
 			int pc = codeStream.position;
-			if (constant.booleanValue() == true) {
+			if (cst.booleanValue() == true) {
 				// constant == true
 				if (valueRequired) {
 					if (falseLabel == null) {
@@ -646,7 +648,6 @@
 			codeStream.recordPositionsFrom(pc, this.sourceStart);
 			return;
 		}
-		generateCode(currentScope, codeStream, valueRequired);
 		// branching
 		int position = codeStream.position;
 		if (valueRequired) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java b/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java
index 117fe2f..1f6f11f 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java
@@ -142,7 +142,6 @@
 			!((cst != Constant.NotAConstant && cst.booleanValue() == true)
 				|| this.elseStatement == null
 				|| this.elseStatement.isEmptyBlock());
-
 		if (hasThenPart) {
 			BranchLabel falseLabel = null;
 			// generate boolean condition
@@ -151,7 +150,7 @@
 				codeStream,
 				null,
 				hasElsePart ? (falseLabel = new BranchLabel(codeStream)) : endifLabel,
-				true);
+				true/*cst == Constant.NotAConstant*/);
 			// May loose some local variable initializations : affecting the local variable attributes
 			if (thenInitStateIndex != -1) {
 				codeStream.removeNotDefinitelyAssignedVariables(currentScope, thenInitStateIndex);
@@ -186,7 +185,7 @@
 				codeStream,
 				endifLabel,
 				null,
-				true);
+				true/*cst == Constant.NotAConstant*/);
 			// generate else statement
 			// May loose some local variable initializations : affecting the local variable attributes
 			if (elseInitStateIndex != -1) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java b/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java
index 1db56da..f1c9340 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java
@@ -522,6 +522,7 @@
 			// Look for undocumented thrown exception
 			for (int i = 0; i < boundExceptionLength; i++) {
 				ReferenceBinding exceptionBinding = md.binding.thrownExceptions[i];
+				if (exceptionBinding != null) exceptionBinding = (ReferenceBinding) exceptionBinding.erasure();
 				boolean found = false;
 				for (int j = 0; j < maxRef && !found; j++) {
 					if (typeReferences[j] != null) {
diff --git a/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java b/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
index 825bafd..5c9ef7c 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
@@ -4117,28 +4117,34 @@
 			methodBinding.selector,
 			methodBinding.signature(),
 			false));
-	if (methodBinding.isConstructor() && methodBinding.declaringClass.isNestedType()) {
-		// enclosing instances
-		TypeBinding[] syntheticArgumentTypes = methodBinding.declaringClass.syntheticEnclosingInstanceTypes();
-		if (syntheticArgumentTypes != null) {
-			for (int i = 0, max = syntheticArgumentTypes.length; i < max; i++) {
-				if (((id = syntheticArgumentTypes[i].id) == TypeIds.T_double) || (id == TypeIds.T_long)) {
-					argCount += 2;
-				} else {
-					argCount++;
+	if (methodBinding.isConstructor()) {
+		final ReferenceBinding declaringClass = methodBinding.declaringClass;
+		if (declaringClass.isNestedType()) {
+			// enclosing instances
+			TypeBinding[] syntheticArgumentTypes = declaringClass.syntheticEnclosingInstanceTypes();
+			if (syntheticArgumentTypes != null) {
+				for (int i = 0, max = syntheticArgumentTypes.length; i < max; i++) {
+					if (((id = syntheticArgumentTypes[i].id) == TypeIds.T_double) || (id == TypeIds.T_long)) {
+						argCount += 2;
+					} else {
+						argCount++;
+					}
 				}
 			}
-		}
-		// outer local variables
-		SyntheticArgumentBinding[] syntheticArguments = methodBinding.declaringClass.syntheticOuterLocalVariables();
-		if (syntheticArguments != null) {
-			for (int i = 0, max = syntheticArguments.length; i < max; i++) {
-				if (((id = syntheticArguments[i].type.id) == TypeIds.T_double) || (id == TypeIds.T_long)) {
-					argCount += 2;
-				} else {
-					argCount++;
+			// outer local variables
+			SyntheticArgumentBinding[] syntheticArguments = declaringClass.syntheticOuterLocalVariables();
+			if (syntheticArguments != null) {
+				for (int i = 0, max = syntheticArguments.length; i < max; i++) {
+					if (((id = syntheticArguments[i].type.id) == TypeIds.T_double) || (id == TypeIds.T_long)) {
+						argCount += 2;
+					} else {
+						argCount++;
+					}
 				}
 			}
+		} else if (declaringClass.isEnum()) {
+			// adding String and int
+			argCount += 2;
 		}
 	}
 	for (int i = methodBinding.parameters.length - 1; i >= 0; i--)
@@ -6356,4 +6362,4 @@
 		this.writeSignedWord(forward, offset);
 	}	
 }
-}
\ No newline at end of file
+}
diff --git a/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java b/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java
index 61ade4a..e0bfddc 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java
@@ -1197,17 +1197,20 @@
 	super.invokespecial(methodBinding);
 	int argCount = 0;
 	if (methodBinding.isConstructor()) {
-		if (methodBinding.declaringClass.isNestedType()) {
+		final ReferenceBinding declaringClass = methodBinding.declaringClass;
+		if (declaringClass.isNestedType()) {
 			// enclosing instances
-			TypeBinding[] syntheticArgumentTypes = methodBinding.declaringClass.syntheticEnclosingInstanceTypes();
+			TypeBinding[] syntheticArgumentTypes = declaringClass.syntheticEnclosingInstanceTypes();
 			if (syntheticArgumentTypes != null) {
 				argCount += syntheticArgumentTypes.length;
 			}
 			// outer local variables
-			SyntheticArgumentBinding[] syntheticArguments = methodBinding.declaringClass.syntheticOuterLocalVariables();
+			SyntheticArgumentBinding[] syntheticArguments = declaringClass.syntheticOuterLocalVariables();
 			if (syntheticArguments != null) {
 				argCount += syntheticArguments.length;
 			}
+		} else if (declaringClass.isEnum()) {
+			argCount += 2;
 		}
 		argCount += methodBinding.parameters.length;
 		this.currentFrame.numberOfStackItems -= argCount;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
index a2a14c9..f401bf1 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
@@ -327,6 +327,7 @@
 			boolean use15specifics = sourceLevel >= ClassFileConstants.JDK1_5;
 			boolean isViewedAsDeprecated = isViewedAsDeprecated();
 			boolean hasRestrictedAccess = hasRestrictedAccess();
+			int firstAnnotatedFieldIndex = -1;
 			for (int i = 0; i < size; i++) {
 				IBinaryField binaryField = iFields[i];
 				char[] fieldSignature = use15specifics ? binaryField.getGenericSignature() : null;
@@ -340,8 +341,11 @@
 						binaryField.getModifiers() | ExtraCompilerModifiers.AccUnresolved, 
 						this, 
 						binaryField.getConstant());
-				if (this.environment.globalOptions.storeAnnotations)
-					field.setAnnotations(createAnnotations(binaryField.getAnnotations(), this.environment));
+				if (firstAnnotatedFieldIndex < 0
+						&& this.environment.globalOptions.storeAnnotations 
+						&& binaryField.getAnnotations() != null) {
+					firstAnnotatedFieldIndex = i;
+				}
 				field.id = i; // ordinal
 				if (use15specifics)
 					field.tagBits |= binaryField.getTagBits();
@@ -353,6 +357,12 @@
 					field.modifiers |= ExtraCompilerModifiers.AccGenericSignature;
 				this.fields[i] = field;
 			}
+			// second pass for reifying annotations, since may refer to fields being constructed (147875)
+			if (firstAnnotatedFieldIndex >= 0) {
+				for (int i = firstAnnotatedFieldIndex; i <size; i++) {
+					this.fields[i].setAnnotations(createAnnotations(iFields[i].getAnnotations(), this.environment));
+				}
+			}
 		}
 	}
 }
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
index ab14703..d7dc58b 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
@@ -108,9 +108,10 @@
 		TypeDeclaration typeDecl = types[i];
 		ReferenceBinding typeBinding = fPackage.getType0(typeDecl.name);
 		recordSimpleReference(typeDecl.name); // needed to detect collision cases
-		if (typeBinding != null && !(typeBinding instanceof UnresolvedReferenceBinding)) {
-			// if a type exists, it must be a valid type - cannot be a NotFound problem type
-			// unless its an unresolved type which is now being defined
+		if (typeBinding != null && typeBinding.isValidBinding() && !(typeBinding instanceof UnresolvedReferenceBinding)) {
+			// if a type exists, check that its a valid type
+			// it can be a NotFound problem type if its a secondary type referenced before its primary type found in additional units
+			// and it can be an unresolved type which is now being defined
 			problemReporter().duplicateTypes(referenceContext, typeDecl);
 			continue nextType;
 		}
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java
index a967909..d36709c 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java
@@ -530,9 +530,6 @@
 		&& super.isInterfaceMethodImplemented(inheritedMethod, existingMethod, superType);
 }
 SimpleSet findSuperinterfaceCollisions(ReferenceBinding superclass, ReferenceBinding[] superInterfaces) {
-	if (!this.type.isHierarchyInconsistent())
-		return null; // hasErasedCandidatesCollisions() did NOT mark the type has inconsistent
-
 	ReferenceBinding[] interfacesToVisit = null;
 	int nextPosition = 0;
 	ReferenceBinding[] itsInterfaces = superInterfaces;
@@ -541,8 +538,10 @@
 		interfacesToVisit = itsInterfaces;
 	}
 
+	boolean isInconsistent = this.type.isHierarchyInconsistent();
 	ReferenceBinding superType = superclass;
 	while (superType != null && superType.isValidBinding()) {
+		isInconsistent |= superType.isHierarchyInconsistent();
 		if ((itsInterfaces = superType.superInterfaces()) != Binding.NO_SUPERINTERFACES) {
 			if (interfacesToVisit == null) {
 				interfacesToVisit = itsInterfaces;
@@ -565,6 +564,7 @@
 	for (int i = 0; i < nextPosition; i++) {
 		superType = interfacesToVisit[i];
 		if (superType.isValidBinding()) {
+			isInconsistent |= superType.isHierarchyInconsistent();
 			if ((itsInterfaces = superType.superInterfaces()) != Binding.NO_SUPERINTERFACES) {
 				int itsLength = itsInterfaces.length;
 				if (nextPosition + itsLength >= interfacesToVisit.length)
@@ -579,6 +579,7 @@
 		}
 	}
 
+	if (!isInconsistent) return null; // hierarchy is consistent so no collisions are possible
 	SimpleSet copy = null;
 	for (int i = 0; i < nextPosition; i++) {
 		ReferenceBinding current = interfacesToVisit[i];
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java
index 7bb65b9..bf33846 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java
@@ -216,7 +216,7 @@
 		method.thrownExceptions = originalMethod.thrownExceptions;
 		ReferenceBinding genericClassType = scope.getJavaLangClass();
 		LookupEnvironment environment = scope.environment();
-		TypeBinding rawType = environment.convertToRawType(receiverType);
+		TypeBinding rawType = environment.convertToRawType(receiverType.erasure());
 		method.returnType = environment.createParameterizedType(
 			genericClassType,
 			new TypeBinding[] {  environment.createWildcard(genericClassType, 0, rawType, null /*no extra bound*/, Wildcard.EXTENDS) },
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
index ed60133..6bb1d12 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
@@ -1215,4 +1215,4 @@
 MethodBinding[] unResolvedMethods() { // for the MethodVerifier so it doesn't resolve types
 	return methods();
 }
-}
\ No newline at end of file
+}
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java
index 304c9b0..744c748 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java
@@ -223,7 +223,8 @@
 	    this.declaringClass = declaringClass;
 	    this.selector = overridenMethodToBridge.selector;
 	    // amongst other, clear the AccGenericSignature, so as to ensure no remains of original inherited persist (101794)
-	    this.modifiers = (overridenMethodToBridge.modifiers | ClassFileConstants.AccBridge | ClassFileConstants.AccSynthetic) & ~(ClassFileConstants.AccAbstract | ClassFileConstants.AccNative | ExtraCompilerModifiers.AccGenericSignature);
+	    // also use the modifiers from the target method, as opposed to inherited one (147690)
+	    this.modifiers = (targetMethod.modifiers | ClassFileConstants.AccBridge | ClassFileConstants.AccSynthetic) & ~(ClassFileConstants.AccAbstract | ClassFileConstants.AccNative | ExtraCompilerModifiers.AccGenericSignature);
 		this.tagBits |= TagBits.AnnotationResolved;
 	    this.returnType = overridenMethodToBridge.returnType;
 	    this.parameters = overridenMethodToBridge.parameters;
diff --git a/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java b/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java
index fb3821e..d27d411 100644
--- a/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java
+++ b/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java
@@ -112,8 +112,7 @@
  *   A = F   corresponds to:      F.collectSubstitutes(..., A, ..., 0)
  *   A >> F   corresponds to:   F.collectSubstitutes(..., A, ..., 2)
  */
-public void collectSubstitutes(Scope scope, TypeBinding actualType,
-		Map substitutes, int constraint) {
+public void collectSubstitutes(Scope scope, TypeBinding actualType, Map substitutes, int constraint) {
 	// no substitute by default
 }
 
diff --git a/dom/org/eclipse/jdt/core/dom/AST.java b/dom/org/eclipse/jdt/core/dom/AST.java
index 4818c4e..6bc414e 100644
--- a/dom/org/eclipse/jdt/core/dom/AST.java
+++ b/dom/org/eclipse/jdt/core/dom/AST.java
@@ -36,8 +36,8 @@
  * instance.
  * <p>
  * Abstract syntax trees may be hand constructed by clients, using the
- * <code>new<it>TYPE</it></code> factory methods to create new nodes, and the
- * various <code>set<it>CHILD</it></code> methods 
+ * <code>new<i>TYPE</i></code> factory methods to create new nodes, and the
+ * various <code>set<i>CHILD</i></code> methods 
  * (see {@link org.eclipse.jdt.core.dom.ASTNode ASTNode} and its subclasses)
  * to connect them together.
  * </p>
@@ -2813,4 +2813,3 @@
 		return this.rewriter.rewriteAST(document, options);
 	}
 }
-
diff --git a/dom/org/eclipse/jdt/core/dom/ASTMatcher.java b/dom/org/eclipse/jdt/core/dom/ASTMatcher.java
index c7631d1..c0e84e0 100644
--- a/dom/org/eclipse/jdt/core/dom/ASTMatcher.java
+++ b/dom/org/eclipse/jdt/core/dom/ASTMatcher.java
@@ -21,8 +21,8 @@
  * <code>n1</code> and <code>n2</code> are the AST root nodes of the subtrees.
  * </p>
  * <p>
- * For each different concrete AST node type <it>T</it> there is a
- * <code>public boolean match(<it>T</it> node, Object other)</code> method
+ * For each different concrete AST node type <i>T</i> there is a
+ * <code>public boolean match(<i>T</i> node, Object other)</code> method
  * that matches the given node against another object (typically another
  * AST node, although this is not essential). The default implementations
  * provided by this class tests whether the other object is a node of the
diff --git a/dom/org/eclipse/jdt/core/dom/ASTNode.java b/dom/org/eclipse/jdt/core/dom/ASTNode.java
index d283b9c..abb8cd3 100644
--- a/dom/org/eclipse/jdt/core/dom/ASTNode.java
+++ b/dom/org/eclipse/jdt/core/dom/ASTNode.java
@@ -36,7 +36,7 @@
  * Clients can navigate upwards, from child to parent, as well as downwards,
  * from parent to child. Newly created nodes are unparented. When an 
  * unparented node is set as a child of a node (using a 
- * <code>set<it>CHILD</it></code> method), its parent link is set automatically
+ * <code>set<i>CHILD</i></code> method), its parent link is set automatically
  * and the parent link of the former child is set to <code>null</code>.
  * For nodes with properties that include a list of children (for example,
  * <code>Block</code> whose <code>statements</code> property is a list
@@ -68,8 +68,8 @@
  * </p>
  * <p>
  * Abstract syntax trees may be hand constructed by clients, using the
- * <code>new<it>TYPE</it></code> factory methods (see <code>AST</code>) to
- * create new nodes, and the various <code>set<it>CHILD</it></code> methods
+ * <code>new<i>TYPE</i></code> factory methods (see <code>AST</code>) to
+ * create new nodes, and the various <code>set<i>CHILD</i></code> methods
  * to connect them together.
  * </p>
  * <p>
diff --git a/dom/org/eclipse/jdt/core/dom/ASTParser.java b/dom/org/eclipse/jdt/core/dom/ASTParser.java
index 7433e2a..46c86e7 100644
--- a/dom/org/eclipse/jdt/core/dom/ASTParser.java
+++ b/dom/org/eclipse/jdt/core/dom/ASTParser.java
@@ -324,7 +324,7 @@
 	/**
      * Requests an abridged abstract syntax tree. 
      * By default, complete ASTs are returned.
-     *
+     * <p>
      * When <code>true</code> the resulting AST does not have nodes for
      * the entire compilation unit. Rather, the AST is only fleshed out
      * for the node that include the given source position. This kind of limited
@@ -735,7 +735,7 @@
 	 * Note also the following parser parameters are used, regardless of what
 	 * may have been specified:
 	 * <ul>
-	 * <li>The {@linkplain #setResolveBindings(boolean) binding resolution flag} is <code>true</code<</li>
+	 * <li>The {@linkplain #setResolveBindings(boolean) binding resolution flag} is <code>true</code></li>
 	 * <li>The {@linkplain #setKind(int) parser kind} is <code>K_COMPILATION_UNIT</code></li>
 	 * <li>The {@linkplain #setSourceRange(int,int) source range} is <code>(0, -1)</code></li>
 	 * <li>The {@linkplain #setFocalPosition(int) focal position} is not set</li>
@@ -1116,4 +1116,4 @@
 				}
 		}
 	}
-}
+}
\ No newline at end of file
diff --git a/dom/org/eclipse/jdt/core/dom/ASTVisitor.java b/dom/org/eclipse/jdt/core/dom/ASTVisitor.java
index 1c5ca44..c254322 100644
--- a/dom/org/eclipse/jdt/core/dom/ASTVisitor.java
+++ b/dom/org/eclipse/jdt/core/dom/ASTVisitor.java
@@ -14,10 +14,10 @@
 /**
  * A visitor for abstract syntax trees.
  * <p>
- * For each different concrete AST node type <it>T</it> there are
+ * For each different concrete AST node type <i>T</i> there are
  * a pair of methods:
  * <ul>
- * <li><code>public boolean visit(<it>T</it> node)</code> - Visits
+ * <li><code>public boolean visit(<i>T</i> node)</code> - Visits
  * the given node to perform some arbitrary operation. If <code>true</code>
  * is returned, the given node's child nodes will be visited next; however,
  * if <code>false</code> is returned, the given node's child nodes will 
@@ -25,7 +25,7 @@
  * nothing and returns <code>true</code> (with the exception of 
  * {@link #visit(Javadoc) ASTVisitor.visit(Javadoc)}).
  * Subclasses may reimplement this method as needed.</li>
- * <li><code>public void endVisit(<it>T</it> node)</code> - Visits
+ * <li><code>public void endVisit(<i>T</i> node)</code> - Visits
  * the given node to perform some arbitrary operation. When used in the
  * conventional way, this method is called after all of the given node's
  * children have been visited (or immediately, if <code>visit</code> returned
@@ -73,7 +73,7 @@
  * been visited from the ones that are still to be visited (the cursor
  * is between the elements, rather than on an element). The cursor moves from
  * the head to the tail of this list, advancing to the next position just
- * <it>before</it> <code>visit</code> if called for that child. After the child
+ * <i>before</i> <code>visit</code> if called for that child. After the child
  * subtree has been completely visited, the visit moves on the child 
  * immediately after the cursor. Removing a child while it is being visited
  * does not alter the course of the visit. But any children added at positions
diff --git a/dom/org/eclipse/jdt/core/dom/ArrayCreation.java b/dom/org/eclipse/jdt/core/dom/ArrayCreation.java
index a065c6d..dba490a 100644
--- a/dom/org/eclipse/jdt/core/dom/ArrayCreation.java
+++ b/dom/org/eclipse/jdt/core/dom/ArrayCreation.java
@@ -19,7 +19,7 @@
  * <pre>
  * ArrayCreation:
  *    <b>new</b> PrimitiveType <b>[</b> Expression <b>]</b> { <b>[</b> Expression <b>]</b> } { <b>[</b> <b>]</b> }
- *    <b>new</b> TypeName <b>[</b> Expression ]</b> { <b>[</b> Expression <b>]</b> } { <b>[</b> <b>]</b> }
+ *    <b>new</b> TypeName <b>[</b> Expression <b>]</b> { <b>[</b> Expression <b>]</b> } { <b>[</b> <b>]</b> }
  *    <b>new</b> PrimitiveType <b>[</b> <b>]</b> { <b>[</b> <b>]</b> } ArrayInitializer
  *    <b>new</b> TypeName <b>[</b> <b>]</b> { <b>[</b> <b>]</b> } ArrayInitializer
  * </pre>
@@ -37,7 +37,7 @@
  * ArrayCreation:
  *    <b>new</b> PrimitiveType <b>[</b> Expression <b>]</b> { <b>[</b> Expression <b>]</b> } { <b>[</b> <b>]</b> }
  *    <b>new</b> TypeName [ <b>&lt;</b> Type { <b>,</b> Type } <b>&gt;</b> ]
- *        <b>[</b> Expression ]</b> { <b>[</b> Expression <b>]</b> } { <b>[</b> <b>]</b> }
+ *        <b>[</b> Expression <b>]</b> { <b>[</b> Expression <b>]</b> } { <b>[</b> <b>]</b> }
  *    <b>new</b> PrimitiveType <b>[</b> <b>]</b> { <b>[</b> <b>]</b> } ArrayInitializer
  *    <b>new</b> TypeName [ <b>&lt;</b> Type { <b>,</b> Type } <b>&gt;</b> ]
  *        <b>[</b> <b>]</b> { <b>[</b> <b>]</b> } ArrayInitializer
diff --git a/dom/org/eclipse/jdt/core/dom/CompilationUnit.java b/dom/org/eclipse/jdt/core/dom/CompilationUnit.java
index a13b244..3aa6b28 100644
--- a/dom/org/eclipse/jdt/core/dom/CompilationUnit.java
+++ b/dom/org/eclipse/jdt/core/dom/CompilationUnit.java
@@ -390,6 +390,7 @@
 	 * for comments of all kinds (line, block, and doc), arranged in order
 	 * of increasing source position. 
 	 * </p>
+	 * <p>
 	 * Note on comment parenting: The {@link ASTNode#getParent() getParent()}
 	 * of a doc comment associated with a body declaration is the body
 	 * declaration node; for these comment nodes
diff --git a/dom/org/eclipse/jdt/core/dom/ITypeBinding.java b/dom/org/eclipse/jdt/core/dom/ITypeBinding.java
index 75b22d9..69ec8c5 100644
--- a/dom/org/eclipse/jdt/core/dom/ITypeBinding.java
+++ b/dom/org/eclipse/jdt/core/dom/ITypeBinding.java
@@ -472,6 +472,7 @@
      * Note that per construction, it can only contain one class or array type, 
      * at most, and then it is located in first position.
      * </p>
+     * <p>
      * Also note that array type bound may only occur in the case of a capture
      * binding, e.g. <code>capture-of ? extends Object[]</code>
      * </p>
@@ -755,6 +756,7 @@
 	 * class <code>java.lang.String</code> and whose erasure is the type
 	 * binding for the generic type <code>java.util.Collection</code>.
 	 * </p>
+	 * <p>
 	 * Note that {@link #isGenericType()},
 	 * {@link #isParameterizedType()},
 	 * and {@link #isRawType()} are mutually exclusive.
@@ -877,7 +879,7 @@
 	 * For example, a AST type like 
 	 * <code>Collection&lt;? extends Object&gt;</code> typically resolves to a
 	 * parameterized type binding whose type argument is a wildcard type
-	 * with upper type bound <code>java.util.Object/code>.
+	 * with upper type bound <code>java.util.Object</code>.
 	 * </p>
 	 *
 	 * @return <code>true</code> if this object represents a wildcard type,
diff --git a/dom/org/eclipse/jdt/core/dom/MethodBinding.java b/dom/org/eclipse/jdt/core/dom/MethodBinding.java
index 0c5c998..a44483b 100644
--- a/dom/org/eclipse/jdt/core/dom/MethodBinding.java
+++ b/dom/org/eclipse/jdt/core/dom/MethodBinding.java
@@ -28,6 +28,7 @@
 import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
 import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
+import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
 import org.eclipse.jdt.internal.core.JavaElement;
 import org.eclipse.jdt.internal.core.Member;
 import org.eclipse.jdt.internal.core.util.Util;
@@ -411,10 +412,16 @@
 	}
 	
 	public boolean isSubsignature(IMethodBinding otherMethod) {
-		org.eclipse.jdt.internal.compiler.lookup.MethodBinding other = ((MethodBinding) otherMethod).binding;
-		if (!CharOperation.equals(this.binding.selector, other.selector))
+		try {
+			org.eclipse.jdt.internal.compiler.lookup.MethodBinding other = ((MethodBinding) otherMethod).binding;
+			if (!CharOperation.equals(this.binding.selector, other.selector))
+				return false;
+			return this.binding.areParameterErasuresEqual(other) && this.binding.areTypeVariableErasuresEqual(other);
+		} catch (AbortCompilation e) {
+			// don't surface internal exception to clients
+			// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=143013
 			return false;
-		return this.binding.areParameterErasuresEqual(other) && this.binding.areTypeVariableErasuresEqual(other);
+		}
 	}
 
 	/**
@@ -428,28 +435,34 @@
 	 * @see IMethodBinding#overrides(IMethodBinding)
 	 */
 	public boolean overrides(IMethodBinding overridenMethod) {
-		org.eclipse.jdt.internal.compiler.lookup.MethodBinding overridenCompilerBinding = ((MethodBinding) overridenMethod).binding;
-		if (this.binding == overridenCompilerBinding) 
-			return false;
-		char[] selector = this.binding.selector;
-		if (!CharOperation.equals(selector, overridenCompilerBinding.selector))
-			return false;
-		TypeBinding match = this.binding.declaringClass.findSuperTypeWithSameErasure(overridenCompilerBinding.declaringClass);
-		if (!(match instanceof ReferenceBinding)) return false;
-		
-		org.eclipse.jdt.internal.compiler.lookup.MethodBinding[] superMethods = ((ReferenceBinding)match).getMethods(selector);
-		for (int i = 0, length = superMethods.length; i < length; i++) {
-			if (superMethods[i].original() == overridenCompilerBinding) {
-				LookupEnvironment lookupEnvironment = this.resolver.lookupEnvironment();
-				if (lookupEnvironment == null) return false;
-				MethodVerifier methodVerifier = lookupEnvironment.methodVerifier();
-				org.eclipse.jdt.internal.compiler.lookup.MethodBinding superMethod = superMethods[i];
-				return !superMethod.isPrivate() 
-					&& !(superMethod.isDefault() && (superMethod.declaringClass.getPackage()) != this.binding.declaringClass.getPackage())
-					&& methodVerifier.doesMethodOverride(this.binding, superMethod);
+		try {
+			org.eclipse.jdt.internal.compiler.lookup.MethodBinding overridenCompilerBinding = ((MethodBinding) overridenMethod).binding;
+			if (this.binding == overridenCompilerBinding) 
+				return false;
+			char[] selector = this.binding.selector;
+			if (!CharOperation.equals(selector, overridenCompilerBinding.selector))
+				return false;
+			TypeBinding match = this.binding.declaringClass.findSuperTypeWithSameErasure(overridenCompilerBinding.declaringClass);
+			if (!(match instanceof ReferenceBinding)) return false;
+			
+			org.eclipse.jdt.internal.compiler.lookup.MethodBinding[] superMethods = ((ReferenceBinding)match).getMethods(selector);
+			for (int i = 0, length = superMethods.length; i < length; i++) {
+				if (superMethods[i].original() == overridenCompilerBinding) {
+					LookupEnvironment lookupEnvironment = this.resolver.lookupEnvironment();
+					if (lookupEnvironment == null) return false;
+					MethodVerifier methodVerifier = lookupEnvironment.methodVerifier();
+					org.eclipse.jdt.internal.compiler.lookup.MethodBinding superMethod = superMethods[i];
+					return !superMethod.isPrivate() 
+						&& !(superMethod.isDefault() && (superMethod.declaringClass.getPackage()) != this.binding.declaringClass.getPackage())
+						&& methodVerifier.doesMethodOverride(this.binding, superMethod);
+				}
 			}
+			return false;
+		} catch (AbortCompilation e) {
+			// don't surface internal exception to clients
+			// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=143013
+			return false;
 		}
-		return false;
 	}
 
 	/**
diff --git a/dom/org/eclipse/jdt/core/dom/TypeBinding.java b/dom/org/eclipse/jdt/core/dom/TypeBinding.java
index 3533611..219ad7b 100644
--- a/dom/org/eclipse/jdt/core/dom/TypeBinding.java
+++ b/dom/org/eclipse/jdt/core/dom/TypeBinding.java
@@ -47,6 +47,7 @@
 import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
 import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
 import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding;
+import org.eclipse.jdt.internal.compiler.problem.AbortCompilation;
 import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
 import org.eclipse.jdt.internal.compiler.util.Util;
 import org.eclipse.jdt.internal.core.ClassFile;
@@ -952,11 +953,17 @@
 	 * @see ITypeBinding#isAssignmentCompatible(ITypeBinding)
 	 */
 	public boolean isAssignmentCompatible(ITypeBinding type) {
-		if (this == type) return true;
-		TypeBinding other = (TypeBinding) type;
-		Scope scope = this.resolver.scope();
-		if (scope == null) return false;
-		return this.binding.isCompatibleWith(other.binding) || scope.isBoxingCompatibleWith(this.binding, other.binding);
+		try {
+			if (this == type) return true;
+			TypeBinding other = (TypeBinding) type;
+			Scope scope = this.resolver.scope();
+			if (scope == null) return false;
+			return this.binding.isCompatibleWith(other.binding) || scope.isBoxingCompatibleWith(this.binding, other.binding);
+		} catch (AbortCompilation e) {
+			// don't surface internal exception to clients
+			// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=143013
+			return false;
+		}
 	}
 	
 	/* (non-Javadoc)
@@ -970,17 +977,23 @@
 	 * @see ITypeBinding#isCastCompatible(ITypeBinding)
 	 */
 	public boolean isCastCompatible(ITypeBinding type) {
-		Expression expression = new Expression() {
-			public StringBuffer printExpression(int indent,StringBuffer output) {
-				return null;
-			}
-		};
-		Scope scope = this.resolver.scope();
-		if (scope == null) return false;
-		org.eclipse.jdt.internal.compiler.lookup.TypeBinding expressionType = ((TypeBinding) type).binding;
-		// simulate capture in case checked binding did not properly get extracted from a reference
-		expressionType = expressionType.capture(scope, 0);
-		return expression.checkCastTypesCompatibility(scope, this.binding, expressionType, null);
+		try {
+			Expression expression = new Expression() {
+				public StringBuffer printExpression(int indent,StringBuffer output) {
+					return null;
+				}
+			};
+			Scope scope = this.resolver.scope();
+			if (scope == null) return false;
+			org.eclipse.jdt.internal.compiler.lookup.TypeBinding expressionType = ((TypeBinding) type).binding;
+			// simulate capture in case checked binding did not properly get extracted from a reference
+			expressionType = expressionType.capture(scope, 0);
+			return expression.checkCastTypesCompatibility(scope, this.binding, expressionType, null);
+		} catch (AbortCompilation e) {
+			// don't surface internal exception to clients
+			// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=143013
+			return false;
+		}
 	}
 
 	/*
@@ -1145,11 +1158,17 @@
 	 * @see ITypeBinding#isSubTypeCompatible(ITypeBinding)
 	 */
 	public boolean isSubTypeCompatible(ITypeBinding type) {
-		if (this == type) return true;
-		if (this.binding.isBaseType()) return false;
-		TypeBinding other = (TypeBinding) type;
-		if (other.binding.isBaseType()) return false;
-		return this.binding.isCompatibleWith(other.binding);
+		try {
+			if (this == type) return true;
+			if (this.binding.isBaseType()) return false;
+			TypeBinding other = (TypeBinding) type;
+			if (other.binding.isBaseType()) return false;
+			return this.binding.isCompatibleWith(other.binding);
+		} catch (AbortCompilation e) {
+			// don't surface internal exception to clients
+			// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=143013
+			return false;
+		}
 	}
 	
 	/**
diff --git a/dom/org/eclipse/jdt/core/dom/rewrite/ASTRewrite.java b/dom/org/eclipse/jdt/core/dom/rewrite/ASTRewrite.java
index 025b08b..bc86dc7 100644
--- a/dom/org/eclipse/jdt/core/dom/rewrite/ASTRewrite.java
+++ b/dom/org/eclipse/jdt/core/dom/rewrite/ASTRewrite.java
@@ -369,9 +369,9 @@
      * (not part of the original AST) or a placeholder node (for example, one
      * created by {@link #createCopyTarget(ASTNode)}
 	 * or {@link #createStringPlaceholder(String, int)}); or it must be
-	 * </code>null</code>, indicating that the child should be deleted.
+	 * <code>null</code>, indicating that the child should be deleted.
 	 * If the given property is a simple property, the value must be the new
-	 * value (primitive types must be boxed) or </code>null</code>.
+	 * value (primitive types must be boxed) or <code>null</code>.
      * The AST itself is not actually modified in any way; rather, the rewriter
      * just records a note that this node has been changed in the specified way.
 	 * 
diff --git a/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java b/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java
index 4eff846..a860dfd 100644
--- a/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java
+++ b/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java
@@ -60,6 +60,7 @@
 	 * unnecessary to add import statements for. 
 	 * 
 	 * </p>
+	 * <p>
 	 * This class can be implemented by clients.
 	 * </p>
 	 */
diff --git a/model/org/eclipse/jdt/core/BindingKey.java b/model/org/eclipse/jdt/core/BindingKey.java
index 1c6ce37..022e2c2 100644
--- a/model/org/eclipse/jdt/core/BindingKey.java
+++ b/model/org/eclipse/jdt/core/BindingKey.java
@@ -67,8 +67,13 @@
 	 * For example:
 	 * <pre>
 	 * <code>
-	 * createParameterizedTypeBindingKey("Ljava/util/Map<TK;TV;>;", new String[] {"Ljava/lang/String;", "Ljava/lang/Object;"}) -> "Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;"
-	 * createParameterizedTypeBindingKey("Ljava/util/List<TE;>;", new String[] {}) -> "Ljava/util/List<>;"
+	 * createParameterizedTypeBindingKey(
+	 *     "Ljava/util/Map&lt;TK;TV;&gt;;", 
+	 *     new String[] {"Ljava/lang/String;", "Ljava/lang/Object;"}) -&gt; 
+	 *       "Ljava/util/Map&lt;Ljava/lang/String;Ljava/lang/Object;&gt;;"
+	 * createParameterizedTypeBindingKey(
+	 *     "Ljava/util/List&lt;TE;&gt;;", new String[] {}) -&gt; 
+	 *       "Ljava/util/List&lt;&gt;;"
 	 * </code>
 	 * </pre>
 	 * </p>
@@ -121,8 +126,10 @@
 	 * For example:
 	 * <pre>
 	 * <code>
-	 * createTypeVariableBindingKey("T", "Ljava/util/List<TE;>;") -> "Ljava/util/List<TE;>;:TT;"
-	 * createTypeVariableBindingKey("SomeTypeVariable", "Lp/X;.foo()V") -> "Lp/X;.foo()V:TSomeTypeVariable;"
+	 * createTypeVariableBindingKey("T", "Ljava/util/List&lt;TE;&gt;;") -&gt; 
+	 *   "Ljava/util/List&lt;TE;&gt;;:TT;"
+	 * createTypeVariableBindingKey("SomeTypeVariable", "Lp/X;.foo()V") -&gt; 
+	 *   "Lp/X;.foo()V:TSomeTypeVariable;"
 	 * </code>
 	 * </pre>
 	 * </p>
@@ -150,9 +157,11 @@
 	 * For example:
 	 * <pre>
 	 * <code>
-	 * createWilcardTypeBindingKey(null, Signature.C_STAR) -> "*"
-	 * createWilcardTypeBindingKey("Ljava/util/List<TE;>;", Signature.C_SUPER) -> "-Ljava/util/List<TE;>;"
-	 * createWilcardTypeBindingKey("Ljava/util/ArrayList;", Signature.C_EXTENDS) -> "+Ljava/util/ArrayList;"
+	 * createWilcardTypeBindingKey(null, Signature.C_STAR) -&gt; "*"
+	 * createWilcardTypeBindingKey("Ljava/util/List&lt;TE;&gt;;",
+	 *    Signature.C_SUPER) -&gt; "-Ljava/util/List&lt;TE;&gt;;"
+	 * createWilcardTypeBindingKey("Ljava/util/ArrayList;", Signature.C_EXTENDS) -&gt;
+	 *    "+Ljava/util/ArrayList;"
 	 * </code>
 	 * </pre>
 	 * </p>
diff --git a/model/org/eclipse/jdt/core/CompletionProposal.java b/model/org/eclipse/jdt/core/CompletionProposal.java
index f318406..3508830 100644
--- a/model/org/eclipse/jdt/core/CompletionProposal.java
+++ b/model/org/eclipse/jdt/core/CompletionProposal.java
@@ -1571,7 +1571,7 @@
 	 * </p>
 	 * <p>
 	 * <b>Note that this is an expensive thing to compute, which may require
-	 * parsing Java source files, etc. Use sparingly.
+	 * parsing Java source files, etc. Use sparingly.</b>
 	 * </p>
 	 * 
 	 * @param monitor the progress monitor, or <code>null</code> if none
@@ -1797,4 +1797,4 @@
 		buffer.append('}');
 		return buffer.toString();
 	}
-}
+}
\ No newline at end of file
diff --git a/model/org/eclipse/jdt/core/IAccessRule.java b/model/org/eclipse/jdt/core/IAccessRule.java
index 052a53a..ee952bb 100644
--- a/model/org/eclipse/jdt/core/IAccessRule.java
+++ b/model/org/eclipse/jdt/core/IAccessRule.java
@@ -99,7 +99,7 @@
 	int getKind();
 	
 	/**
-	 * Returns whether a type matching this rule should be ignored iff a type with 
+	 * <p>Returns whether a type matching this rule should be ignored iff a type with 
 	 * the same qualified name can be found on a later classpath entry with a better 
 	 * accessibility.</p>
 	 * <p>E.g. if a type p.X matches a rule K_NON_ACCESSIBLE | IGNORE_IF_BETTER 
diff --git a/model/org/eclipse/jdt/core/IClassFile.java b/model/org/eclipse/jdt/core/IClassFile.java
index bee327f..1889c9d 100644
--- a/model/org/eclipse/jdt/core/IClassFile.java
+++ b/model/org/eclipse/jdt/core/IClassFile.java
@@ -48,7 +48,7 @@
  * Once in working copy mode, changes to this working copy or its children are done in memory.
  * Only the new buffer is affected. 
  * </p>
- * </p>
+ * <p>
  * Using {@link ICompilationUnit#commitWorkingCopy(boolean, IProgressMonitor)} on the working copy
  * will throw a <code>JavaModelException</code> as a class file is implicetly read-only.
  * </p>
diff --git a/model/org/eclipse/jdt/core/IClasspathEntry.java b/model/org/eclipse/jdt/core/IClasspathEntry.java
index ff37500..34ccb84 100644
--- a/model/org/eclipse/jdt/core/IClasspathEntry.java
+++ b/model/org/eclipse/jdt/core/IClasspathEntry.java
@@ -374,8 +374,8 @@
 	 *		path to the corresponding project resource.</li>
 	 *  <li>A variable entry (<code>CPE_VARIABLE</code>) - the first segment of the path 
 	 *      is the name of a classpath variable. If this classpath variable
-	 *		is bound to the path <it>P</it>, the path of the corresponding classpath entry
-	 *		is computed by appending to <it>P</it> the segments of the returned
+	 *		is bound to the path <i>P</i>, the path of the corresponding classpath entry
+	 *		is computed by appending to <i>P</i> the segments of the returned
 	 *		path without the variable.</li>
 	 *  <li> A container entry (<code>CPE_CONTAINER</code>) - the path of the entry
 	 * 	is the name of the classpath container, which can be bound indirectly to a set of classpath 
@@ -431,7 +431,7 @@
 	/**
 	 * This is a helper method, which returns the resolved classpath entry denoted 
 	 * by an entry (if it is a variable entry). It is obtained by resolving the variable 
-	 * reference in the first segment. Returns <node>null</code> if unable to resolve using 
+	 * reference in the first segment. Returns <code>null</code> if unable to resolve using 
 	 * the following algorithm:
 	 * <ul>
 	 * <li> if variable segment cannot be resolved, returns <code>null</code></li>
diff --git a/model/org/eclipse/jdt/core/ICodeAssist.java b/model/org/eclipse/jdt/core/ICodeAssist.java
index ac02b07..11410dd 100644
--- a/model/org/eclipse/jdt/core/ICodeAssist.java
+++ b/model/org/eclipse/jdt/core/ICodeAssist.java
@@ -157,6 +157,7 @@
 	 * @return the Java elements corresponding to the given selected text
 	 *
 	 * @exception JavaModelException if code resolve could not be performed. Reasons include:
+	 * <ul>
 	 *  <li>This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
 	 *  <li> The range specified is not within this element's
 	 *      source range (INDEX_OUT_OF_BOUNDS)
@@ -186,6 +187,7 @@
 	 * @return the Java elements corresponding to the given selected text
 	 *
 	 * @exception JavaModelException if code resolve could not be performed. Reasons include:
+	 * <ul>
 	 *  <li>This Java element does not exist (ELEMENT_DOES_NOT_EXIST)</li>
 	 *  <li> The range specified is not within this element's
 	 *      source range (INDEX_OUT_OF_BOUNDS)
diff --git a/model/org/eclipse/jdt/core/IMethod.java b/model/org/eclipse/jdt/core/IMethod.java
index f7084b8..1b0be87 100644
--- a/model/org/eclipse/jdt/core/IMethod.java
+++ b/model/org/eclipse/jdt/core/IMethod.java
@@ -213,7 +213,7 @@
  * <li>its name is equal to <code>"main"</code></li>
  * <li>its return type is <code>void</code></li>
  * <li>it is <code>static</code> and <code>public</code></li>
- * <li>it defines one parameter whose type's simple name is </code>String[]</code></li>
+ * <li>it defines one parameter whose type's simple name is <code>String[]</code></li>
  * </ul>
  * 
  * @exception JavaModelException if this element does not exist or if an
diff --git a/model/org/eclipse/jdt/core/IProblemRequestor.java b/model/org/eclipse/jdt/core/IProblemRequestor.java
index e1817b2..7781fdc 100644
--- a/model/org/eclipse/jdt/core/IProblemRequestor.java
+++ b/model/org/eclipse/jdt/core/IProblemRequestor.java
@@ -43,7 +43,7 @@
 
 	/**
 	 * Predicate allowing the problem requestor to signal whether or not it is currently
-	 * interested by problem reports. When answering <code>false</false>, problem will
+	 * interested by problem reports. When answering <code>false</code>, problem will
 	 * not be discovered any more until the next iteration.
 	 * 
 	 * This  predicate will be invoked once prior to each problem detection iteration.
diff --git a/model/org/eclipse/jdt/core/ISourceReference.java b/model/org/eclipse/jdt/core/ISourceReference.java
index 6c9946a..f005327 100644
--- a/model/org/eclipse/jdt/core/ISourceReference.java
+++ b/model/org/eclipse/jdt/core/ISourceReference.java
@@ -16,7 +16,6 @@
  * <code>IPackageDeclaration</code>, <code>IImportDeclaration</code>,
  * <code>IImportContainer</code>, <code>IType</code>, <code>IField</code>,
  * <code>IMethod</code>, and <code>IInitializer</code>.
- * </ul>
  * <p>
  * Note: For <code>IClassFile</code>, <code>IType</code> and other members
  * derived from a binary type, the implementation returns source iff the
diff --git a/model/org/eclipse/jdt/core/IType.java b/model/org/eclipse/jdt/core/IType.java
index 1050a2f..e5aa94a 100644
--- a/model/org/eclipse/jdt/core/IType.java
+++ b/model/org/eclipse/jdt/core/IType.java
@@ -428,7 +428,7 @@
 	
 	/**
 	 * Returns this type's fully qualified name followed by its type parameters between angle brakets if it is a generic type.
-	 * For example, "p.X<T>", "java.util.Map<java.lang.String, p.X>"
+	 * For example, "p.X&lt;T&gt;", "java.util.Map&lt;java.lang.String, p.X&gt;"
 	 * 
 	 * @exception JavaModelException if this element does not exist or if an
 	 *      exception occurs while accessing its corresponding resource.
@@ -492,7 +492,7 @@
 	
 	/**
 	 * Returns the methods and constructors declared by this type.
-	 * For binary types, this may include the special <code>&lt;clinit&gt</code>; method 
+	 * For binary types, this may include the special <code>&lt;clinit&gt;</code>; method 
 	 * and synthetic methods.
 	 * If this is a source type, the results are listed in the order
 	 * in which they appear in the source, otherwise, the results are
@@ -580,7 +580,7 @@
 	/**
 	 * Returns the names of interfaces that this type implements or extends,
 	 * in the order in which they are listed in the source.
-	 * </p>
+	 * <p>
 	 * For classes, this gives the interfaces that this class implements.
 	 * For interfaces, this gives the interfaces that this interface extends.
 	 * An empty collection is returned if this type does not implement or
@@ -802,7 +802,7 @@
 	 * <li>IType#newSupertypeHierarchy(IProgressMonitor)</li>
 	 * <li>IType#newTypeHierarchy(IJavaProject, IProgressMonitor)</li>
 	 * <li>IType#newTypeHierarchy(IProgressMonitor)</li>
-	 * </u>
+	 * </ul>
 	 * 
 	 * @param input stream where hierarchy will be read
 	 * @param monitor the given progress monitor
diff --git a/model/org/eclipse/jdt/core/ITypeHierarchy.java b/model/org/eclipse/jdt/core/ITypeHierarchy.java
index 66b430d..51c9732 100644
--- a/model/org/eclipse/jdt/core/ITypeHierarchy.java
+++ b/model/org/eclipse/jdt/core/ITypeHierarchy.java
@@ -291,7 +291,7 @@
  * <li>IType#newSupertypeHierarchy(IProgressMonitor)</li>
  * <li>IType#newTypeHierarchy(IJavaProject, IProgressMonitor)</li>
  * <li>IType#newTypeHierarchy(IProgressMonitor)</li>
- * </u>
+ * </ul>
  * 
  * @param outputStream output stream where the hierarchy will be stored
  * @param monitor the given progress monitor
diff --git a/model/org/eclipse/jdt/core/JavaConventions.java b/model/org/eclipse/jdt/core/JavaConventions.java
index aeb8435..9a058bd 100644
--- a/model/org/eclipse/jdt/core/JavaConventions.java
+++ b/model/org/eclipse/jdt/core/JavaConventions.java
@@ -110,6 +110,7 @@
 
 	/**
 	 * Validate the given compilation unit name.
+	 * <p>
 	 * A compilation unit name must obey the following rules:
 	 * <ul>
 	 * <li> it must not be null
@@ -157,6 +158,7 @@
 
 	/**
 	 * Validate the given .class file name.
+	 * <p>
 	 * A .class file name must obey the following rules:
 	 * <ul>
 	 * <li> it must not be null
diff --git a/model/org/eclipse/jdt/core/JavaCore.java b/model/org/eclipse/jdt/core/JavaCore.java
index 67c4b8b..0f183c5 100644
--- a/model/org/eclipse/jdt/core/JavaCore.java
+++ b/model/org/eclipse/jdt/core/JavaCore.java
@@ -1541,7 +1541,7 @@
 
 	/**
 	 * Returns the path held in the given classpath variable.
-	 * Returns <node>null</code> if unable to bind.
+	 * Returns <code>null</code> if unable to bind.
 	 * <p>
 	 * Classpath variable values are persisted locally to the workspace, and 
 	 * are preserved from session to session.
@@ -2550,6 +2550,7 @@
 	 *     - option id:         "org.eclipse.jdt.core.codeComplete.camelCaseMatch"
 	 *     - possible values:   { "enabled", "disabled" }
 	 *     - default:           "enabled"
+	 * </pre>
 	 */
  	public static Hashtable getDefaultOptions(){
  		return JavaModelManager.getJavaModelManager().getDefaultOptions();
@@ -2644,7 +2645,7 @@
 	/**
 	 * This is a helper method, which returns the resolved classpath entry denoted 
 	 * by a given entry (if it is a variable entry). It is obtained by resolving the variable 
-	 * reference in the first segment. Returns <node>null</code> if unable to resolve using 
+	 * reference in the first segment. Returns <code>null</code> if unable to resolve using 
 	 * the following algorithm:
 	 * <ul>
 	 * <li> if variable segment cannot be resolved, returns <code>null</code></li>
@@ -2808,7 +2809,7 @@
 	 * Only compilation units in working copy mode are returned.
 	 * If the owner is <code>null</code>, primary working copies are returned.
 	 * 
-	 * @param owner the given working copy owner or <null> for primary working copy owner
+	 * @param owner the given working copy owner or <code>null</code> for primary working copy owner
 	 * @return the list of working copies for a given owner
 	 * @since 3.0
 	 */
@@ -3790,7 +3791,7 @@
 	 * <p>
 	 *	It is possible to register an automatic initializer (<code>ClasspathVariableInitializer</code>),
 	 * which will be invoked through the extension point "org.eclipse.jdt.core.classpathVariableInitializer".
-	 * After resolution, a classpath variable entry may either correspond to a project or a library entry. </li>	 
+	 * After resolution, a classpath variable entry may either correspond to a project or a library entry.
 	 * <p>
 	 * e.g. Here are some examples of variable path usage<ul>
 	 * <li> "JDTCORE" where variable <code>JDTCORE</code> is 
diff --git a/model/org/eclipse/jdt/core/Signature.java b/model/org/eclipse/jdt/core/Signature.java
index 94c953a..a7e2528 100644
--- a/model/org/eclipse/jdt/core/Signature.java
+++ b/model/org/eclipse/jdt/core/Signature.java
@@ -32,10 +32,10 @@
  * <p>
  * Generic types introduce to the Java language in J2SE 1.5 add three new
  * facets to signatures: type variables, parameterized types with type arguments,
- * and formal type parameters. <it>Rich</it> signatures containing these facets
+ * and formal type parameters. <i>Rich</i> signatures containing these facets
  * only occur when dealing with code that makes overt use of the new language
  * features. All other code, and certainly all Java code written or compiled
- * with J2SE 1.4 or earlier, involved only <it>simple</it> signatures.
+ * with J2SE 1.4 or earlier, involved only <i>simple</i> signatures.
  * </p>
  * <p>
  * Note that the "Q" and "!" formats are specific to Eclipse; the remainder
@@ -302,7 +302,7 @@
 
 	/**
 	 * Character constant indicating a capture of a wildcard type in a 
-	 * signature.Value is <code>'!'</code>.
+	 * signature. Value is <code>'!'</code>.
 	 * @since 3.1
 	 */
 	public static final char C_CAPTURE	= '!';
@@ -1599,9 +1599,9 @@
  * For example:
  * <pre>
  * <code>
- * getQualifier("java.lang.Object") -> "java.lang"
- * getQualifier("Outer.Inner") -> "Outer"
- * getQualifier("java.util.List<java.lang.String>") -> "java.util"
+ * getQualifier("java.lang.Object") -&gt; "java.lang"
+ * getQualifier("Outer.Inner") -&gt; "Outer"
+ * getQualifier("java.util.List&lt;java.lang.String&gt;") -&gt; "java.util"
  * </code>
  * </pre>
  * </p>
@@ -1842,10 +1842,10 @@
  * For example:
  * <pre>
  * <code>
- * getSimpleName("java.lang.Object") -> "Object"
+ * getSimpleName("java.lang.Object") -&gt; "Object"
  * </code>
  * <code>
- * getSimpleName("java.util.Map<java.lang.String, java.lang.Object>") -> "Map<String,Object>"
+ * getSimpleName("java.util.Map&lt;java.lang.String, java.lang.Object&gt;") -&gt; "Map&lt;String,Object&gt;"
  * </code>
  * </pre>
  * </p>
@@ -2036,10 +2036,11 @@
  * For example:
  * <pre>
  * <code>
- * getSimpleNames("java.lang.Object") -> {"java", "lang", "Object"}
- * getSimpleNames("Object") -> {"Object"}
- * getSimpleNames("") -> {}
- * getSimpleNames("java.util.List<java.lang.String>") -> {"java", "lang", "List<java.lang.String"}
+ * getSimpleNames("java.lang.Object") -&gt; {"java", "lang", "Object"}
+ * getSimpleNames("Object") -&gt; {"Object"}
+ * getSimpleNames("") -&gt; {}
+ * getSimpleNames("java.util.List&lt;java.lang.String&gt;") -&gt; 
+ *   {"java", "util", "List&lt;java.lang.String&gt;"}
  * </code>
  * </pre>
  *
@@ -2060,8 +2061,8 @@
  * For example (using equivalent string-based method):
  * <pre>
  * <code>
- * removeCapture("LTest<!+Ljava.lang.Throwable;>;")
- * will return: "LTest<+Ljava.lang.Throwable;>;"
+ * removeCapture("LTest&lt;!+Ljava.lang.Throwable;&gt;;")
+ * will return: "LTest&lt;+Ljava.lang.Throwable;&gt;;"
  * </code>
  * </pre>
  * </p>
@@ -2086,8 +2087,8 @@
  * For example:
  * <pre>
  * <code>
- * removeCapture("LTest<!+Ljava.lang.Throwable;>;")
- * will return: "LTest<+Ljava.lang.Throwable;>;"
+ * removeCapture("LTest&lt;!+Ljava.lang.Throwable;&gt;;")
+ * will return: "LTest&lt;+Ljava.lang.Throwable;&gt;;"
  * </code>
  * </pre>
  * </p>
diff --git a/model/org/eclipse/jdt/core/eval/IEvaluationContext.java b/model/org/eclipse/jdt/core/eval/IEvaluationContext.java
index 871cf03..1f44230 100644
--- a/model/org/eclipse/jdt/core/eval/IEvaluationContext.java
+++ b/model/org/eclipse/jdt/core/eval/IEvaluationContext.java
@@ -342,7 +342,7 @@
 		throws JavaModelException;
 	/**
 	 * Evaluates the given global variable. During this operation, 
-	 * this context's package declaration, imports, and <it>all</it> its declared 
+	 * this context's package declaration, imports, and <i>all</i> its declared 
 	 * variables are verified. The given requestor's <code>acceptProblem</code>
 	 * method will be called for each problem that is detected.
 	 * <p>
diff --git a/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java b/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java
index 1ceb639..5ddcdd7 100644
--- a/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java
+++ b/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java
@@ -791,7 +791,7 @@
 					if (!nameStarted) {
 						nameFragmentStart = this.namePos+1;
 						nameStarted = true;
-					} else
+					} else if (this.namePos > nameFragmentStart) // handle name starting with a $ (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=91709)
 						identCount ++;
 					break;
 				case Signature.C_GENERIC_START :
diff --git a/model/org/eclipse/jdt/internal/core/CompilationUnit.java b/model/org/eclipse/jdt/internal/core/CompilationUnit.java
index 2e62243..d493038 100644
--- a/model/org/eclipse/jdt/internal/core/CompilationUnit.java
+++ b/model/org/eclipse/jdt/internal/core/CompilationUnit.java
@@ -372,8 +372,7 @@
  * @since 3.0
  */
 public IImportDeclaration createImport(String importName, IJavaElement sibling, int flags, IProgressMonitor monitor) throws JavaModelException {
-	// TODO (jerome) - consult flags to create static imports
-	CreateImportOperation op = new CreateImportOperation(importName, this);
+	CreateImportOperation op = new CreateImportOperation(importName, this, flags);
 	if (sibling != null) {
 		op.createBefore(sibling);
 	}
diff --git a/model/org/eclipse/jdt/internal/core/CopyElementsOperation.java b/model/org/eclipse/jdt/internal/core/CopyElementsOperation.java
index 804b74c..f5da18f 100644
--- a/model/org/eclipse/jdt/internal/core/CopyElementsOperation.java
+++ b/model/org/eclipse/jdt/internal/core/CopyElementsOperation.java
@@ -15,6 +15,7 @@
 
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IImportDeclaration;
 import org.eclipse.jdt.core.IJavaElement;
 import org.eclipse.jdt.core.IJavaModelStatus;
 import org.eclipse.jdt.core.IJavaModelStatusConstants;
@@ -95,7 +96,8 @@
 			case IJavaElement.PACKAGE_DECLARATION :
 				return new CreatePackageDeclarationOperation(element.getElementName(), (ICompilationUnit) dest);
 			case IJavaElement.IMPORT_DECLARATION :
-				return new CreateImportOperation(element.getElementName(), (ICompilationUnit) dest);
+				IImportDeclaration importDeclaration = (IImportDeclaration) element;
+				return new CreateImportOperation(element.getElementName(), (ICompilationUnit) dest, importDeclaration.getFlags());
 			case IJavaElement.TYPE :
 				if (isRenamingMainType(element, dest)) {
 					IPath path = element.getPath();
diff --git a/model/org/eclipse/jdt/internal/core/CreateImportOperation.java b/model/org/eclipse/jdt/internal/core/CreateImportOperation.java
index 44cc371..eda7dae 100644
--- a/model/org/eclipse/jdt/internal/core/CreateImportOperation.java
+++ b/model/org/eclipse/jdt/internal/core/CreateImportOperation.java
@@ -13,6 +13,7 @@
 import java.util.Iterator;
 
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.Flags;
 import org.eclipse.jdt.core.ICompilationUnit;
 import org.eclipse.jdt.core.IImportDeclaration;
 import org.eclipse.jdt.core.IJavaElement;
@@ -52,16 +53,23 @@
  */
 public class CreateImportOperation extends CreateElementInCUOperation {
 
-	/**
+	/*
 	 * The name of the import to be created.
 	 */
 	protected String importName;
+	
+	/*
+	 * The flags of the import to be created (either Flags#AccDefault or Flags#AccStatic)
+	 */
+	protected int flags;
+
 /**
  * When executed, this operation will add an import to the given compilation unit.
  */
-public CreateImportOperation(String importName, ICompilationUnit parentElement) {
+public CreateImportOperation(String importName, ICompilationUnit parentElement, int flags) {
 	super(parentElement);
 	this.importName = importName;
+	this.flags = flags;
 }
 protected StructuralPropertyDescriptor getChildPropertyDescriptor(ASTNode parent) {
 	return CompilationUnit.IMPORTS_PROPERTY;
@@ -69,10 +77,16 @@
 protected ASTNode generateElementAST(ASTRewrite rewriter, IDocument document, ICompilationUnit cu) throws JavaModelException {
 	// ensure no duplicate
 	Iterator imports = this.cuAST.imports().iterator();
+	boolean onDemand = this.importName.endsWith(".*"); //$NON-NLS-1$
+	String importActualName = this.importName;
+	if (onDemand) {
+		importActualName = this.importName.substring(0, this.importName.length() - 2);
+	}
 	while (imports.hasNext()) {
 		ImportDeclaration importDeclaration = (ImportDeclaration) imports.next();
-		if (this.importName.equals(importDeclaration.getName().getFullyQualifiedName())) {
-			//no new import was generated
+		if (importActualName.equals(importDeclaration.getName().getFullyQualifiedName())
+				&& (onDemand == importDeclaration.isOnDemand())
+				&& (Flags.isStatic(this.flags) == importDeclaration.isStatic())) {
 			this.creationOccurred = false;
 			return null;
 		}
@@ -80,9 +94,9 @@
 	
 	AST ast = this.cuAST.getAST();
 	ImportDeclaration importDeclaration = ast.newImportDeclaration();
+	importDeclaration.setStatic(Flags.isStatic(this.flags));
 	// split import name into individual fragments, checking for on demand imports
-	boolean onDemand = this.importName.endsWith("*"); //$NON-NLS-1$
-	char[][] charFragments = CharOperation.splitOn('.', this.importName.toCharArray(), 0, onDemand ? this.importName.length()-2 : this.importName.length());
+	char[][] charFragments = CharOperation.splitOn('.', importActualName.toCharArray(), 0, importActualName.length());
 	int length = charFragments.length;
 	String[] strFragments = new String[length];
 	for (int i = 0; i < length; i++) {
diff --git a/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java b/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java
index 3276d05..d50df0c 100644
--- a/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java
+++ b/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java
@@ -285,4 +285,11 @@
 		return super.resourceExists();
 	}
 }
+protected void toStringAncestors(StringBuffer buffer) {
+	if (isExternal())
+		// don't show project as it is irrelevant for external jar files.
+		// also see https://bugs.eclipse.org/bugs/show_bug.cgi?id=146615
+		return;
+	super.toStringAncestors(buffer);
+}
 }
diff --git a/model/org/eclipse/jdt/internal/core/Region.java b/model/org/eclipse/jdt/internal/core/Region.java
index 626ca38..b35d79b 100644
--- a/model/org/eclipse/jdt/internal/core/Region.java
+++ b/model/org/eclipse/jdt/internal/core/Region.java
@@ -16,7 +16,6 @@
 import org.eclipse.jdt.core.IParent;
 import org.eclipse.jdt.core.IRegion;
 
-
 /**
  * @see IRegion
  */
@@ -110,7 +109,7 @@
  *
  * <p>Children are all children, not just direct children.
  */
-private void removeAllChildren(IJavaElement element) {
+protected void removeAllChildren(IJavaElement element) {
 	if (element instanceof IParent) {
 		ArrayList newRootElements = new ArrayList();
 		for (int i = 0, size = fRootElements.size(); i < size; i++) {
diff --git a/model/org/eclipse/jdt/internal/core/XMLWriter.java b/model/org/eclipse/jdt/internal/core/XMLWriter.java
index 9184fce..4761e52 100644
--- a/model/org/eclipse/jdt/internal/core/XMLWriter.java
+++ b/model/org/eclipse/jdt/internal/core/XMLWriter.java
@@ -11,8 +11,6 @@
 package org.eclipse.jdt.internal.core;
 import java.io.PrintWriter;
 import java.io.Writer;
-import java.util.Collections;
-import java.util.Enumeration;
 import java.util.HashMap;
 
 import org.eclipse.jdt.core.IJavaProject;
@@ -80,12 +78,15 @@
 		sb.append("<"); //$NON-NLS-1$
 		sb.append(name);
 		if (parameters != null) {
-			for (Enumeration en = Collections.enumeration(parameters.keySet()); en.hasMoreElements();) {
+			int length = parameters.size();
+			String[] keys = new String[length];
+			parameters.keySet().toArray(keys);
+			Util.sort(keys);
+			for (int i = 0; i < length; i++) {
 				sb.append(" "); //$NON-NLS-1$
-				String key= (String) en.nextElement();
-				sb.append(key);
+				sb.append(keys[i]);
 				sb.append("=\""); //$NON-NLS-1$
-				sb.append(getEscaped(String.valueOf(parameters.get(key))));
+				sb.append(getEscaped(String.valueOf(parameters.get(keys[i]))));
 				sb.append("\""); //$NON-NLS-1$
 			}
 		}
diff --git a/model/org/eclipse/jdt/internal/core/builder/BatchImageBuilder.java b/model/org/eclipse/jdt/internal/core/builder/BatchImageBuilder.java
index 2dcba30..c55de2f 100644
--- a/model/org/eclipse/jdt/internal/core/builder/BatchImageBuilder.java
+++ b/model/org/eclipse/jdt/internal/core/builder/BatchImageBuilder.java
@@ -14,6 +14,7 @@
 import org.eclipse.core.runtime.*;
 
 import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.compiler.*;
 import org.eclipse.jdt.internal.compiler.ClassFile;
 import org.eclipse.jdt.internal.core.util.Messages;
 import org.eclipse.jdt.internal.core.util.Util;
@@ -23,13 +24,15 @@
 public class BatchImageBuilder extends AbstractImageBuilder {
 
 	IncrementalImageBuilder incrementalBuilder; // if annotations or secondary types have to be processed after the compile loop
-	ArrayList missingSecondaryTypes; // qualified names for any secondary types found after the first compile loop
+	ArrayList secondaryTypes; // qualified names for all secondary types found during batch compile
+	StringSet typeLocatorsWithUndefinedTypes; // type locators for all source files with errors that may be caused by 'not found' secondary types
 
 protected BatchImageBuilder(JavaBuilder javaBuilder, boolean buildStarting) {
 	super(javaBuilder, buildStarting, null);
 	this.nameEnvironment.isIncrementalBuild = false;
 	this.incrementalBuilder = null;
-	this.missingSecondaryTypes = null;
+	this.secondaryTypes = null;
+	this.typeLocatorsWithUndefinedTypes = null;
 }
 
 public void build() {
@@ -55,8 +58,9 @@
 			workQueue.addAll(allSourceFiles);
 			compile(allSourceFiles);
 
-			if (this.missingSecondaryTypes != null && !this.missingSecondaryTypes.isEmpty())
-				rebuildTypesAffectedByMissingSecondaryTypes();
+			if (this.typeLocatorsWithUndefinedTypes != null)
+				if (this.secondaryTypes != null && !this.secondaryTypes.isEmpty())
+					rebuildTypesAffectedBySecondaryTypes();
 			if (this.incrementalBuilder != null)
 				this.incrementalBuilder.buildAfterBatchBuild();
 		}
@@ -71,8 +75,8 @@
 }
 
 protected void acceptSecondaryType(ClassFile classFile) {
-	if (this.missingSecondaryTypes != null)
-		this.missingSecondaryTypes.add(classFile.fileName());
+	if (this.secondaryTypes != null)
+		this.secondaryTypes.add(classFile.fileName());
 }
 
 protected void addAllSourceFiles(final ArrayList sourceFiles) throws CoreException {
@@ -81,29 +85,32 @@
 		final char[][] exclusionPatterns = sourceLocation.exclusionPatterns;
 		final char[][] inclusionPatterns = sourceLocation.inclusionPatterns;
 		final boolean isAlsoProject = sourceLocation.sourceFolder.equals(javaBuilder.currentProject);
+		final int segmentCount = sourceLocation.sourceFolder.getFullPath().segmentCount();
+		final IContainer outputFolder = sourceLocation.binaryFolder;
+		final boolean isOutputFolder = sourceLocation.sourceFolder.equals(outputFolder);
 		sourceLocation.sourceFolder.accept(
 			new IResourceProxyVisitor() {
 				public boolean visit(IResourceProxy proxy) throws CoreException {
-					IResource resource = null;
 					switch(proxy.getType()) {
 						case IResource.FILE :
-							if (exclusionPatterns != null || inclusionPatterns != null) {
-								resource = proxy.requestResource();
-								if (Util.isExcluded(resource, inclusionPatterns, exclusionPatterns)) return false;
-							}
 							if (org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(proxy.getName())) {
-								if (resource == null)
-									resource = proxy.requestResource();
+								IResource resource = proxy.requestResource();
+								if (exclusionPatterns != null || inclusionPatterns != null)
+									if (Util.isExcluded(resource, inclusionPatterns, exclusionPatterns)) return false;
 								sourceFiles.add(new SourceFile((IFile) resource, sourceLocation));
 							}
 							return false;
 						case IResource.FOLDER :
-							if (exclusionPatterns != null && inclusionPatterns == null) {
-								// if there are inclusion patterns then we must walk the children
-								resource = proxy.requestResource();
-								if (Util.isExcluded(resource, inclusionPatterns, exclusionPatterns)) return false;
+							if (exclusionPatterns != null && inclusionPatterns == null) // must walk children if inclusionPatterns != null
+								if (Util.isExcluded(proxy.requestResource(), inclusionPatterns, exclusionPatterns)) return false;
+							IPath folderPath = null;
+							if (isAlsoProject)
+								if (isExcludedFromProject(folderPath = proxy.requestFullPath())) return false;
+							if (!isOutputFolder) {
+								if (folderPath == null)
+									folderPath = proxy.requestFullPath();
+								createFolder(folderPath.removeFirstSegments(segmentCount), outputFolder);
 							}
-							if (isAlsoProject && isExcludedFromProject(proxy.requestFullPath())) return false;
 					}
 					return true;
 				}
@@ -162,34 +169,24 @@
 				sourceLocation.binaryFolder.accept(
 					new IResourceProxyVisitor() {
 						public boolean visit(IResourceProxy proxy) throws CoreException {
-							IResource resource = null;
 							if (proxy.getType() == IResource.FILE) {
-								if (exclusionPatterns != null || inclusionPatterns != null) {
-									resource = proxy.requestResource();
-									if (Util.isExcluded(resource, inclusionPatterns, exclusionPatterns)) return false;
-								}
 								if (org.eclipse.jdt.internal.compiler.util.Util.isClassFileName(proxy.getName())) {
-									if (resource == null)
-										resource = proxy.requestResource();
+									IResource resource = proxy.requestResource();
+									if (exclusionPatterns != null || inclusionPatterns != null)
+										if (Util.isExcluded(resource, inclusionPatterns, exclusionPatterns)) return false;
 									resource.delete(IResource.FORCE, null);
 								}
 								return false;
 							}
-							if (exclusionPatterns != null && inclusionPatterns == null) {
-								// if there are inclusion patterns then we must walk the children
-								resource = proxy.requestResource();
-								if (Util.isExcluded(resource, inclusionPatterns, exclusionPatterns)) return false;
-							}
+							if (exclusionPatterns != null && inclusionPatterns == null) // must walk children if inclusionPatterns != null
+								if (Util.isExcluded(proxy.requestResource(), inclusionPatterns, exclusionPatterns)) return false;
 							notifier.checkCancel();
 							return true;
 						}
 					},
 					IResource.NONE
 				);
-				if (!isOutputFolder && copyBack) {
-					notifier.checkCancel();
-					copyPackages(sourceLocation);
-				}
+				notifier.checkCancel();
 			}
 			notifier.checkCancel();
 		}
@@ -198,8 +195,6 @@
 			ClasspathMultiDirectory sourceLocation = sourceLocations[i];
 			if (sourceLocation.hasIndependentOutputFolder)
 				copyExtraResourcesBack(sourceLocation, false);
-			else if (!sourceLocation.sourceFolder.equals(sourceLocation.binaryFolder))
-				copyPackages(sourceLocation); // output folder is different from source folder
 			notifier.checkCancel();
 		}
 	}
@@ -207,13 +202,14 @@
 
 protected void cleanUp() {
 	this.incrementalBuilder = null;
-	this.missingSecondaryTypes = null;
+	this.secondaryTypes = null;
+	this.typeLocatorsWithUndefinedTypes = null;
 	super.cleanUp();
 }
 
 protected void compile(SourceFile[] units, SourceFile[] additionalUnits, boolean compilingFirstGroup) {
-	if (!compilingFirstGroup && this.missingSecondaryTypes == null)
-		this.missingSecondaryTypes = new ArrayList(7);
+	if (additionalUnits != null && this.secondaryTypes == null)
+		this.secondaryTypes = new ArrayList(7);
 	super.compile(units, additionalUnits, compilingFirstGroup);
 }
 
@@ -257,45 +253,16 @@
 							}
 							copiedResource.delete(IResource.FORCE, null); // last one wins
 						}
+						createFolder(partialPath.removeLastSegments(1), outputFolder); // ensure package folder exists
 						resource.copy(copiedResource.getFullPath(), IResource.FORCE | IResource.DERIVED, null);
 						Util.setReadOnly(copiedResource, false); // just in case the original was read only
 						return false;
 					case IResource.FOLDER :
 						resource = proxy.requestResource();
 						if (javaBuilder.filterExtraResource(resource)) return false;
-						IPath folderPath = resource.getFullPath();
-						if (isAlsoProject && isExcludedFromProject(folderPath)) return false; // the sourceFolder == project
-						if (exclusionPatterns != null && Util.isExcluded(resource, inclusionPatterns, exclusionPatterns))
-					        return inclusionPatterns != null; // need to go further only if inclusionPatterns are set
-						createFolder(folderPath.removeFirstSegments(segmentCount), outputFolder);
-				}
-				return true;
-			}
-		},
-		IResource.NONE
-	);
-}
-
-protected void copyPackages(ClasspathMultiDirectory sourceLocation) throws CoreException {
-	final int segmentCount = sourceLocation.sourceFolder.getFullPath().segmentCount();
-	final char[][] exclusionPatterns = sourceLocation.exclusionPatterns;
-	final char[][] inclusionPatterns = sourceLocation.inclusionPatterns;
-	final IContainer outputFolder = sourceLocation.binaryFolder;
-	final boolean isAlsoProject = sourceLocation.sourceFolder.equals(javaBuilder.currentProject);
-	sourceLocation.sourceFolder.accept(
-		new IResourceProxyVisitor() {
-			public boolean visit(IResourceProxy proxy) throws CoreException {
-				switch(proxy.getType()) {
-					case IResource.FILE :
-						return false;
-					case IResource.FOLDER :
-						IResource resource = proxy.requestResource();
-						if (javaBuilder.filterExtraResource(resource)) return false;
-						IPath folderPath = resource.getFullPath();
-						if (isAlsoProject && isExcludedFromProject(folderPath)) return false; // the sourceFolder == project
-						if (exclusionPatterns != null && Util.isExcluded(resource, inclusionPatterns, exclusionPatterns))
-					        return inclusionPatterns != null; // need to go further only if inclusionPatterns are set
-						createFolder(folderPath.removeFirstSegments(segmentCount), outputFolder);
+						if (isAlsoProject && isExcludedFromProject(resource.getFullPath())) return false; // the sourceFolder == project
+						if (exclusionPatterns != null && inclusionPatterns == null) // must walk children if inclusionPatterns != null
+							if (Util.isExcluded(resource, inclusionPatterns, exclusionPatterns)) return false;
 				}
 				return true;
 			}
@@ -323,14 +290,38 @@
 	this.incrementalBuilder.processAnnotationResults(results);
 }
 
-protected void rebuildTypesAffectedByMissingSecondaryTypes() {
+protected void rebuildTypesAffectedBySecondaryTypes() {
 	// to compile types that could not find 'missing' secondary types because of multiple
 	// compile groups, we need to incrementally recompile all affected types as if the missing
-	// secondary types have just been added
+	// secondary types have just been added, see bug 146324
 	if (this.incrementalBuilder == null)
 		this.incrementalBuilder = new IncrementalImageBuilder(this);
-	for (int i = this.missingSecondaryTypes.size(); --i >=0; )
-		this.incrementalBuilder.addAffectedSourceFiles((char[]) this.missingSecondaryTypes.get(i));
+
+	for (int i = this.secondaryTypes.size(); --i >=0;) {
+		char[] secondaryTypeName = (char[]) this.secondaryTypes.get(i);
+		IPath path = new Path(null, new String(secondaryTypeName));
+		this.incrementalBuilder.addDependentsOf(path, false);
+	}
+	this.incrementalBuilder.addAffectedSourceFiles(
+		this.incrementalBuilder.qualifiedStrings,
+		this.incrementalBuilder.simpleStrings,
+		this.typeLocatorsWithUndefinedTypes);
+}
+
+protected void storeProblemsFor(SourceFile sourceFile, CategorizedProblem[] problems) throws CoreException {
+	if (sourceFile == null || problems == null || problems.length == 0) return;
+
+	for (int i = problems.length; --i >= 0;) {
+		CategorizedProblem problem = problems[i];
+		if (problem != null && problem.getID() == IProblem.UndefinedType) {
+			if (this.typeLocatorsWithUndefinedTypes == null)
+				this.typeLocatorsWithUndefinedTypes = new StringSet(3);
+			this.typeLocatorsWithUndefinedTypes.add(sourceFile.typeLocator());
+			break;
+		}
+	}
+
+	super.storeProblemsFor(sourceFile, problems);
 }
 
 public String toString() {
diff --git a/model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java b/model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java
index 99b5e4f..4f907cf 100644
--- a/model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java
+++ b/model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java
@@ -168,24 +168,10 @@
 protected void addAffectedSourceFiles() {
 	if (qualifiedStrings.elementSize == 0 && simpleStrings.elementSize == 0) return;
 
-	addAffectedSourceFiles(qualifiedStrings, simpleStrings);
+	addAffectedSourceFiles(qualifiedStrings, simpleStrings, null);
 }
 
-protected void addAffectedSourceFiles(char[] secondaryTypeName) {
-	// the secondary type search can have too many false hits if we addAffectedSource files using all the qualified type names
-	// of each secondary type... so look for the dependents 1 file at a time
-	int index = CharOperation.lastIndexOf('/', secondaryTypeName);
-	String packageName = index == -1 ? "" : new String(CharOperation.subarray(secondaryTypeName, 0, index)); //$NON-NLS-1$
-	StringSet packageNames = new StringSet(1);
-	packageNames.add(packageName);
-	String typeName = new String(index == -1 ? secondaryTypeName : CharOperation.subarray(secondaryTypeName, index + 1, secondaryTypeName.length));
-	StringSet typeNames = new StringSet(1);
-	typeNames.add(typeName);
-
-	addAffectedSourceFiles(packageNames, typeNames);
-}
-
-private void addAffectedSourceFiles(StringSet qualifiedSet, StringSet simpleSet) {
+protected void addAffectedSourceFiles(StringSet qualifiedSet, StringSet simpleSet, StringSet affectedTypes) {
 	// the qualifiedStrings are of the form 'p1/p2' & the simpleStrings are just 'X'
 	char[][][] internedQualifiedNames = ReferenceCollection.internQualifiedNames(qualifiedSet);
 	// if a well known qualified name was found then we can skip over these
@@ -199,19 +185,22 @@
 	Object[] keyTable = newState.references.keyTable;
 	Object[] valueTable = newState.references.valueTable;
 	next : for (int i = 0, l = valueTable.length; i < l; i++) {
-		ReferenceCollection refs = (ReferenceCollection) valueTable[i];
-		if (refs != null && refs.includes(internedQualifiedNames, internedSimpleNames)) {
-			String typeLocator = (String) keyTable[i];
-			IFile file = javaBuilder.currentProject.getFile(typeLocator);
-			SourceFile sourceFile = findSourceFile(file);
-			if (sourceFile == null) continue next;
-			if (sourceFiles.contains(sourceFile)) continue next;
-			if (compiledAllAtOnce && previousSourceFiles != null && previousSourceFiles.contains(sourceFile))
-				continue next; // can skip previously compiled files since already saw hierarchy related problems
-
-			if (JavaBuilder.DEBUG)
-				System.out.println("  adding affected source file " + typeLocator); //$NON-NLS-1$
-			sourceFiles.add(sourceFile);
+		String typeLocator = (String) keyTable[i];
+		if (typeLocator != null) {
+			if (affectedTypes != null && !affectedTypes.includes(typeLocator)) continue next;
+			ReferenceCollection refs = (ReferenceCollection) valueTable[i];
+			if (refs.includes(internedQualifiedNames, internedSimpleNames)) {
+				IFile file = javaBuilder.currentProject.getFile(typeLocator);
+				SourceFile sourceFile = findSourceFile(file);
+				if (sourceFile == null) continue next;
+				if (sourceFiles.contains(sourceFile)) continue next;
+				if (compiledAllAtOnce && previousSourceFiles != null && previousSourceFiles.contains(sourceFile))
+					continue next; // can skip previously compiled files since already saw hierarchy related problems
+	
+				if (JavaBuilder.DEBUG)
+					System.out.println("  adding affected source file " + typeLocator); //$NON-NLS-1$
+				sourceFiles.add(sourceFile);
+			}
 		}
 	}
 }
@@ -276,6 +265,33 @@
 	this.compileLoop = 0;
 }
 
+protected void compile(SourceFile[] units, SourceFile[] additionalUnits, boolean compilingFirstGroup) {
+	if (compilingFirstGroup && additionalUnits != null) {
+		// add any source file from additionalUnits to units if it defines secondary types
+		// otherwise its possible during testing with MAX_AT_ONCE == 1 that a secondary type
+		// can cause an infinite loop as it alternates between not found and defined, see bug 146324
+		ArrayList extras = null;
+		for (int i = 0, l = additionalUnits.length; i < l; i++) {
+			SourceFile unit = additionalUnits[i];
+			if (unit != null && newState.getDefinedTypeNamesFor(unit.typeLocator()) != null) {
+				if (JavaBuilder.DEBUG)
+					System.out.println("About to compile file with secondary types "+ unit.typeLocator()); //$NON-NLS-1$
+				if (extras == null)
+					extras = new ArrayList(3);
+				extras.add(unit);
+			}
+		}
+		if (extras != null) {
+			int oldLength = units.length;
+			int toAdd = extras.size();
+			System.arraycopy(units, 0, units = new SourceFile[oldLength + toAdd], 0, oldLength);
+			for (int i = 0; i < toAdd; i++)
+				units[oldLength++] = (SourceFile) extras.get(i);
+		}
+	}
+	super.compile(units, additionalUnits, compilingFirstGroup);
+}
+
 protected void deleteGeneratedFiles(IFile[] deletedGeneratedFiles) {
 	// delete generated files and recompile any affected source files
 	try {
diff --git a/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java b/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java
index c59bc9e..7ca49ce 100644
--- a/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java
+++ b/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java
@@ -156,19 +156,6 @@
 private IType findSuperClass(IGenericType type, ReferenceBinding typeBinding) {
 	ReferenceBinding superBinding = typeBinding.superclass();
 	
-	// check if the super binding was replaced with the java.lang.Object binding (because of a visibility problem for example)
-	ClassScope scope;
-	if (typeBinding instanceof SourceTypeBinding && (scope = ((SourceTypeBinding) typeBinding).scope) != null) {
-		TypeDeclaration typeDeclaration = scope.referenceContext;
-		TypeReference superclassRef = typeDeclaration == null ? null : typeDeclaration.superclass;
-		TypeBinding superclass = superclassRef == null ? null : superclassRef.resolvedType;
-		if (superclass instanceof ProblemReferenceBinding) {
-			superclass = ((ProblemReferenceBinding) superclass).closestMatch;
-		}
-		if (superclass != null) 
-			((SourceTypeBinding) typeBinding).superclass = superBinding = (ReferenceBinding) superclass;
-	}
-	
 	if (superBinding != null) {
 		superBinding = (ReferenceBinding) superBinding.erasure();
 		if (superBinding.id == TypeIds.T_JavaLangObject && typeBinding.isHierarchyInconsistent()) {
@@ -246,31 +233,7 @@
 		return null;
 	}
 	
-	ReferenceBinding[] interfaceBindings = typeBinding.superInterfaces();
-	
-	// check if bindings were removed while resolving (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=136095)
-	ClassScope scope;
-	if (typeBinding instanceof SourceTypeBinding && (scope = ((SourceTypeBinding) typeBinding).scope) != null) {
-		TypeDeclaration typeDeclaration = scope.referenceContext;
-		TypeReference[] superInterfaces = typeDeclaration == null ? null : typeDeclaration.superInterfaces;
-		int length;
-		if (superInterfaces != null && (length = superInterfaces.length) > (interfaceBindings == null ? 0 : interfaceBindings.length)) { // check for interfaceBindings being null (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=139689)
-			
-			interfaceBindings = new ReferenceBinding[length];
-			int index = 0;
-			for (int i = 0; i < length; i++) {
-				ReferenceBinding superInterface = (ReferenceBinding) superInterfaces[i].resolvedType;
-				if (superInterface instanceof ProblemReferenceBinding)
-					superInterface = ((ProblemReferenceBinding) superInterface).closestMatch;
-				if (superInterface != null)
-					interfaceBindings[index++] = superInterface;
-			}
-			if (index < length)
-				System.arraycopy(interfaceBindings, 0, interfaceBindings = new ReferenceBinding[index], 0 , index);
-			((SourceTypeBinding) typeBinding).superInterfaces = interfaceBindings;
-		}
-	}
-	
+	ReferenceBinding[] interfaceBindings = typeBinding.superInterfaces();	
 	int bindingIndex = 0;
 	int bindingLength = interfaceBindings == null ? 0 : interfaceBindings.length;
 	int length = superInterfaceNames == null ? 0 : superInterfaceNames.length;
@@ -312,6 +275,59 @@
 		System.arraycopy(superinterfaces, 0, superinterfaces = new IType[index], 0, index);
 	return superinterfaces;
 }
+private void fixSupertypeBindings() {
+	for (int current = this.typeIndex; current >= 0; current--) {
+		ReferenceBinding typeBinding = this.typeBindings[current];
+	
+		
+		if (typeBinding instanceof SourceTypeBinding) {
+			ClassScope scope = ((SourceTypeBinding) typeBinding).scope;
+			if (scope != null) {
+				TypeDeclaration typeDeclaration = scope.referenceContext;
+				TypeReference superclassRef = typeDeclaration == null ? null : typeDeclaration.superclass;
+				TypeBinding superclass = superclassRef == null ? null : superclassRef.resolvedType;
+				if (superclass instanceof ProblemReferenceBinding) {
+					superclass = ((ProblemReferenceBinding) superclass).closestMatch;
+				}
+				if (superclass != null) 
+					((SourceTypeBinding) typeBinding).superclass = (ReferenceBinding) superclass;
+	
+				TypeReference[] superInterfaces = typeDeclaration == null ? null : typeDeclaration.superInterfaces;
+				int length;
+				ReferenceBinding[] interfaceBindings = typeBinding.superInterfaces();
+				if (superInterfaces != null && (length = superInterfaces.length) > (interfaceBindings == null ? 0 : interfaceBindings.length)) { // check for interfaceBindings being null (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=139689)
+					interfaceBindings = new ReferenceBinding[length];
+					int index = 0;
+					for (int i = 0; i < length; i++) {
+						ReferenceBinding superInterface = (ReferenceBinding) superInterfaces[i].resolvedType;
+						if (superInterface instanceof ProblemReferenceBinding)
+							superInterface = ((ProblemReferenceBinding) superInterface).closestMatch;
+						if (superInterface != null)
+							interfaceBindings[index++] = superInterface;
+					}
+					if (index < length)
+						System.arraycopy(interfaceBindings, 0, interfaceBindings = new ReferenceBinding[index], 0 , index);
+					((SourceTypeBinding) typeBinding).superInterfaces = interfaceBindings;
+				}
+			}		
+		} else if (typeBinding instanceof BinaryTypeBinding) {
+			try {
+				typeBinding.superclass();
+			} catch (AbortCompilation e) {
+				// allow subsequent call to superclass() to succeed so that we don't have to catch AbortCompilation everywhere
+				((BinaryTypeBinding) typeBinding).tagBits &= ~TagBits.HasUnresolvedSuperclass;
+				this.builder.hierarchy.missingTypes.add(new String(typeBinding.superclass().sourceName()));
+				this.hasMissingSuperClass = true;
+			}
+			try {
+				typeBinding.superInterfaces();
+			} catch (AbortCompilation e) {
+				// allow subsequent call to superInterfaces() to succeed so that we don't have to catch AbortCompilation everywhere
+				((BinaryTypeBinding) typeBinding).tagBits &= ~TagBits.HasUnresolvedSuperinterfaces;
+			}
+		}
+	}	
+}
 private void remember(IGenericType suppliedType, ReferenceBinding typeBinding) {
 	if (typeBinding == null) return;
 	
@@ -437,6 +453,9 @@
 		}
 	}
 	
+	// be resilient and fix super type bindings
+	fixSupertypeBindings();
+	
 	int objectIndex = -1;
 	for (int current = this.typeIndex; current >= 0; current--) {
 		ReferenceBinding typeBinding = this.typeBindings[current];
diff --git a/model/org/eclipse/jdt/internal/core/hierarchy/RegionBasedTypeHierarchy.java b/model/org/eclipse/jdt/internal/core/hierarchy/RegionBasedTypeHierarchy.java
index f9ae011..fd02988 100644
--- a/model/org/eclipse/jdt/internal/core/hierarchy/RegionBasedTypeHierarchy.java
+++ b/model/org/eclipse/jdt/internal/core/hierarchy/RegionBasedTypeHierarchy.java
@@ -14,17 +14,11 @@
 
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaElementDelta;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IOpenable;
-import org.eclipse.jdt.core.IRegion;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
 import org.eclipse.jdt.core.search.IJavaSearchScope;
 import org.eclipse.jdt.internal.core.CompilationUnit;
 import org.eclipse.jdt.internal.core.JavaElement;
 import org.eclipse.jdt.internal.core.Openable;
+import org.eclipse.jdt.internal.core.Region;
 import org.eclipse.jdt.internal.core.TypeVector;
 
 public class RegionBasedTypeHierarchy extends TypeHierarchy {
@@ -42,8 +36,37 @@
  */
 public RegionBasedTypeHierarchy(IRegion region, ICompilationUnit[] workingCopies, IType type, boolean computeSubtypes) {
 	super(type, workingCopies, (IJavaSearchScope)null, computeSubtypes);
-	this.region = region;
+	
+	Region newRegion = new Region() {
+		public void add(IJavaElement element) {
+			if (!contains(element)) {
+				//"new" element added to region
+				removeAllChildren(element);
+				fRootElements.add(element);
+				if (element.getElementType() == IJavaElement.JAVA_PROJECT) {
+					// add jar roots as well so that jars don't rely on their parent to know 
+					// if they are contained in the region
+					// (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=146615)
+					try {
+						IPackageFragmentRoot[] roots = ((IJavaProject) element).getPackageFragmentRoots();
+						for (int i = 0, length = roots.length; i < length; i++) {
+							if (roots[i].isArchive() && !fRootElements.contains(roots[i]))
+								fRootElements.add(roots[i]);
+						}
+					} catch (JavaModelException e) {
+						// project doesn't exist
+					}
+				}
+				fRootElements.trimToSize();
+			}
+		}
+	};
 	IJavaElement[] elements = region.getElements();
+	for (int i = 0, length = elements.length; i < length; i++) {
+		newRegion.add(elements[i]);
+		
+	}
+	this.region = newRegion;
 	if (elements.length > 0)
 		this.project = elements[0].getJavaProject();
 }
diff --git a/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java b/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java
index 30db5d1..ba08bab 100644
--- a/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java
+++ b/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java
@@ -1471,17 +1471,16 @@
 			toString(buffer, this.focusType, 1, false);
 		} else {
 			buffer.append("Sub types of root classes:\n"); //$NON-NLS-1$
-			IType[] roots= getRootClasses();
+			IJavaElement[] roots = Util.sortCopy(getRootClasses());
 			for (int i= 0; i < roots.length; i++) {
-				toString(buffer, roots[i], 1, false);
+				toString(buffer, (IType) roots[i], 1, false);
 			}
 		}
 		if (this.rootClasses.size > 1) {
 			buffer.append("Root classes:\n"); //$NON-NLS-1$
-			IType[] roots = this.getRootClasses();
+			IJavaElement[] roots = Util.sortCopy(getRootClasses());
 			for (int i = 0, length = roots.length; i < length; i++) {
-				IType type = roots[i];
-				toString(buffer, type, 1, false);
+				toString(buffer, (IType) roots[i], 1, false);
 			}
 		} else if (this.rootClasses.size == 0) {
 			// see http://bugs.eclipse.org/bugs/show_bug.cgi?id=24691
@@ -1499,11 +1498,12 @@
  */
 private void toString(StringBuffer buffer, IType type, int indent, boolean ascendant) {
 	IType[] types= ascendant ? getSupertypes(type) : getSubtypes(type);
-	for (int i= 0; i < types.length; i++) {
+	IJavaElement[] sortedTypes = Util.sortCopy(types);
+	for (int i= 0; i < sortedTypes.length; i++) {
 		for (int j= 0; j < indent; j++) {
 			buffer.append("  "); //$NON-NLS-1$
 		}
-		JavaElement element = (JavaElement)types[i];
+		JavaElement element = (JavaElement)sortedTypes[i];
 		buffer.append(element.toStringWithAncestors(false/*don't show key*/));
 		buffer.append('\n');
 		toString(buffer, types[i], indent + 1, ascendant);
diff --git a/model/org/eclipse/jdt/internal/core/util/ResourceCompilationUnit.java b/model/org/eclipse/jdt/internal/core/util/ResourceCompilationUnit.java
index 6cf2f14..0e55fff 100644
--- a/model/org/eclipse/jdt/internal/core/util/ResourceCompilationUnit.java
+++ b/model/org/eclipse/jdt/internal/core/util/ResourceCompilationUnit.java
@@ -25,7 +25,7 @@
 	private IFile file;
 	
 	public ResourceCompilationUnit(IFile file, URI location) {
-		super(null/*no contents*/, location == null ? file.getFullPath().toString() : location.getSchemeSpecificPart(), null/*encoding is used only when retrieving the contents*/);
+		super(null/*no contents*/, location == null ? file.getFullPath().toString() : location.getPath(), null/*encoding is used only when retrieving the contents*/);
 		this.file = file;
 	}
 
diff --git a/model/org/eclipse/jdt/internal/core/util/Util.java b/model/org/eclipse/jdt/internal/core/util/Util.java
index 57dcdf6..b8c0098 100644
--- a/model/org/eclipse/jdt/internal/core/util/Util.java
+++ b/model/org/eclipse/jdt/internal/core/util/Util.java
@@ -45,6 +45,7 @@
 import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
 import org.eclipse.jdt.internal.compiler.parser.ScannerHelper;
 import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
+import org.eclipse.jdt.internal.core.JavaElement;
 import org.eclipse.jdt.internal.core.JavaModelManager;
 import org.eclipse.jdt.internal.core.PackageFragmentRoot;
 import org.eclipse.jface.text.BadLocationException;
@@ -1950,6 +1951,23 @@
 	}
 
 	/**
+	 * Sorts an array of Java elements based on their toStringWithAncestors(), 
+	 * returning a new array with the sorted items. 
+	 * The original array is left untouched.
+	 */
+	public static IJavaElement[] sortCopy(IJavaElement[] elements) {
+		int len = elements.length;
+		IJavaElement[] copy = new IJavaElement[len];
+		System.arraycopy(elements, 0, copy, 0, len);
+		sort(copy, new Comparer() {
+			public int compare(Object a, Object b) {
+				return ((JavaElement) a).toStringWithAncestors().compareTo(((JavaElement) b).toStringWithAncestors());
+			}
+		});
+		return copy;
+	}
+	
+	/**
 	 * Sorts an array of Strings, returning a new array
 	 * with the sorted items.  The original array is left untouched.
 	 */
diff --git a/schema/compilationParticipant.exsd b/schema/compilationParticipant.exsd
index 2627a62..b786852 100644
--- a/schema/compilationParticipant.exsd
+++ b/schema/compilationParticipant.exsd
@@ -58,6 +58,9 @@
                <documentation>
                   the class that implements this compilation participant. This class must implement a public subclass of &lt;code&gt;org.eclipse.jdt.core.compiler.CompilationParticipant&lt;/code&gt; with a public 0-argument constructor.
                </documentation>
+               <appInfo>
+                  <meta.attribute kind="java" basedOn="org.eclipse.jdt.core.compiler.CompilationParticipant"/>
+               </appInfo>
             </annotation>
          </attribute>
          <attribute name="id" type="string" use="required">
@@ -139,7 +142,19 @@
          <meta.section type="examples"/>
       </appInfo>
       <documentation>
-         [Enter extension point usage example here.]
+         Example of a declaration of a &lt;code&gt;compilationParticipant&lt;/code&gt;:  &lt;pre&gt;                                                                       
+&lt;extension
+      id=&quot;apt&quot;
+      name=&quot;%annotationProcessingName&quot;
+      point=&quot;org.eclipse.jdt.core.compilationParticipant&quot;&gt;
+   &lt;compilationParticipant
+         class=&quot;org.eclipse.jdt.apt.core.internal.AptCompilationParticipant&quot;
+         id=&quot;APT&quot;
+         requiredSourceLevel=&quot;1.5&quot;&gt;
+      &lt;managedMarker markerType=&quot;org.eclipse.jdt.apt.core.compile.problem&quot;/&gt;
+   &lt;/compilationParticipant&gt;
+&lt;/extension&gt;
+&lt;/pre&gt;
       </documentation>
    </annotation>
 
@@ -148,7 +163,7 @@
          <meta.section type="apiInfo"/>
       </appInfo>
       <documentation>
-         [Enter API information here.]
+         
       </documentation>
    </annotation>
 
@@ -157,7 +172,7 @@
          <meta.section type="implementation"/>
       </appInfo>
       <documentation>
-         [Enter information about supplied implementation of this extension point.]
+         
       </documentation>
    </annotation>
 
@@ -166,7 +181,7 @@
          <meta.section type="copyright"/>
       </appInfo>
       <documentation>
-         Copyright (c) 2005 BEA Systems, Inc and others.&lt;br&gt;
+         Copyright (c) 2006 BEA Systems, Inc and others.&lt;br&gt;
 All rights reserved. This program and the accompanying materials
 are made available under the terms of the Eclipse Public License v1.0
 which accompanies this distribution, and is available at 
diff --git a/scripts/META-INF/MANIFEST.MF b/scripts/META-INF/MANIFEST.MF
index 76b3b78..d94d17f 100644
--- a/scripts/META-INF/MANIFEST.MF
+++ b/scripts/META-INF/MANIFEST.MF
@@ -9,17 +9,17 @@
 Bundle-Localization: plugin
 Export-Package: org.eclipse.jdt.core,
  org.eclipse.jdt.core.compiler,
- org.eclipse.jdt.internal.antadapter;x-friends:="org.eclipse.jdt.core",
- org.eclipse.jdt.internal.compiler;x-friends:="org.eclipse.jdt.core",
- org.eclipse.jdt.internal.compiler.ast;x-friends:="org.eclipse.jdt.core",
- org.eclipse.jdt.internal.compiler.batch;x-friends:="org.eclipse.jdt.core",
- org.eclipse.jdt.internal.compiler.classfmt;x-friends:="org.eclipse.jdt.core",
- org.eclipse.jdt.internal.compiler.codegen;x-friends:="org.eclipse.jdt.core",
- org.eclipse.jdt.internal.compiler.env;x-friends:="org.eclipse.jdt.core",
- org.eclipse.jdt.internal.compiler.flow;x-friends:="org.eclipse.jdt.core",
- org.eclipse.jdt.internal.compiler.impl;x-friends:="org.eclipse.jdt.core",
- org.eclipse.jdt.internal.compiler.lookup;x-friends:="org.eclipse.jdt.core",
- org.eclipse.jdt.internal.compiler.parser;x-friends:="org.eclipse.jdt.core",
- org.eclipse.jdt.internal.compiler.parser.diagnose;x-friends:="org.eclipse.jdt.core",
- org.eclipse.jdt.internal.compiler.problem;x-friends:="org.eclipse.jdt.core",
- org.eclipse.jdt.internal.compiler.util;x-friends:="org.eclipse.jdt.core"
+ org.eclipse.jdt.internal.antadapter;x-internal:=true,
+ org.eclipse.jdt.internal.compiler;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.ast;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.batch;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.classfmt;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.codegen;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.env;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.flow;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.impl;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.lookup;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.parser;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.parser.diagnose;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.problem;x-internal:=true,
+ org.eclipse.jdt.internal.compiler.util;x-internal:=true
diff --git a/scripts/exportplugin.xml b/scripts/exportplugin.xml
index 579070b..0a921e4 100644
--- a/scripts/exportplugin.xml
+++ b/scripts/exportplugin.xml
@@ -1,15 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!-- build script to create a plugin from ${plugin} -->
-<project name="${plugin}" default="export plug-in [_3.2.100]" basedir="..">
-
-<target name="export plug-in [_3.2.100]">
-    <tstamp/>
-	<property name="qualifier" value="z${DSTAMP}-${TSTAMP}" />
-	<antcall target="zz_internal_export">
-		<param name="jdt_core_version" value="3.2.100"/>
-	</antcall>
-</target>
+<project name="${plugin}" default="export plug-in [_3.2.1]" basedir="..">
 
 <target name="export plug-in [_3.2.1]">
     <tstamp/>
@@ -18,6 +10,20 @@
 		<param name="jdt_core_version" value="3.2.1"/>
 	</antcall>
 </target>
+<target name="export plug-in [_3.2.1.qualifier] (with sources)">
+    <tstamp/>
+	<property name="qualifier" value="${DSTAMP}-${TSTAMP}" />
+	<antcall target="zz_internal_export_structure">
+		<param name="jdt_core_version" value="3.2.1.${qualifier}"/>
+	</antcall>
+</target>
+<target name="export plug-in [_3.2.1.qualifier]">
+    <tstamp/>
+	<property name="qualifier" value="z${DSTAMP}-${TSTAMP}" />
+	<antcall target="zz_internal_export">
+		<param name="jdt_core_version" value="3.2.1.${qualifier}"/>
+	</antcall>
+</target>
 
 <target name="export plug-in [_3.2.0]">
     <tstamp/>
@@ -26,20 +32,6 @@
 		<param name="jdt_core_version" value="3.2.0"/>
 	</antcall>
 </target>
-<target name="export plug-in [_3.2.0.qualifier] (with sources)">
-    <tstamp/>
-	<property name="qualifier" value="${DSTAMP}-${TSTAMP}" />
-	<antcall target="zz_internal_export_structure">
-		<param name="jdt_core_version" value="3.2.0.${qualifier}"/>
-	</antcall>
-</target>
-<target name="export plug-in [_3.2.0.qualifier]">
-    <tstamp/>
-	<property name="qualifier" value="z${DSTAMP}-${TSTAMP}" />
-	<antcall target="zz_internal_export">
-		<param name="jdt_core_version" value="3.2.0.${qualifier}"/>
-	</antcall>
-</target>
 
 <target name="export plug-in [_3.1.0]">
 	<antcall target="zz_internal_export">
diff --git a/search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java b/search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java
index 0afb506..a260337 100644
--- a/search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java
+++ b/search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java
@@ -319,20 +319,7 @@
 		}
 		return this.parser;
 	}
-	
-	/*
-	 * Returns the underlying resource of the given element.
-	 */
-	private IResource getResource(IJavaElement element) {
-		if (element instanceof IMember) {
-			ICompilationUnit cu = ((IMember)element).getCompilationUnit();
-			if (cu != null) {
-				return cu.getResource();
-			} 
-		} 
-		return element.getResource();
-	}
-	
+
 	/*
 	 * Returns the list of working copies used by this search engine.
 	 * Returns null if none.
@@ -1091,7 +1078,18 @@
 			Util.verbose("	- java element: "+enclosingElement); //$NON-NLS-1$
 		}
 		IJavaSearchScope scope = createJavaSearchScope(new IJavaElement[] {enclosingElement});
-		IResource resource = this.getResource(enclosingElement);
+		IResource resource = enclosingElement.getResource();
+		if (enclosingElement instanceof IMember) {
+			IMember member = (IMember) enclosingElement;
+			ICompilationUnit cu = member.getCompilationUnit();
+			if (cu != null) {
+				resource = cu.getResource();
+			} else if (member.isBinary()) {
+				// binary member resource cannot be used as this
+				// see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=148215
+				resource = null;
+			}
+		}
 		try {
 			if (resource instanceof IFile) {
 				try {