Classpath ObjectIn/OutputStream merge
Mark Wielaard
mark@klomp.org
Sun Feb 23 16:15:00 GMT 2003
Hi,
Here is finally the remaining ObjectIn/OutputStream remerge with GNU
Classpath. It is still not 100% complete but I think this is important
enough to get into 3.3. The old code could get into infinite recursion
some of the time (triggered by some Mauve tests, which was why they were
disabled). The things that have to happen for a full merge are:
- Reindent both Classpath and libgcj code (will do this as soon as this
goes in.
- Merge getCurrentClassLoader() code. libgcj just always returns the
system classloader for now.
- ObjectInputStream DataInput primitive wrappers. I just don't
understand the Classpath code. But it does not impact the Mauve tests
and the libgcj code didn't do it in the past anyway.
Even without this the patch is already large but all important logic is
in. I tried to make a detailed ChangeLog (note that the diff looks huge
but if requested I can send a diff -w that shows that a big part of the
patch is just reindenting two large try-catch-finally blocks):
2003-02-23 Mark Wielaard <mark@klomp.org>
* Makefile.am (nat_source_files): Remove
java/io/natObjectOutputStream.cc.
* Makefile.in: Regenerated.
* mauve-libgcj: Don't exclude java.io.ObjectInputOutput tests.
* java/io/ObjectStreamField.java (typename): New field.
(ObjectStreamField(String, Class)): Initialize new field.
(ObjectStreamField(String, String)): New Constructor.
(getTypeCode): Use new field.
(getTypeString): Use new field.
* java/io/ObjectOutputStream.java (writeObject): Rethrow fatal
ObjectStreamExceptions. Remember and reset old BlockDataMode.
Handle reading of Proxy classes. Never drain(), just write
TC_ENDBLOCKDATA. Rethrow ObjectStreamExceptions.
(drain): Check writeDataAsBlocks before calling writeBlockDataHeader.
(flush): Call flush(), not just drain().
(writeBoolean): Always use blockDataOutput.
(writeByte): Likewise.
(writeShort): Likewise.
(writeChar): Likewise.
(writeInt): Likewise.
(writeLong): Likewise.
(writeFloat): Likewise.
(writeDouble): Likewise.
(writeBytes): Likewise.
(putfield (put(String,Object))): Throw IllegalArgumentException if
field cannot be found.
(putfield (write(ObjectOutput))): Remember old BlockDataMode.
(writeArraySizeAndElements): Write byte[] in one go.
(writeFields): Write TC_ENDBLOCKDATA when call_write_method, otherwise
set BlockDataMode to false.
(annotateProxyClass): New method.
(defaultProtocolVersion): Now defaults to PROTOCOL_VERSION_2
(getField): No longer native.
(getMethod): Likewise.
(setBlockDataMode): Always drain() on switch, return old mode.
(static): New static code block.
* java/io/natObjectOutputStream.cc: Removed.
* java/io/ObjectInputStream.java (getField): No longer native.
(getMethod): Likewise.
(readObject): Remember and reset old BlockDataMode. Track whether
object is consumed. Handle TC_ENDBLOCKDATA, TC_PROXYCLASSDESC and
TC_LONGSTRING.
(defaultReadObject): Set BlockDataMode to false during readFields.
(resolveClass): Create new SecurityManager if necessary.
Use Class.forName() if null ClassLoader found.
(read(byte[],int,int): Copy remaining bytes to data before calling
readNextBlock().
(readFields): Set and reset BlockDataMode on call_read_method.
Catch NoSuchFieldErrors.
(setBlockDataMode): Return old mode.
(static): New static code block.
* java/io/natObjectInputStream.cc (getField): Removed.
(getMethod): Likewise.
OK for branch and mainline?
It enables the Mauve tests that we were unable to run previously. This
does introduce some new failures (but also 35 new passes):
FAIL: gnu.testlet.java.io.ObjectInputOutput.InputTest: gnu.testlet.java.io.ObjectInputOutput.Test$GetPutField (number 1)
FAIL: gnu.testlet.java.io.ObjectInputOutput.OutputTest: Serializable: gnu.testlet.java.io.ObjectInputOutput.Test$Extern () (number 2)
FAIL: gnu.testlet.java.io.ObjectInputOutput.OutputTest: Serializable: test(str=null, x=0) (number 2)
FAIL: gnu.testlet.java.io.ObjectInputOutput.SerTest (number 2)
These failures are the same as seen with Kissme+Classpath and the old
libgcj code could either not run these tests in the first place or gave
the same results. There is a Classpath patch pending to resolve the last
one. I will try to investigate the others next week and either fix them
or xfail them.
Cheers,
Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ObjectXputStream.patch
Type: text/x-patch
Size: 54187 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20030223/67464fa9/attachment.bin>
More information about the Java-patches
mailing list