Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2011-08-21 13:57:24 +0000
committerStephan Herrmann2011-08-21 13:57:24 +0000
commit112057c11de9a510cd9838764ddc63ffb47744a7 (patch)
treea5187f6ae3327608cdd8d81693c1499c4e6300b1 /testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams
parent770250c73c6e23a221fb1da96791dfa619516f6f (diff)
downloadorg.eclipse.objectteams-112057c11de9a510cd9838764ddc63ffb47744a7.tar.gz
org.eclipse.objectteams-112057c11de9a510cd9838764ddc63ffb47744a7.tar.xz
org.eclipse.objectteams-112057c11de9a510cd9838764ddc63ffb47744a7.zip
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).
Diffstat (limited to 'testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams')
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutMethodBinding.java67
1 files changed, 54 insertions, 13 deletions
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 7ec05a289..ff3278bce 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 @@ public class CalloutMethodBinding extends AbstractOTJLDTest {
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 @@ public class CalloutMethodBinding extends AbstractOTJLDTest {
" \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 @@ public class CalloutMethodBinding extends AbstractOTJLDTest {
"----------\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 @@ public class CalloutMethodBinding extends AbstractOTJLDTest {
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() {

Back to the top