Bug 394263 - Team with generic type parameter causes role inheritance
error
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/copyinheritance/TypeLevel.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/copyinheritance/TypeLevel.java
index 042c4eb..8b11272 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/copyinheritance/TypeLevel.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/statemachine/copyinheritance/TypeLevel.java
@@ -387,7 +387,7 @@
 			&& newSuperclass.isDirectRole())
 		{
 		    // check team compatibility
-		    if (!TeamModel.areCompatibleEnclosings(destTeam, newSuperclass.enclosingType()))
+		    if (!TeamModel.areCompatibleEnclosings(destTeam, newSuperclass.original().enclosingType()))
 		    {
 		        destScope.problemReporter().extendIncompatibleEnclosingTypes(
 		        		destRoleDecl, newSuperclass, newSuperclass.enclosingType());
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/util/Protections.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/util/Protections.java
index ffc1867..b9872c5 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/util/Protections.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/util/Protections.java
@@ -245,7 +245,7 @@
         		enclosing = enclosing.enclosingType();
         	}
         }
-        ReferenceBinding otherEnclosing = other.enclosingType();
+        ReferenceBinding otherEnclosing = other.original().enclosingType();
         if (otherEnclosing == null)
             return true;
         ReferenceBinding thisEnclosing = binding.enclosingType();
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/other/Java5.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/other/Java5.java
index 05586c5..45141bd 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/other/Java5.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/other/Java5.java
@@ -34,7 +34,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[] { "testA112_genericTeam3"};
+//		TESTS_NAMES = new String[] { "testA112_genericTeam4"};
 //		TESTS_NUMBERS = new int[] { 1459 };
 //		TESTS_RANGE = new int[] { 1097, -1 };
 	}
@@ -3122,6 +3122,19 @@
     		"----------\n",
     		"OK");
     }
+    
+    // Bug 394263 - Team with generic type parameter causes role inheritance error 
+    public void testA112_genericTeam4() {
+    	runConformTest(
+    		new String[] {
+    	"MyTeam.java",
+    			"public team class MyTeam<T> {	\n" + 
+    			"	protected class MyRole {}	\n" + 
+    			"	protected class MySubRole extends MyRole {}\n" + 
+    			"}"
+    		}
+    	);
+    }
 
     // a static method in a role file suppresses an nls warning
     // Bug 321352 -  [compiler][reconciler] reporting of non-externalized string constants in role files 
@@ -5195,4 +5208,6 @@
 			"}\n"
     		});
     }
+    
+
 }