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

Support Java Records when present in JVM. #2201

Merged
merged 4 commits into from Oct 11, 2022
Merged

Support Java Records when present in JVM. #2201

merged 4 commits into from Oct 11, 2022

Commits on Oct 9, 2022

  1. Support Java Records when present in JVM.

    Fixes #1794
    
    Added support in the ReflectionHelper to detect if a class is a record
    on the JVM (via reflection), and if so, we will create a special
    RecordAdapter to deserialize records, using the canoncial constructor.
    
    The ReflectionTypeAdapterFactory had to be refactored a bit to support
    this. The Adapter class inside the factory is now abstract, with
    concrete implementations for normal field reflection and for Records.
    The common code is in the Adapter, with each implementation
    deserializing values into an intermediary object.
    
    For the FieldReflectionAdapter, the intermediary is actually the final
    result, and field access is used to write to fields as before. For the
    RecordAdapter the intermediary is the Object[] to pass to the Record
    constructor.
    staale committed Oct 9, 2022
    Copy the full SHA
    1989562 View commit details
    Browse the repository at this point in the history
  2. Fixed comments from @Marcono1234

    Also updated so that we now use the record accessor method to read out
    values from a record, so that direct field access is not necessary.
    
    Also added some tests, that should only execute on Java versions with
    record support, and be ignored for other JVMs
    staale committed Oct 9, 2022
    Copy the full SHA
    d12141e View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    c4c1730 View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2022

  1. Copy the full SHA
    b6b448b View commit details
    Browse the repository at this point in the history