Bug 411449 - [compiler] cannot assign final field of role type in
constructor
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
index 9389539..f4522b4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
@@ -262,6 +262,9 @@
 			// if calling 'this(...)', then flag all non-static fields as definitely
 			// set since they are supposed to be set inside other local constructor
 			if (this.constructorCall.accessMode == ExplicitConstructorCall.This) {
+//{ObjectTeams: calls to copied super ctors are not relevant here:
+			  if (!TSuperHelper.isTSuper(this.constructorCall.binding)) {
+// orig:
 				FieldBinding[] fields = this.binding.declaringClass.fields();
 				for (int i = 0, count = fields.length; i < count; i++) {
 					FieldBinding field;
@@ -269,6 +272,9 @@
 						flowInfo.markAsDefinitelyAssigned(field);
 					}
 				}
+// :giro
+			  }
+// SH}
 			}
 			flowInfo = this.constructorCall.analyseCode(this.scope, constructorContext, flowInfo);
 		}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/util/TSuperHelper.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/util/TSuperHelper.java
index 070021d..c85ec63 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/util/TSuperHelper.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/util/TSuperHelper.java
@@ -1,7 +1,7 @@
 /**********************************************************************
  * This file is part of "Object Teams Development Tooling"-Software
  *
- * Copyright 2004, 2006 Fraunhofer Gesellschaft, Munich, Germany,
+ * Copyright 2004, 2013 Fraunhofer Gesellschaft, Munich, Germany,
  * for its Fraunhofer Institute for Computer Architecture and Software
  * Technology (FIRST), Berlin, Germany and Technical University Berlin,
  * Germany.
@@ -150,6 +150,7 @@
 	 * @return the answer
 	 */
 	public static boolean isTSuper(MethodBinding method) {
+		if (method == null) return false;
 	    TypeBinding[] params = method.parameters;
 	    if (params.length > 0) {
 	        TypeBinding lastParam = params[params.length-1];
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/TeamNesting.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/TeamNesting.java
index a719ed2..51957e6 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/TeamNesting.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/rolesandteams/TeamNesting.java
@@ -28,7 +28,7 @@
 	// Static initializer to specify tests subset using TESTS_* static variables
 	// All specified tests which does not belong to the class are skipped...
 	static {
-//		TESTS_NAMES = new String[] { "test1115_nestedTeamExtendsRegularTeam1", "test1122_layeredTeams1"};
+//		TESTS_NAMES = new String[] { "testBug411449" };
 //		TESTS_NUMBERS = new int[] { 1459 };
 //		TESTS_RANGE = new int[] { 1097, -1 };
 	}
@@ -3768,4 +3768,18 @@
             },
             "1.2.2(e)");
     }
+
+    public void testBug411449() {
+    	runConformTest(
+    		new String[] {
+    			"X.java",
+    			"public team class X {\n" +
+    			"	final R r;\n" +
+    			"	public X(R r) {\n" +
+    			"		this.r = r;\n" +
+    			"	}\n" +
+    			"	protected class R {}\n" +
+    			"}\n"
+    		});
+    }
 }