Archived

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

How to use Slice defined Types in another definition

Hi there,

I've defined few types in Slice in one Java module. I'll need to use these types in a Slice definition of a different module.

Java Module Foo
<CODE>
module Foo {
class FooClass {
string foostr;
};
};
</CODE>

Java Module Bar
<CODE>
module Bar {
class BarClass {
FooClass foo;
};
};
</CODE>

Any help is greatly appreciated?

Thanks,
Venkat

Comments

  • In Slice code, use Foo::FooClass, just like in C++. In Java code, use Foo.FooClass.
  • Marc, thanks for the reply.

    slice2java compiler complains that:
    `com' is not defined.

    Should I use "::" as the package separator instead of "."?

    Venkat
  • One more clarification, the slice definitions for Foo and bar are in different files, namely Foo.ice and Bar.ice in separate namespaces.

    Thanks,
    venkat
  • In Slice, you must use "::" as scope operator, not ".". If the Slice definitions are in separate files, then you must use a #include statement to include the definitions where required.