[m-rev.] diff: make some java classes serializable

Peter Wang novalazy at gmail.com
Thu Oct 7 17:44:21 AEDT 2010


Branches: main

library/bitmap.m:
library/builtin.m:
library/mutvar.m:
library/version_array.m:
        Make hand-written Java classes in these modules implement
        `java.io.Serializable'.

diff --git a/library/bitmap.m b/library/bitmap.m
index 1b7ea2f..ed321b2 100644
--- a/library/bitmap.m
+++ b/library/bitmap.m
@@ -1531,7 +1531,7 @@ combine_hash(X, H0, H) :-
 ").
 
 :- pragma foreign_code("Java", "
-public static class MercuryBitmap {
+public static class MercuryBitmap implements java.io.Serializable {
     public int num_bits;
     public byte[] elements;
 
diff --git a/library/builtin.m b/library/builtin.m
index 18f5a2a..9095360 100644
--- a/library/builtin.m
+++ b/library/builtin.m
@@ -1032,7 +1032,7 @@ __Compare____tuple_0_0(object x, object y)
     }
 ").
 :- pragma foreign_code("Java", "
-    public static class Void_0
+    public static class Void_0 implements java.io.Serializable
     {
         // Make the constructor private to ensure that we can
         // never create an instance of this class.
diff --git a/library/mutvar.m b/library/mutvar.m
index 491d74d..f2c55e6 100644
--- a/library/mutvar.m
+++ b/library/mutvar.m
@@ -142,7 +142,7 @@ new_mutvar(X, Ref) :-
 
 :- pragma foreign_code("Java",
 "
-    public static class Mutvar {
+    public static class Mutvar implements java.io.Serializable {
         public Object object;
 
         public Mutvar() {
diff --git a/library/version_array.m b/library/version_array.m
index 7f6c237..eaaa191 100644
--- a/library/version_array.m
+++ b/library/version_array.m
@@ -1326,7 +1326,7 @@ public interface ML_va {
 //
 // It just wraps the unsafe version is some synchronization logic so
 // that only one thread can be accessing the array at one instant.
-public static class ML_sva implements ML_va {
+public static class ML_sva implements ML_va, java.io.Serializable {
     private ML_uva version_array;
     private Object lock;
 
@@ -1389,7 +1389,7 @@ public static class ML_sva implements ML_va {
 
 // An implementation of version arrays that is only safe when used from
 // a single thread, but *much* faster than the synchronized version.
-public static class ML_uva implements ML_va {
+public static class ML_uva implements ML_va, java.io.Serializable {
     private int                 index;  /* -1 for latest, >= 0 for older */
     private Object              value;  /* Valid if index >= 0           */
     private Object              rest;   /* array if index == -1          */

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list