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/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 7ec05a2..ff3278b 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
@@ -432,20 +432,20 @@
         
         runNegativeTest(
              new String[] {
- 		"T311acb1Main.java",
+ 		"T311acb8Main.java",
  			    "\n" +
- 			    "public class T311acb1Main {\n" +
+ 			    "public class T311acb8Main {\n" +
  			    "    public static void main(String[] args) {\n" +
  			    "        Team311acb2 t = new Team311acb2();\n" +
- 			    "        T311acb1_1  o = new T311acb1_1();\n" +
+ 			    "        T311acb8_1  o = new T311acb8_1();\n" +
  			    "\n" +
  			    "        System.out.print(t.getValue(o));\n" +
  			    "    }\n" +
  			    "}\n" +
  			    "    \n",
- 		"T311acb1_1.java",
+ 		"T311acb8_1.java",
  			    "\n" +
- 			    "public class T311acb1_1 {\n" +
+ 			    "public class T311acb8_1 {\n" +
  			    "    public String getValue() {\n" +
  			    "        return getValueInternal();\n" +
  			    "    }\n" +
@@ -456,21 +456,21 @@
  			    "    \n",
 	    "Team311acb2.java",
  			    "\n" +
- 			    "public team class Team311acb2 extends Team311acb1 {\n" +
+ 			    "public team class Team311acb2 extends Team311acb8 {\n" +
  			    "    @Override\n" +
- 			    "    public class Role311acb1 playedBy T311acb1_1 {\n" +
+ 			    "    public class Role311acb8 playedBy T311acb8_1 {\n" +
  			    "        getValue -> getValue;\n" +
  			    "    }\n" +
  			    "\n" +
- 			    "    public String getValue(T311acb1_1 as Role311acb1 obj) {\n" +
+ 			    "    public String getValue(T311acb8_1 as Role311acb8 obj) {\n" +
  			    "        return obj.getValueInternal();\n" +
  			    "    }\n" +
  			    "}\n",
- 		"Team311acb1.java",
+ 		"Team311acb8.java",
  			    "\n" +
- 			    "public abstract team class Team311acb1 {\n" +
+ 			    "public abstract team class Team311acb8 {\n" +
  			    "\n" +
- 			    "    public abstract class Role311acb1 {\n" +
+ 			    "    public abstract class Role311acb8 {\n" +
  			    "        public abstract String getValue();\n" +
  			    "        public abstract String getValueInternal();\n" +
  			    "    }\n" +
@@ -480,9 +480,9 @@
             "----------\n" + 
 			"1. ERROR in Team311acb2.java (at line 1)\n" + 
 			"	\n" + 
-			"public team class Team311acb2 extends Team311acb1 {\n" + 
+			"public team class Team311acb2 extends Team311acb8 {\n" + 
 			"	^\n" + 
-			"The abstract method getValueInternal in type Role311acb1 can only be defined by an abstract class\n" + 
+			"The abstract method getValueInternal in type Role311acb8 can only be defined by an abstract class\n" + 
 			"----------\n");
      }
 
@@ -2779,6 +2779,47 @@
             null/*no custom requestor*/);
     }
 
+    // Bug 355315 - callout inferred to implement protected method causes IllegalAccessError
+    public void test3117_inferredCallout11() {
+       Map customOptions = getCompilerOptions();
+       customOptions.put(CompilerOptions.OPTION_ReportInferredCallout, CompilerOptions.WARNING);
+       
+       runConformTest(
+            new String[] {
+		"Team3117ic11.java",
+			    "\n" +
+			    "public team class Team3117ic11 {\n" +
+			    "    @SuppressWarnings(\"inferredcallout\")\n" +
+			    "    protected class R1 extends R0 playedBy T3117ic11 {\n" +
+			    "    }\n" +
+			    "    protected abstract class R0 {\n" +
+			    "        abstract protected void test();\n" +
+			    "    }\n" +
+			    "    Team3117ic11() {\n" +
+			    "        new R1(new T3117ic11()).test();\n" +
+			    "    }\n" +
+			    "    public static void main(String[] args) {\n" +
+			    "        new Team3117ic11();\n" +
+			    "    }\n" +
+			    "}\n" +
+			    "    \n",
+		"T3117ic11.java",
+			    "\n" +
+			    "public class T3117ic11 {\n" +
+			    "    public void test() {\n" +
+			    "        System.out.print(\"OK\");\n" +
+			    "    }\n" +
+			    "}\n" +
+			    "    \n"
+            },
+            "OK",
+            null/*classLibraries*/,
+            true/*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() {