Home Bug Reports

slice2java compile issue

danleepwdanleepw Member Dan LeeOrganization: RumyourProject: Financial computing engine
Hi,

I am using ICE 3.4.0 slice2java to generate java class. When I put a metadata ["java:type:java.util.ArrayList"] for sequence, it will generate a xxxHelper.java which does not put correct type when "new" the arraylist in "pubic static read" method. So, could we improve the slice2java to put correct type for it? Thanks for your attention.

Comments

  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    Please have a look at this section of the manual. It explains that it is your responsibility to use the correct type in your custom type metadata because slice2java is simply copying the type name from your metadata into the generated code. For example:
    // Slice
    ["java:type:java.util.ArrayList<String>"] sequence<string> StringSeq;
    
    If you are still having trouble, please post an example of the Slice code that is causing the problem.

    Regards,
    Mark
  • danleepwdanleepw Member Dan LeeOrganization: RumyourProject: Financial computing engine
    Hi Mes,

    Thanks for the reply. I suggest that slice2java compiler would add the type into the generated class since the compiler knows what type should be added from definition. Also, if we want to create a sequence of a user-Defined Type, we need to hard code the full class name in the slice language which is not so convenient when we make some changes on modules.

    Regards,
    Dan
Sign In or Register to comment.