document background info behind previous commit.
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
index 60d8a8e..d9483ed 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
@@ -844,7 +844,9 @@
 	setDepth(firstDepth);
 	type = (this.otherBindings[otherBindingsLength - 1]).type;
 //{ObjectTeams: resolve with anchor path:
-	if (!scope.isGeneratedScope() || CharOperation.equals(IOTConstants._OT_BASE, this.tokens[0])) {
+	if (   !scope.isGeneratedScope() 									// wrapping types breaks cast methods for nested roles (see http://trac.objectteams.org/ot/changeset/5348)
+		|| CharOperation.equals(IOTConstants._OT_BASE, this.tokens[0])) // direct callout-set-to-field needs wrapping (see test3317_multipleCalloutToSameField2)
+	{
 		final BlockScope theScope = scope; 
 		type = RoleTypeCreator.deepSubstitute(type, scope.environment(), 
 			new IDependentTypeSubstitution() {