Results 1 to 3 of 3

Thread: Sequence of classes in Slice?

  1. #1
    bartley is offline Registered User
    Name: Chris Bartley
    Organization: Carnegie Mellon University Robotics Institute
    Project: The Telepresence Robot Kit (TeRK)
    Join Date
    Dec 2005
    Posts
    52

    Question Sequence of classes in Slice?

    Is it not possible to have a sequence of classes in Slice while using the Java sequence mapping metadata?

    For example, the Java generated by the following Slice compiles just fine:

    Code:
    #ifndef TEST_ICE
    #define TEST_ICE
    
    module TestModule
       {
       class Foo
          {
          int fooInt;
          };
    
       sequence<Foo> FooSet;
    
       interface Baz
          {
          FooSet getFoos();
          };
       };
    
    #endif
    But changing the declaration of FooSet to...

    Code:
    ["java:type:java.util.HashSet<Foo>"] sequence<Foo> FooSet;
    ...causes the Java compilation die with the following error:

    Code:
        [javac] Compiling 21 source files to D:\Test\build\java\src
        [javac] D:\Test\code\java\src-gen\TestModule\FooSetHelper.java:46: cannot find symbol
        [javac] symbol  : constructor ListPatcher(java.util.HashSet<TestModule.Foo>,java.lang.Class<TestModule.Foo>,java.lang.String,int)
        [javac] location: class IceInternal.ListPatcher
        [javac]         __is.readObject(new IceInternal.ListPatcher(__v, Foo.class, __type0, __i0));
        [javac]                             ^
        [javac] 1 error
    But, if you then change the Foo class to a struct (but leave the sequence mapping metadata), then the Java compilation works again. Am I doing something wrong?

    thanks,

    Chris

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Hi Chris,

    It works when you change from a class to a struct only by accident. The Java mapping requires that any custom sequence type implement java.util.List, which is not true for java.util.HashSet.

    Take care,
    - Mark

  3. #3
    bartley is offline Registered User
    Name: Chris Bartley
    Organization: Carnegie Mellon University Robotics Institute
    Project: The Telepresence Robot Kit (TeRK)
    Join Date
    Dec 2005
    Posts
    52
    Wow, thanks Mark. Somehow I'd totally missed the java.util.List requirement in the FAQ which explains the mapping metadata. Thanks!

    chris

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Python: repr() of Slice structs/classes
    By cebix in forum Comments
    Replies: 2
    Last Post: 04-15-2008, 08:24 AM
  2. Replies: 2
    Last Post: 06-04-2007, 09:53 PM
  3. eclipse gives warning about slice generated classes
    By ctennis in forum Bug Reports
    Replies: 2
    Last Post: 05-02-2007, 05:36 PM
  4. Regenerate slice classes
    By lucsat in forum Help Center
    Replies: 2
    Last Post: 12-29-2005, 05:36 AM
  5. no Slice classes in Ice-E?
    By n2503v in forum Help Center
    Replies: 1
    Last Post: 10-06-2005, 01:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •