You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Glen Takahashi (JIRA)" <ji...@apache.org> on 2018/08/07 18:08:00 UTC

[jira] [Commented] (IGNITE-9201) Immutables derived values aren't properly set on deserialization

    [ https://issues.apache.org/jira/browse/IGNITE-9201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16572066#comment-16572066 ] 

Glen Takahashi commented on IGNITE-9201:
----------------------------------------

Ah! Nevermind. Figured out that I can create a `readResolve` method on the immutables object which we can use to manually fix the object in cases like this.

 

Closing out as this isn't really a bug but more of an enhancement and there are mechanisms to workaround this currently today.

> Immutables derived values aren't properly set on deserialization
> ----------------------------------------------------------------
>
>                 Key: IGNITE-9201
>                 URL: https://issues.apache.org/jira/browse/IGNITE-9201
>             Project: Ignite
>          Issue Type: Bug
>          Components: cache
>    Affects Versions: 2.6
>            Reporter: Glen Takahashi
>            Priority: Major
>
> When using the @Value.Derived annotation for an Immutables class, the Immutables-generated class implementation sets those values as `transient` because they are meant to be constructed by the builder. 
> Because Ignite ignores transient variables when marshalling to a BinaryObject, and also because Ignite uses reflection to unmarshal from a BinaryObject, those transient variables are left uninitialized in the returned Immutables object from the cache.
> One idea would be instead to use an ObjectMapper and store a string/json representation in the cache and deserialize manually with the ObjectMapper, but was hoping there would be a better way to natively support Immutables and/or Jackson-serializable objects by not using Reflection in some cases.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)