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 201140 Details for
Bug 354244
Role-side callin guard predicate interferes with Team.isExecutingCallin()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
test & fix
Bug_354244.patch (text/plain), 7.82 KB, created by
Stephan Herrmann
on 2011-08-09 09:16:57 EDT
(
hide
)
Description:
test & fix
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2011-08-09 09:16:57 EDT
Size:
7.82 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CallinImplementor.java >=================================================================== >--- compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CallinImplementor.java (revision 1774) >+++ compiler/org/eclipse/objectteams/otdt/internal/core/compiler/mappings/CallinImplementor.java (working copy) >@@ -497,8 +497,14 @@ > > // ------------- support for reflective function isExecutingCallin(): > // boolean oldIsExecutingCallin = _OT$setExecutingCallin(); >+ // try { ... main dispatching statements ... } >+ // finally { resetFlag } > MessageSend resetFlag = setExecutingCallin(roleModel, statements); > >+ // from here on all statements go into the try block - with "finally { resetFlag(); }" >+ ArrayList<Statement> tryStatements = new ArrayList<Statement>(); >+ >+ > // -------------- call receiver & arguments -------------- > //_OT$role.myRoleMethod(_OT$param0, ...); > // or: >@@ -517,7 +523,7 @@ > return false; > } > // pack unmapped arguments (positions are set by above makeWrapperCallArguments): >- packUnmappedArgs(baseMethodSpec, callinBindingDeclaration, callinWrapperDecl, statements, gen); >+ packUnmappedArgs(baseMethodSpec, callinBindingDeclaration, callinWrapperDecl, tryStatements, gen); > > // for role-side predicate > Expression[] predicateArgs = null; >@@ -557,7 +563,7 @@ > > //MyRole _OT$role = _OT$liftToMyRole(_OT$base_arg); > if (needRoleVar) >- statements.add(createLiftedRoleVar(callinBindingDeclaration, roleModel, baseTypeBinding, otBaseArg, gen)); >+ tryStatements.add(createLiftedRoleVar(callinBindingDeclaration, roleModel, baseTypeBinding, otBaseArg, gen)); > > // store mapped arguments in local variables to use for predicate check > // and wrapper call. >@@ -566,7 +572,7 @@ > Expression[] newArgs = new Expression[plainLen]; > for (int i = offset; i < messageSendArguments.length; i++) { > char[] localName = (OT_LOCAL+i).toCharArray(); >- statements.add(gen.localVariable( >+ tryStatements.add(gen.localVariable( > localName, > roleParameters[i-offset], > new PotentialRoleReceiverExpression(messageSendArguments[i], ROLE_VAR_NAME, gen.typeReference(roleModel.getClassPartBinding())))); >@@ -595,7 +601,7 @@ > gen); > if (predicateCheck != null) > // predicateCheck(_OT$role) >- statements.add(predicateCheck); >+ tryStatements.add(predicateCheck); > > // ------------- the role message send: > MessageSend roleMessageSend = gen.messageSend(receiver, roleMethodName, messageSendArguments); >@@ -642,12 +648,35 @@ > callinBindingDeclaration.resultVar = gen.localVariable( > IOTConstants.OT_RESULT, wrapperReturnType, null); > callinBindingDeclaration.resultVar.type.setBaseclassDecapsulation(DecapsulationState.REPORTED); >- statements.add(callinBindingDeclaration.resultVar); >- Statement roleMessageSendStatement = gen.assignment( >- gen.singleNameReference(IOTConstants.OT_RESULT), >- roleMessageSendExpression); >+ tryStatements.add(callinBindingDeclaration.resultVar); >+ tryStatements.add(gen.assignment( >+ gen.singleNameReference(IOTConstants.OT_RESULT), >+ roleMessageSendExpression)); >+ >+ // ResultNotProvidedException? >+ if (isReturnBoxed && !callinBindingDeclaration.isResultMapped) >+ { >+ tryStatements.add(genResultNotProvidedCheck( >+ this._role.getTeamModel().getBinding().sourceName(), >+ roleTypeName, roleMethodBinding, baseTypeBinding, baseMethodSpec, gen)); >+ } >+ // ------------- possibly convert using result mapping >+ if ( callinBindingDeclaration.mappings != null >+ && callinBindingDeclaration.isResultMapped) >+ { >+ tryStatements.add( >+ stepOverGen.returnStatement( >+ new PotentialRoleReceiverExpression( >+ callinBindingDeclaration.getResultExpression(baseMethodSpec, isReturnBoxed, stepOverGen), >+ ROLE_VAR_NAME, >+ gen.typeReference(roleModel.getClassPartBinding())))); >+ } else { >+ tryStatements.add( >+ stepOverGen.returnStatement(stepOverGen.singleNameReference(IOTConstants.OT_RESULT))); >+ } >+ > TryStatement tryFinally = gen.tryFinally( >- new Statement[] {roleMessageSendStatement}, >+ tryStatements.toArray(new Statement[tryStatements.size()]), > new Statement[] {resetFlag}); > // for debugging: > // tryFinally.catchArguments = new Argument[] { >@@ -672,35 +701,15 @@ > // }; > statements.add(tryFinally); > >- // ResultNotProvidedException? >- if (isReturnBoxed && !callinBindingDeclaration.isResultMapped) >- { >- statements.add(genResultNotProvidedCheck( >- this._role.getTeamModel().getBinding().sourceName(), >- roleTypeName, roleMethodBinding, baseTypeBinding, baseMethodSpec, gen)); >- } >- // ------------- possibly convert using result mapping >- if ( callinBindingDeclaration.mappings != null >- && callinBindingDeclaration.isResultMapped) >- { >- statements.add( >- stepOverGen.returnStatement( >- new PotentialRoleReceiverExpression( >- callinBindingDeclaration.getResultExpression(baseMethodSpec, isReturnBoxed, stepOverGen), >- ROLE_VAR_NAME, >- gen.typeReference(roleModel.getClassPartBinding())))); >- } else { >- statements.add( >- stepOverGen.returnStatement(stepOverGen.singleNameReference(IOTConstants.OT_RESULT))); >- } > } else { > // try { > // _OT$role.myRoleMethod(_OT$param0); > // finally { > // _OT$setExecutingCallin(oldIsExecutingCallin); > // } >+ tryStatements.add(roleMessageSend); > statements.add(gen.tryFinally( >- new Statement[] {roleMessageSend}, >+ tryStatements.toArray(new Statement[tryStatements.size()]), > new Statement[] {resetFlag})); > statements.add(stepOverGen.returnStatement(null)); // empty return to ensure step-over in the end > } >#P org.eclipse.objectteams.otdt.tests >Index: otjld/org/eclipse/objectteams/otdt/tests/otjld/teamactivation/Predicates.java >=================================================================== >--- otjld/org/eclipse/objectteams/otdt/tests/otjld/teamactivation/Predicates.java (revision 1767) >+++ otjld/org/eclipse/objectteams/otdt/tests/otjld/teamactivation/Predicates.java (working copy) >@@ -2652,7 +2652,51 @@ > "----------\n"); > } > >+ // Bug 354244 - Role-side callin guard predicate interferes with Team.isExecutingCallin() >+ public void test914_bindingPredicate22() { > >+ runConformTest( >+ new String[] { >+ "T914bp22Main.java", >+ "\n" + >+ "public class T914bp22Main {\n" + >+ " public static void main(String[] args) {\n" + >+ " Team914bp22 t = new Team914bp22();\n" + >+ " T914bp22 o = new T914bp22();\n" + >+ " t.activate();\n" + >+ " o.test(1);\n" + >+ " if (t.isExecutingCallin())\n" + >+ " throw new Error(\"Flag not reset\");\n" + >+ " }\n" + >+ "}\n" + >+ " \n", >+ "T914bp22.java", >+ "\n" + >+ "public class T914bp22 {\n" + >+ " public void test(int value) {\n" + >+ " System.out.print(\"OK\");\n" + >+ " }\n" + >+ "} \n" + >+ " \n", >+ "Team914bp22.java", >+ "\n" + >+ "public team class Team914bp22 {\n" + >+ " public int code = 0;\n" + >+ " protected class Role1 playedBy T914bp22 \n" + >+ " {\n" + >+ " void print(int value) {\n" + >+ " System.out.print(\"NOT\");\n" + >+ " }\n" + >+ " void print(int value) <- before void test(int value)\n" + >+ " when (Team914bp22.this.code == value);\n" + >+ " }\n" + >+ "} \n" + >+ " \n" >+ }, >+ "OK"); >+ } >+ >+ > // a role method has a guard predicate > // 9.1.5-otjld-method-predicate-1 > public void test915_methodPredicate1() {
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 354244
: 201140