Skip to content

Avoid Gson mutation of final ApplicationInfo field on modern JDKs #2030

Description

@gregjotau

On JDK 26, SaleToAcquirerDataSerializerTest emits this warning while Gson deserializes terminal application info:

WARNING: Final field adyenLibrary in class com.adyen.model.applicationinfo.ApplicationInfo has been mutated reflectively by class com.google.gson.internal.bind.ReflectiveTypeAdapterFactory...
WARNING: Mutating final fields will be blocked in a future release unless final field mutation is enabled

ApplicationInfo initializes adyenLibrary in its no-argument constructor, but Gson then populates the JSON value reflectively. The field being final therefore does not prevent mutation today; it only invokes deep reflection that modern JDKs are restricting (JEP 500): https://openjdk.org/jeps/500

This code is used by terminal SaleToAcquirerData serialization/deserialization. Applications should not need --enable-final-field-mutation=ALL-UNNAMED for ordinary SDK model handling.

Proposed fix: make this serialized field non-final, matching the rest of the Gson model. The public API remains unchanged (getAdyenLibrary() remains read-only).

Verification: the focused round-trip serialization test passes without the final-field warning, and the full 617-test suite passes on JDK 26.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions