Consider Serializable class A with the following properties:
- a readObject() method
- no writeObject() method
- readObject()'s first action is ois.defaultReadFields()
Since there is no writeObject() method, serial.PlainDescriptor.readSerial() marks an end of stream on the BlockUnmarshaller (and thus the ObjectInputStream) so that if/when readObject() tries to read bytes from the write side's nonexistant writeObject() method, it will read an EOF (-1) instead, to preserve forward compatibility between object versions.
However, this means that when readObject() calls ois.defaultReadFields(), the block input is in the wrong state and reading fields fails, usually with an unexpected TC_ENDBLOCKDATA.