Bug 411450 - [compiler] base class reference with qualified team anchor
causes bogus error from synthetic code
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 08976f6..2214940 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
@@ -1196,7 +1196,7 @@
 				if (teamAnchor != null) {
 					if (!(cachedType instanceof DependentTypeBinding))
 						continue nextCachedType;
-					if (((DependentTypeBinding)cachedType)._teamAnchor != teamAnchor)
+					if (!((DependentTypeBinding)cachedType)._teamAnchor.hasSameBestNameAs(teamAnchor))
 						continue nextCachedType;
 				}
 				if (   valueParamPosition > -1 							// position specified, requires dependent type
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 51957e6..33ef20c 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[] { "testBug411449" };
+//		TESTS_NAMES = new String[] { "testBug411450" };
 //		TESTS_NUMBERS = new int[] { 1459 };
 //		TESTS_RANGE = new int[] { 1097, -1 };
 	}
@@ -3782,4 +3782,26 @@
     			"}\n"
     		});
     }
+    
+    public void testBug411450() {
+    	runConformTest(
+    		new String[] {
+    			"T0.java",
+    			"public team class T0 {\n" + 
+    			"	final Inner inner = new Inner();\n" + 
+    			"	\n" + 
+    			"	public team class Inner {\n" + 
+    			"		protected class R {}\n" + 
+    			"	}\n" + 
+    			"}",
+    			"T1.java",
+    			"public team class T1 {\n" + 
+    			"	final T0 other = new T0();\n" + 
+    			"	\n" + 
+    			"	protected class R1 playedBy R<@other.inner> {\n" + 
+    			"		\n" + 
+    			"	}\n" + 
+    			"}"
+    		});
+    }
 }