Archived
This forum has been archived. Please start a new discussion on GitHub.
Is this a cross-platform/language problem ?
If a server-side programmer uses java5 platform and he write a slice file which uses some java5 features such as generic, special collection:
Of course, the server-side programmer has no problem to use this slice file in java5 platform. Then he distributes this slice file to client-side programmer.
However, the client-side programmer uses java2 platform instead of java5 platform, so he uses the following command to generate code:
This generates two files: StringListHolder.java, StringListHelper.java. More details of StringListHolder.java is as follows:
These two files can not be compiled in java2 platform. So is it a problem of cross-platform/language ? Maybe slice2java should be smarter so that it can generate different code in java2 platform. To do so, there is a need for the client-side programmer to pass some cue to slice2java.
#ifndef SIMPLETEST_ICE #define SIMPLETEST_ICE module Simpletest { ["java:type:java.util.LinkedList<String>:java.util.List<String>"] sequence<string> StringList; }; #endif
Of course, the server-side programmer has no problem to use this slice file in java5 platform. Then he distributes this slice file to client-side programmer.
However, the client-side programmer uses java2 platform instead of java5 platform, so he uses the following command to generate code:
slice2java --output-dir generated Simpletest.ice
This generates two files: StringListHolder.java, StringListHelper.java. More details of StringListHolder.java is as follows:
//... public final class StringListHolder { public StringListHolder() { } public StringListHolder(java.util.List<String> value) { this.value = value; } public java.util.List<String> value; } //...
These two files can not be compiled in java2 platform. So is it a problem of cross-platform/language ? Maybe slice2java should be smarter so that it can generate different code in java2 platform. To do so, there is a need for the client-side programmer to pass some cue to slice2java.
0
Comments
-
What goes on the wire in both cases is identical -- so there is no cross-platform/cross-language problem. What you are running into is using specific language meta-data changes the compiled definitions of the slice definitions. To solve this problem you can either use two sets of slice definitions with different pieces of meta-data, or you can use #ifdef to do this. Something like:
module Simpletest { #ifdef JAVA5 ["java:type:java.util.LinkedList<String>:java.util.List<String>"] #endif sequence<string> StringList; };
0 -
To solve this problem you can either use two sets of slice definitions with different pieces of meta-data, or you can use #ifdef to do this.
Yes, these are two solutions, but I think they are not the best! It's better if slice2java can solve this.0