You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by "Alexey Goncharuk (JIRA)" <ji...@apache.org> on 2015/12/08 11:47:11 UTC

[jira] [Created] (IGNITE-2104) Marshalling fails with Binary marshaller if class hierarchy contains duplicate field names

Alexey Goncharuk created IGNITE-2104:
----------------------------------------

             Summary: Marshalling fails with Binary marshaller if class hierarchy contains duplicate field names
                 Key: IGNITE-2104
                 URL: https://issues.apache.org/jira/browse/IGNITE-2104
             Project: Ignite
          Issue Type: Bug
          Components: general
    Affects Versions: 1.5
            Reporter: Alexey Goncharuk
             Fix For: 1.5


Binary marshaller writes {{fieldId}} which is calculated solely on the field name. If a class hierarchy contains fields with the same name, marshalling will fail:

{code}
class ClassA{
    private int field;
}

class ClassB extends ClassA {
    private int field;
}
{code}

Even though a private field with the same name in parent and child classes is a error-prone approach, default serialization supports this.

Possible solutions:
 * Keep it as it is now and properly document. The issue appeared only in an artificial test. No other tests on TC revealed duplicate fields.
 * Write all serializable classes in old format. While this solution works perfectly for the marshalling, it will require objects to be deserialized on server nodes in order for indexing to work, which defeats the purpose of BinaryMarshaller
 * Inspect the class at runtime and use new format if no duplicate fields are detected, and print a warning message and switch to the old format otherwise.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)