private void copyFieldAttributes ( ) { if ( ( loadFields == null ) || fields == null ) { return ; } for ( int i = 0 ; i < loadFields . length ; i ++ ) { ObjectStreamField loadField = loadFields [ i ] ; String name = loadField . getName ( ) ; for ( int j = 0 ; j < fields . length ; j ++ ) { ObjectStreamField field = fields [ j ] ; if ( name . equals ( field . getName ( ) ) ) { loadField . setUnshared ( field . isUnshared ( ) ) ; loadField . setOffset ( field . getOffset ( ) ) ; break ; } } } }
If a Class uses serialPersistentFields to define the serialized fields this . loadFields cannot get the unshared information when deserializing fields using current implementation of ObjectInputStream . This method provides a way to copy the unshared attribute from this . fields .