Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transient Fields are not ignored as Mutators if there is visible Getter #3682

Closed
cowtowncoder opened this issue Nov 25, 2022 · 0 comments
Closed
Labels
2.15 Issues planned for 2.15
Milestone

Comments

@cowtowncoder
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.15 Issues planned for 2.15
Projects
None yet
Development

No branches or pull requests

1 participant