Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2010-04-23 21:43:46 +0000
committerStephan Herrmann2010-04-23 21:43:46 +0000
commit61a7122617c5c432bbad619cbb2fbfca6c885283 (patch)
treeabd481a10cf243cfe9489cf7d29c6ae2cb629a16 /othersrc
parent90988d1515dc1bf1d87892cee46d12cc96153a7e (diff)
downloadorg.eclipse.objectteams-61a7122617c5c432bbad619cbb2fbfca6c885283.tar.gz
org.eclipse.objectteams-61a7122617c5c432bbad619cbb2fbfca6c885283.tar.xz
org.eclipse.objectteams-61a7122617c5c432bbad619cbb2fbfca6c885283.zip
cleaned up version of the patches from bug 304728 and bug 304729 (second strategy).
Diffstat (limited to 'othersrc')
-rw-r--r--othersrc/OTRE/src/org/eclipse/objectteams/otre/BaseMethodTransformation.java2
-rw-r--r--othersrc/OTRE/src/org/objectteams/Team.java36
2 files changed, 37 insertions, 1 deletions
diff --git a/othersrc/OTRE/src/org/eclipse/objectteams/otre/BaseMethodTransformation.java b/othersrc/OTRE/src/org/eclipse/objectteams/otre/BaseMethodTransformation.java
index 1e2799d75..da6f50e53 100644
--- a/othersrc/OTRE/src/org/eclipse/objectteams/otre/BaseMethodTransformation.java
+++ b/othersrc/OTRE/src/org/eclipse/objectteams/otre/BaseMethodTransformation.java
@@ -1825,7 +1825,7 @@ public class BaseMethodTransformation
* @return the generated field
*/
private Field generateRoleSet(ConstantPoolGen cpg, String class_name) {
- FieldGen fg = new FieldGen(Constants.ACC_PROTECTED,
+ FieldGen fg = new FieldGen(Constants.ACC_PROTECTED|Constants.ACC_TRANSIENT,
OTConstants.roleSetType,
OTConstants.ROLE_SET,
cpg);
diff --git a/othersrc/OTRE/src/org/objectteams/Team.java b/othersrc/OTRE/src/org/objectteams/Team.java
index c6c5f3309..1968c991a 100644
--- a/othersrc/OTRE/src/org/objectteams/Team.java
+++ b/othersrc/OTRE/src/org/objectteams/Team.java
@@ -17,6 +17,9 @@
package org.objectteams;
import java.awt.EventQueue;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.util.HashSet;
import java.util.Iterator;
import java.util.WeakHashMap;
@@ -487,4 +490,37 @@ public /* team */ class Team implements ITeam {
@SuppressWarnings("unused")
int i= 2+3; // Note: body must not be empty for debuggger to be able to stop.
} // $Debug(FinalizeMethod)
+
+ /**
+ * If a serializable team wishes to persist its global activation status it must
+ * call this method from its writeObject() method and correspondingly call
+ * {@link #readGlobalActivationState(ObjectInputStream)} from its readObject().
+ */
+ protected void writeGlobalActivationState(ObjectOutputStream out) throws IOException {
+ out.writeBoolean(this._OT$globalActive);
+ }
+ /**
+ * If a serializable team wishes to persist its global activation status it must
+ * call this method from its readObject() method and correspondingly call
+ * {@link #writeGlobalActivationState(ObjectOutputStream)} from its writeObject().
+ * If a team is restored that was globally active when serialized, it will be activated
+ * correspondingly during deserialization when this method is called.
+ */
+ protected void readGlobalActivationState(ObjectInputStream in) throws IOException {
+ this._OT$globalActive = in.readBoolean();
+ if (this._OT$globalActive) {
+ this._OT$lazyGlobalActiveFlag = true;
+ this.doRegistration();
+ }
+ }
+ /**
+ * Serializable teams must invoke this method once from their readObject() method
+ * in order to re-initialize internal data structures.
+ */
+ protected void restore() { /* empty; implementation will be generated for each serializable sub-class. */ }
+ /**
+ * Serializable teams must invoke this method from their readObject() method
+ * for each role that has been retrieved and shall be re-registered for this team.
+ */
+ protected void restoreRole(Class<?> clazz, Object role) { /* empty; implementation will be generated for each serializable sub-class. */ }
}

Back to the top