Bug 416921 - abort() causes NPE in
ClassScope.checkParameterizedSuperTypeCollisions 
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
index 0bf7a85..b8b2124 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
@@ -339,6 +339,8 @@
 	/** copy inheritence without an overriding source role in the current team? */
 	public boolean isPurelyCopied = false;
 
+	public boolean willCatchAbort = false;
+
 	public final boolean isTeam() {
 		return (this.modifiers & AccTeam) != 0;
 	}
@@ -404,15 +406,17 @@
  */
 public void abort(int abortLevel, CategorizedProblem problem) {
 //{ObjectTeams: also mark in the state that we're done:
-	switch (abortLevel) {
-		case AbortCompilation :
-		case AbortCompilationUnit :
-			StateHelper.setStateRecursive(this.scope.referenceCompilationUnit(), ITranslationStates.STATE_FINAL, false);
-			break;
-		case AbortMethod:
-			break;
-		default :
-			StateHelper.setStateRecursive(this, ITranslationStates.STATE_FINAL, false);
+	if (!this.willCatchAbort) { // only on exceptions that will actually fly
+		switch (abortLevel) {
+			case AbortCompilation :
+			case AbortCompilationUnit :
+				StateHelper.setStateRecursive(this.scope.referenceCompilationUnit(), ITranslationStates.STATE_FINAL, false);
+				break;
+			case AbortMethod:
+				break;
+			default :
+				StateHelper.setStateRecursive(this, ITranslationStates.STATE_FINAL, false);
+		}
 	}
 // SH}
 	switch (abortLevel) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
index e3235b0..1a41897 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
@@ -230,6 +230,15 @@
 		this.typeRequestor.accept(answer.getBinaryType(), packageBinding, answer.getAccessRestriction());
 	} else if (answer.isCompilationUnit()) {
 		// the type was found as a .java file, try to build it then search the cache
+//{ObjectTeams: prevent marking type as STATE_FINAL in case of caught abort()
+		boolean prevFlag = false;
+		TypeDeclaration typeDeclaration = null;
+		if (this.problemReporter.referenceContext instanceof TypeDeclaration) {
+			typeDeclaration = (TypeDeclaration)this.problemReporter.referenceContext;
+			prevFlag = typeDeclaration.willCatchAbort;
+			typeDeclaration.willCatchAbort = true;
+		} 
+// SH}
 		try {
 			this.typeRequestor.accept(answer.getCompilationUnit(), answer.getAccessRestriction());
 		} catch (AbortCompilation abort) {
@@ -237,6 +246,12 @@
 				return null; // silently, requestor may not be able to handle compilation units (HierarchyResolver)
 			throw abort;
 		}
+//{ObjectTeams: reset
+		finally {
+			if (typeDeclaration != null)
+				typeDeclaration.willCatchAbort = prevFlag;
+		}
+//SH}
 	} else if (answer.isSourceType()) {
 		// the type was found as a source model
 		this.typeRequestor.accept(answer.getSourceTypes(), packageBinding, answer.getAccessRestriction());