You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like transient Fields are only ignored in cases if there is no explicit or just visible accessors, and as such Field like this:
public class Sizable {
public transient int size; // lazily calculated
public int getSize() {
...
}
}
would actually try to use field size for setting value during deserialization. Without getSize() it would, however, be dropped despite being visible otherwise.
While this is not often problem with POJOs it is problematic with many JDK types (and probably some 3rd party libraries); and intent was never to "pull in" such Fields. It does, for example, break handling of LinkedList for JDK 17 and above, in cases where it (or sub-class) is to be serialized "as POJO".
So, for 2.15 let's prune these Fields.
The text was updated successfully, but these errors were encountered:
Looks like
transient
Fields are only ignored in cases if there is no explicit or just visible accessors, and as such Field like this:would actually try to use field
size
for setting value during deserialization. WithoutgetSize()
it would, however, be dropped despite being visible otherwise.While this is not often problem with POJOs it is problematic with many JDK types (and probably some 3rd party libraries); and intent was never to "pull in" such Fields. It does, for example, break handling of
LinkedList
for JDK 17 and above, in cases where it (or sub-class) is to be serialized "as POJO".So, for 2.15 let's prune these Fields.
The text was updated successfully, but these errors were encountered: