Home Help Center

slice2freeze: warning: use of sequences

AndrewAndrew Member Andrea NicotraOrganization: PersonalProject: Backend for IPTV
Hi,

after the update to ice 3.3.0 I receive that warning:

slice2freeze: warning: use of sequences in dictionary keys has been deprecated

why I can't use of sequences in dictionary?

Andrew

Comments

  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Andrew,

    This warning is actually not Freeze-specific; you'll also get it if you try to use a sequence as a key in a regular Slice dictionary.

    Out of curiosity, could you post the Slice definition for this key? Also, which language mapping do you use?

    We decided to deprecate sequences in dictionary keys because their language mapping is problematic, and sometimes very error-prone. One obvious issue is in Java, where by default a Slice sequence is mapped to a Java array. The default equals() for array objects is reference equality, which is not appropriate when comparing the keys of a map.

    Best regards,
    Bernard
  • AndrewAndrew Member Andrea NicotraOrganization: PersonalProject: Backend for IPTV
    I use that slice definition
    sequence<byte> serialNumber;

    in our system we use cpp for the service and java for the client.

    thanks
    Andrew
  • rGloryrGlory Member Vyacheslav KononenkoOrganization: PrivateProject: Distributed Financial Application
    What is alternative of using sequence as key in ICE when I really need it?
  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    There is currently no alternative.

    Since this sequence-in-keys feature is deprecated, but still there, you could still use it for now. In Java, I recommend to map the sequence(s) in your keys to something other than the default (array), since array equals is just Object equality, which is not desirable or correct.

    See Customizing the Java Mapping - Ice 3.5 - ZeroC

    Best regards,
    Bernard
  • rGloryrGlory Member Vyacheslav KononenkoOrganization: PrivateProject: Distributed Financial Application
    Personally I am not using java mapping at all, but the fact that you plan to remove this option just because there is difficulty in implementation in one language is not very promising. I hope you at least would not remove it without providing some alternative.
Sign In or Register to comment.