Home Help Center

Ice 3.5.0 java optional return values.

jrrayjrray Member J Robert RayOrganization: ImageworksProject: cutlist server
Given:
module Demo {
    interface OptReturn {
        optional(1) string returnOptionalString();
    };
};

slice2java generates client-side code to support the optional return type:
public interface OptReturnPrx extends Ice.ObjectPrx
{
    public Ice.Optional<String> returnOptionalString();
}

But it generates server-side code that ignores the optional return type:
public interface _OptReturnOperations
{
    String returnOptionalString(Ice.Current __current);
}

public abstract class _OptReturnDisp extends Ice.ObjectImpl implements OptReturn
{
    public final String returnOptionalString()
    {
        return returnOptionalString(null);
    }
}

The AMD type (if enabled) also ignores the optional type:
public interface AMD_OptReturn_returnOptionalString extends Ice.AMDCallback
{
    void ice_response(String __ret);
}

Comments

  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    This is the expected behavior. See this page in the manual for more information.

    Mark
  • jrrayjrray Member J Robert RayOrganization: ImageworksProject: cutlist server
    Thank you, I was missing the "java:optional" metadata tag.
Sign In or Register to comment.