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

Clarify contract of Portable Factories (Class Definition?) #9813

Closed
jerrinot opened this issue Feb 7, 2017 · 5 comments

Comments

Projects
None yet
2 participants
@jerrinot
Copy link
Contributor

commented Feb 7, 2017

A customer is reporting that if exchanging data between .NET and Java, the PortableFactories for each must define the fields in the same order particularly for the key. If they are not the key appears not to exist in the other language.

The solution is to define the fields in the same order in each. Is that a bug? If not it should be clearly documented.

@sancar

This comment has been minimized.

Copy link
Member

commented Feb 7, 2017

It is not a bug, order needs to be same in all platforms. It needs be to be documented.

@sancar

This comment has been minimized.

Copy link
Member

commented Feb 7, 2017

To avoid confusion, I want to add more detail:

A portable object does not have to be read in order they are written. One can read in any order, or one can read only one field. There is no problem with that.
writePortable and readPortable does not have to be consistent.

But when same class defined in two different place, their write methods inside writePortable method needs to be in same order.
writePortable from dotnet and writePortable from java has to be consistent.

@jerrinot

This comment has been minimized.

Copy link
Contributor Author

commented Feb 7, 2017

@sancar: thanks for clarification. could this be avoided by explicitly registered ClassDefinition ?

@sancar

This comment has been minimized.

Copy link
Member

commented Feb 7, 2017

@jerrinot
That means you are gonna create ClassDefinition via ClassDefinitionBuilder right ?
If you create ClassDefinitions in different orders, then again you have same problem.

new ClassDefinitionBuilder(1, 2).addBooleanField("a").addCharField("b").build();
new ClassDefinitionBuilder(1, 2).addCharField("b").addBooleanField("a").build();  
@sancar

This comment has been minimized.

Copy link
Member

commented Feb 9, 2017

Closing. We updated the doc.

@sancar sancar closed this Feb 9, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.