Test & fix for Bug 355315 - callout inferred to implement protected method causes IllegalAccessError
The patch also contains a correction for the test case from bug 355314 (make class names unique).
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/core/compiler/InferenceKind.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/core/compiler/InferenceKind.java
index 3f8e731..f5bc683 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/core/compiler/InferenceKind.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/core/compiler/InferenceKind.java
@@ -32,5 +32,15 @@
 	/** Callout inferred from a reading field access (via 'this'). */
 	FIELDGET, 
 	/** Callout inferred from a writing field access (via 'this'). */
-	FIELDSET 
+	FIELDSET;
+
+	/** 
+	 * Some inferred callouts generate private methods that are not advertised in the interface,
+	 * Answer if this callout binding is advertised in the interface. 
+	 */
+	public boolean isAdvertisedInInterface() {
+		if (this == NONE || this == INTERFACE)
+			return true;
+		return false;
+	}
 }
\ No newline at end of file
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CalloutImplementor.java b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CalloutImplementor.java
index 0a39b91..b0efc9a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CalloutImplementor.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CalloutImplementor.java
@@ -461,7 +461,7 @@
 		{
 			if ((modifiers & AccPrivate) != 0) { // don't advertize in ifc
 				// FIXME(SH): need to generate bridge methdods?
-			} else if (calloutBindingDeclaration.binding.inferred == InferenceKind.NONE) { // only if actually advertised in the ifc-part
+			} else if (calloutBindingDeclaration.binding.inferred.isAdvertisedInInterface()) { // only if actually advertised in the ifc-part
 				// generated callout method must be public in the classPart.
 				// access control is done only via the interface part.
 				MethodModel.getModel(newMethod).storeModifiers(newMethod.modifiers);