Patch: fix for PR 1971
Tom Tromey
tromey@redhat.com
Thu Mar 8 17:34:00 GMT 2001
This fixes PR libgcj/1971.
See the comment in the code for the explanation.
This is going on the trunk, branch, and into Classpath.
2001-03-08 Tom Tromey <tromey@redhat.com>
* java/io/ObjectStreamClass.java (setUID): Don't write interface
info for array classes.
Fixes PR libgcj/1971.
Tom
Index: java/io/ObjectStreamClass.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/ObjectStreamClass.java,v
retrieving revision 1.6
diff -u -r1.6 ObjectStreamClass.java
--- ObjectStreamClass.java 2001/01/06 23:28:40 1.6
+++ ObjectStreamClass.java 2001/03/09 01:30:28
@@ -444,11 +444,15 @@
| Modifier.INTERFACE | Modifier.PUBLIC);
data_out.writeInt (modifiers);
- Class[] interfaces = cl.getInterfaces ();
- Arrays.sort (interfaces, interfaceComparator);
- for (int i=0; i < interfaces.length; i++)
- data_out.writeUTF (interfaces[i].getName ());
-
+ // Pretend that an array has no interfaces, because when array
+ // serialization was defined (JDK 1.1), arrays didn't have it.
+ if (! cl.isArray ())
+ {
+ Class[] interfaces = cl.getInterfaces ();
+ Arrays.sort (interfaces, interfaceComparator);
+ for (int i=0; i < interfaces.length; i++)
+ data_out.writeUTF (interfaces[i].getName ());
+ }
Field field;
Field[] fields = cl.getDeclaredFields ();
More information about the Java-patches
mailing list