1

I use Protostuff RuntimeSchema in the most basic way :

Schema<Bean> schema = RuntimeSchema.createFrom(Bean.class);

I will save the result byte[] somewhere and deserialize it in the future.

But there is a chance that I will add some fields in Bean.class (and also generate a new schema).

I tested some times, it works fine, i can get the new fields as null.

But I want to make sure if it is always safe, assuming that new fields are always added in the end of Bean, and always use HotSpot JDK.

Mobility
  • 3,117
  • 18
  • 31

1 Answers1

0

Yes, if you append field to the end of the fields list, it is safe. RuntimeSchema assigns tags to fields according to their order in the class.

However, things might get a little bit tricky if you use inheritance. In this case you should consider using @Tag annotation.

Kostiantyn
  • 935
  • 8
  • 13