JDK-8075802 : ObjectOutputStream.putFields() should clarify behaviour of multiple calls
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io:serialization
  • Affected Version: 8,9
  • Priority: P4
  • Status: Resolved
  • Resolution: Won't Fix
  • Submitted: 2015-03-24
  • Updated: 2017-11-01
  • Resolved: 2017-11-01
Related Reports
Relates :  
Description
The specification for putFields is as follows:

  "Retrieve the object used to buffer persistent fields to be written to the
   stream. The fields will be written to the stream when writeFields method
   is called.
   Returns:  an instance of the class Putfield that holds the serializable fields"

It is ambiguous as to whether the same instance is returned for multiple calls.

The current implementation of putFields in ObjectOutputStream returns the same instance for multiple calls.