You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@polygene.apache.org by "Paul Merlin (JIRA)" <ji...@apache.org> on 2017/04/02 17:53:42 UTC

[jira] [Resolved] (POLYGENE-157) Remove support for legacy Map serialization format.

     [ https://issues.apache.org/jira/browse/POLYGENE-157?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Merlin resolved POLYGENE-157.
----------------------------------
    Resolution: Fixed

> Remove support for legacy Map serialization format.
> ---------------------------------------------------
>
>                 Key: POLYGENE-157
>                 URL: https://issues.apache.org/jira/browse/POLYGENE-157
>             Project: Polygene
>          Issue Type: Sub-task
>            Reporter: Niclas Hedhman
>            Assignee: Paul Merlin
>             Fix For: 3.0
>
>
> In Qi4j 1.x, we serialized the Maps as
> [
>     { "key":"abc", "value":"def" )
> ]
> which in 2.x became
> {
>     "abc":"def"
> }
> We should remove the old format to make the code cleaner and less confusing.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Re: [jira] [Resolved] (POLYGENE-157) Remove support for legacy Map serialization format.

Posted by Paul Merlin <pa...@apache.org>.
Paul Merlin a �crit :
> Niclas Hedhman a �crit :
>> Q; This "if keys are Strings", do you iterate through them or do you use
>> ParameterizedType ?
>
> All keys must be a character or a sequence of characters:
> https://github.com/apache/polygene-java/blob/develop/core/spi/src/main/java/org/apache/polygene/serialization/javaxjson/JavaxJsonSerializer.java#L213-L215
>
> I'll add specific coverage for that.

The thing with maps with mixed key types is that we can't always
deserialize them, MapType<Object, ?> is not enough. It will work with
mixed value composite types thanks to _type, but won't if you e.g. mix
LocalDateTime and value composites as keys. In the latter case we will
fail with "Don't know how to deserialize Object from [json]".

See the coverage I just added:
https://github.com/apache/polygene-java/blob/develop/extensions/serialization-javaxjson/src/test/java/org/apache/polygene/serialization/javaxjson/JavaxJsonCollectionSerializationTest.java#L67



Re: [jira] [Resolved] (POLYGENE-157) Remove support for legacy Map serialization format.

Posted by Paul Merlin <pa...@apache.org>.
Niclas Hedhman a �crit :
> I am just a bit worried about looping the maps.

Right, keys are looped once with a predicate, and then entries are
looped once for actual serialization.

We can't get a handle on the ParameterizedType there due to type erasure
because we don't have an enclosing class. What we could do is look at
the first entry in the map instead of looking at all of them. But this
would break some use cases with mixed keys that actually work.


Re: [jira] [Resolved] (POLYGENE-157) Remove support for legacy Map serialization format.

Posted by Niclas Hedhman <ni...@hedhman.org>.
I am just a bit worried about looping the maps.

On Mon, Apr 3, 2017 at 3:41 PM, Paul Merlin <pa...@apache.org> wrote:

> Niclas Hedhman a écrit :
> > Q; This "if keys are Strings", do you iterate through them or do you use
> > ParameterizedType ?
>
> All keys must be a character or a sequence of characters:
> https://github.com/apache/polygene-java/blob/develop/
> core/spi/src/main/java/org/apache/polygene/serialization/
> javaxjson/JavaxJsonSerializer.java#L213-L215
>
> I'll add specific coverage for that.
>
>
>
> > On Mon, Apr 3, 2017 at 1:53 AM, Paul Merlin (JIRA) <ji...@apache.org>
> wrote:
> >
> >>      [ https://issues.apache.org/jira/browse/POLYGENE-157?page=
> >> com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
> >>
> >> Paul Merlin resolved POLYGENE-157.
> >> ----------------------------------
> >>     Resolution: Fixed
> >>
> >>> Remove support for legacy Map serialization format.
> >>> ---------------------------------------------------
> >>>
> >>>                 Key: POLYGENE-157
> >>>                 URL: https://issues.apache.org/
> jira/browse/POLYGENE-157
> >>>             Project: Polygene
> >>>          Issue Type: Sub-task
> >>>            Reporter: Niclas Hedhman
> >>>            Assignee: Paul Merlin
> >>>             Fix For: 3.0
> >>>
> >>>
> >>> In Qi4j 1.x, we serialized the Maps as
> >>> [
> >>>     { "key":"abc", "value":"def" )
> >>> ]
> >>> which in 2.x became
> >>> {
> >>>     "abc":"def"
> >>> }
> >>> We should remove the old format to make the code cleaner and less
> >> confusing.
> >>
> >>
> >>
> >> --
> >> This message was sent by Atlassian JIRA
> >> (v6.3.15#6346)
> >>
> >
> >
> >
>



-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java

Re: [jira] [Resolved] (POLYGENE-157) Remove support for legacy Map serialization format.

Posted by Paul Merlin <pa...@apache.org>.
Niclas Hedhman a �crit :
> Q; This "if keys are Strings", do you iterate through them or do you use
> ParameterizedType ?

All keys must be a character or a sequence of characters:
https://github.com/apache/polygene-java/blob/develop/core/spi/src/main/java/org/apache/polygene/serialization/javaxjson/JavaxJsonSerializer.java#L213-L215

I'll add specific coverage for that.



> On Mon, Apr 3, 2017 at 1:53 AM, Paul Merlin (JIRA) <ji...@apache.org> wrote:
>
>>      [ https://issues.apache.org/jira/browse/POLYGENE-157?page=
>> com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>>
>> Paul Merlin resolved POLYGENE-157.
>> ----------------------------------
>>     Resolution: Fixed
>>
>>> Remove support for legacy Map serialization format.
>>> ---------------------------------------------------
>>>
>>>                 Key: POLYGENE-157
>>>                 URL: https://issues.apache.org/jira/browse/POLYGENE-157
>>>             Project: Polygene
>>>          Issue Type: Sub-task
>>>            Reporter: Niclas Hedhman
>>>            Assignee: Paul Merlin
>>>             Fix For: 3.0
>>>
>>>
>>> In Qi4j 1.x, we serialized the Maps as
>>> [
>>>     { "key":"abc", "value":"def" )
>>> ]
>>> which in 2.x became
>>> {
>>>     "abc":"def"
>>> }
>>> We should remove the old format to make the code cleaner and less
>> confusing.
>>
>>
>>
>> --
>> This message was sent by Atlassian JIRA
>> (v6.3.15#6346)
>>
>
>
>

Re: [jira] [Resolved] (POLYGENE-157) Remove support for legacy Map serialization format.

Posted by Niclas Hedhman <ni...@hedhman.org>.
Q; This "if keys are Strings", do you iterate through them or do you use
ParameterizedType ?

On Mon, Apr 3, 2017 at 1:53 AM, Paul Merlin (JIRA) <ji...@apache.org> wrote:

>
>      [ https://issues.apache.org/jira/browse/POLYGENE-157?page=
> com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> Paul Merlin resolved POLYGENE-157.
> ----------------------------------
>     Resolution: Fixed
>
> > Remove support for legacy Map serialization format.
> > ---------------------------------------------------
> >
> >                 Key: POLYGENE-157
> >                 URL: https://issues.apache.org/jira/browse/POLYGENE-157
> >             Project: Polygene
> >          Issue Type: Sub-task
> >            Reporter: Niclas Hedhman
> >            Assignee: Paul Merlin
> >             Fix For: 3.0
> >
> >
> > In Qi4j 1.x, we serialized the Maps as
> > [
> >     { "key":"abc", "value":"def" )
> > ]
> > which in 2.x became
> > {
> >     "abc":"def"
> > }
> > We should remove the old format to make the code cleaner and less
> confusing.
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.3.15#6346)
>



-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java