Bug 416776 - [compiler] callout inference from interface fails during
incremental build
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/CalloutMappingDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/CalloutMappingDeclaration.java
index 9c8c0e9..ad4a3b4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/CalloutMappingDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/ast/CalloutMappingDeclaration.java
@@ -31,6 +31,7 @@
 import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
 import org.eclipse.jdt.internal.compiler.lookup.TagBits;
 import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
+import org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding;
 import org.eclipse.objectteams.otdt.core.compiler.IOTConstants;
 import org.eclipse.objectteams.otdt.internal.core.compiler.control.Config;
 import org.eclipse.objectteams.otdt.internal.core.compiler.control.Dependencies;
@@ -111,6 +112,8 @@
 				Config oldConfig = Config.createOrResetConfig(this);
 				try {
 					TypeBinding roleParam = roleParams[j];
+					if (roleParam instanceof UnresolvedReferenceBinding)
+						roleParam = ((UnresolvedReferenceBinding) roleParam).resolve(this.scope.environment(), false);
 					TypeBinding roleParamLeaf = roleParam.leafComponentType();
 					TypeBinding roleBaseLeaf = null;
 					if (   roleParamLeaf instanceof ReferenceBinding
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutMethodBinding.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutMethodBinding.java
index bec38e7..4e8f186 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutMethodBinding.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutMethodBinding.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[] { "test3113_calloutToStatic"};
+//		TESTS_NAMES = new String[] { "test3117_inferredCallout13"};
 //		TESTS_NUMBERS = new int[] { 1459 };
 //		TESTS_RANGE = new int[] { 1097, -1 };
 	}
@@ -2993,6 +2993,76 @@
             null/*no custom requestor*/);
     }
 
+    // Bug 416776 - [compiler] callout inference from interface fails during incremental build
+    public void test3117_inferredCallout13() {
+       Map customOptions = getCompilerOptions();
+       customOptions.put(CompilerOptions.OPTION_ReportInferredCallout, CompilerOptions.WARNING);
+       
+       runConformTest(
+            new String[] {
+		"b/IBase.java",
+			    "\n" +
+			    "package b;\n" + 
+			    "\n" + 
+			    "public interface IBase {\n" + 
+			    "\n" + 
+			    "	void setS(String s);\n" + 
+			    "\n" +
+			    "	void setL(java.util.List<String> l);\n" + 
+			    "}\n",
+		"b/BaseClass.java",
+			    "package b;\n" + 
+			    "\n" + 
+			    "public class BaseClass implements IBase {\n" + 
+			    "\n" + 
+			    "	String s;\n" + 
+			    "	java.util.List<String> l;\n" + 
+			    "\n" + 
+			    "	public void setS(String s) {\n" + 
+			    "		this.s = s;\n" + 
+			    "	}\n" + 
+			    "\n" + 
+			    "	public void setL(java.util.List<String> l) {\n" + 
+			    "		this.l = l;\n" + 
+			    "	}\n" + 
+			    "}\n" + 
+			    "\n"
+            },
+            "",
+            null/*classLibraries*/,
+            true/*shouldFlushOutputDirectory*/,
+            null/*vmArguments*/,
+            customOptions,
+            null/*no custom requestor*/);
+       runConformTest(
+               new String[] {
+		"t/Team3117ic13.java",
+			    "package t;\n" + 
+			    "\n" + 
+			    "import b.IBase;\n" + 
+			    "\n" + 
+			    "import base b.BaseClass;\n" + 
+			    "\n" + 
+			    "/**\n" + 
+			    " * @author stephan\n" + 
+			    " *\n" + 
+			    " */\n" + 
+			    "public team class Team3117ic13 {\n" + 
+			    "\n" + 
+			    "	@SuppressWarnings(\"inferredcallout\")\n" + 
+			    "	protected class Role1 implements IBase playedBy BaseClass {\n" + 
+			    "		String extra;\n" + 
+			    "	}\n" + 
+			    "}\n"
+            },
+            "",
+            null/*classLibraries*/,
+            false/*shouldFlushOutputDirectory*/,
+            null/*vmArguments*/,
+            customOptions,
+            null/*no custom requestor*/);
+    }
+
     // a short callout binding lacks a rhs
     // 3.1.18-otjld-incomplete-callout-binding-1
     public void test3118_incompleteCalloutBinding1() {