Archived

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

Ice-3.6b java : small source code bug

slice2java will not produce compilable code with the following slice file:
#ifndef TEST_ICE
#define TEST_ICE

module test { 

  exception GenericError
  {
    string message;
  };
  
  exception IOError extends GenericError {};
 
  interface TestIce 
  {
    double getDouble() throws IOError;
  };

};
#endif
I believe that the problem is with the following source code.

In src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDouble.java :

method 'response' has wrong argument type:
    public void response(byte arg)
    {
        if(__responseCb != null)
        {
            __responseCb.apply(arg);
        }
    }

Should be:
    @Override
    public void response(double arg)
    {
        if(__responseCb != null)
        {
            __responseCb.apply(arg);
        }
    }

Everything appears to build and test OK with this change.

Comments

  • slice compile error for us, too

    This might be the same problem: when compiling this slice
    ...
            double calcTwoTheta(double h,
                                                            double k,
                                                            double l, 
                                                        double a,
                                                        double b,
                                                        double c,
                                                        double alpha,
                                                        double beta,
                                                        double gamma) throws exceptions::CommandException;
    

    we get this error in the compiler:
    [javac] /home/ncnr/workspaceluna/NICE/generated/nice/api/ClientApiPrxHelper.java:764: error: <anonymous nice.api.ClientApiPrxHelper$4> is not abstract and does not override abstract method response(double) in TwowayCallbackDouble

    which points to this section of code in the generated java:
    private Ice.AsyncResult begin_calcTwoTheta(double h, 
                                                   double k, 
                                                   double l, 
                                                   double a, 
                                                   double b, 
                                                   double c, 
                                                   double alpha, 
                                                   double beta, 
                                                   double gamma, 
                                                   java.util.Map<String, String> __ctx, 
                                                   boolean __explicitCtx, 
                                                   boolean __synchronous, 
                                                   IceInternal.Functional_DoubleCallback __responseCb, 
                                                   IceInternal.Functional_GenericCallback1<Ice.UserException> __userExceptionCb, 
                                                   IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb, 
                                                   IceInternal.Functional_BoolCallback __sentCb)
        {
            return begin_calcTwoTheta(h, k, l, a, b, c, alpha, beta, gamma, __ctx, __explicitCtx, __synchronous, 
                                      new IceInternal.Functional_TwowayCallbackDoubleUE(__responseCb, __userExceptionCb, __exceptionCb, __sentCb)
                                          {
                                              public final void __completed(Ice.AsyncResult __result)
                                              {
                                                  ClientApiPrxHelper.__calcTwoTheta_completed(this, __result);
                                              }
                                          });
        }
    
  • benoit
    benoit Rennes, France
    Hi,

    Yes, this is indeed the same problem. Fixing the type of the response method parameter in:

    Ice-3.6b/java/src/Ice/src/main/java/IceInternal/Functional_TwowayCallbackDouble.java

    and re-compiling Ice for Java should fix the issue.

    Cheers,
    Benoit.