Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 201867 Details for
Bug 355315
callout inferred to implement protected method causes IllegalAccessError
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Test & fix
Bug_355315.patch (text/plain), 6.34 KB, created by
Stephan Herrmann
on 2011-08-21 09:56:44 EDT
(
hide
)
Description:
Test & fix
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2011-08-21 09:56:44 EDT
Size:
6.34 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/objectteams/otdt/core/compiler/InferenceKind.java >=================================================================== >--- compiler/org/eclipse/objectteams/otdt/core/compiler/InferenceKind.java (revision 1867) >+++ compiler/org/eclipse/objectteams/otdt/core/compiler/InferenceKind.java (working copy) >@@ -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 >Index: compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CalloutImplementor.java >=================================================================== >--- compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CalloutImplementor.java (revision 1867) >+++ compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CalloutImplementor.java (working copy) >@@ -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); >#P org.eclipse.objectteams.otdt.tests >Index: otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutMethodBinding.java >=================================================================== >--- otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutMethodBinding.java (revision 1927) >+++ otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutMethodBinding.java (working copy) >@@ -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() {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 355315
: 201867