Archived

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

Ice 3.5.0 java optional return values.

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

  • mes
    mes California
    This is the expected behavior. See this page in the manual for more information.

    Mark
  • Thank you, I was missing the "java:optional" metadata tag.