Archived

This forum has been archived. Please start a new discussion on GitHub.

slice2freeze: warning: use of sequences

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

  • bernard
    bernard Jupiter, FL
    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
  • I use that slice definition
    sequence<byte> serialNumber;

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

    thanks
    Andrew
  • What is alternative of using sequence as key in ICE when I really need it?
  • bernard
    bernard Jupiter, FL
    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
  • 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.